225 // dsp_refresh.attach(callback(dsp, &Display::copy_to_lcd), 50ms); |
225 // dsp_refresh.attach(callback(dsp, &Display::copy_to_lcd), 50ms); |
226 tdsp.start(&refresh_display); |
226 tdsp.start(&refresh_display); |
227 |
227 |
228 printf("Attach timers\r\n"); |
228 printf("Attach timers\r\n"); |
229 splashscreen = true; |
229 splashscreen = true; |
230 splashscreen_timer.attach(callback(&end_splashscreen), 2ms); |
230 splashscreen_timer.attach(callback(&end_splashscreen), 5s); |
231 rst.fall(&reset_irq); |
231 rst.fall(&reset_irq); |
232 |
232 |
233 printf("SETUP DONE\r\n"); |
233 printf("SETUP DONE\r\n"); |
234 } |
234 } |
235 |
235 |
236 void end_splashscreen(void) |
236 void end_splashscreen(void) |
237 { |
237 { |
238 // print is forbidden here because we are in an ISR context here |
238 // print is forbidden here because we are in an ISR context here |
239 //printf("End of splash screen CB\r\n"); |
239 //printf("End of splash screen CB\r\n"); |
240 splashscreen = false; |
240 splashscreen = false; |
|
241 dsp->cls(); |
|
242 dsp->power_off(); |
241 } |
243 } |
242 |
244 |
243 void reset_irq_tmr(void) |
245 void reset_irq_tmr(void) |
244 { |
246 { |
245 must_reset = true; |
247 must_reset = true; |
254 { |
256 { |
255 // this should be called as a result of the HP_RST pin going LO |
257 // this should be called as a result of the HP_RST pin going LO |
256 printf("Reset connection to the main unit\n"); |
258 printf("Reset connection to the main unit\n"); |
257 if (DigitalIn(HP_RST).read() == 0) { |
259 if (DigitalIn(HP_RST).read() == 0) { |
258 byescreen_timer.detach(); // cancel a "poweroff", if any |
260 byescreen_timer.detach(); // cancel a "poweroff", if any |
|
261 splashscreen = false; // in case it still on |
259 |
262 |
260 if (hp == NULL) { |
263 if (hp == NULL) { |
261 printf("setup HP communication handler\r\n"); |
264 printf("setup HP communication handler\r\n"); |
262 hp = new HPSerial(HP_TX, HP_RX); |
265 hp = new HPSerial(HP_TX, HP_RX); |
263 } |
266 } |
426 dsp->draw_flag(cmd.value[0]); |
429 dsp->draw_flag(cmd.value[0]); |
427 } else if (cmd.cmd == 0x86) { |
430 } else if (cmd.cmd == 0x86) { |
428 // shutdown |
431 // shutdown |
429 dsp->show_byescreen(); |
432 dsp->show_byescreen(); |
430 byescreen_timer.attach(callback(&shutdown), 2s); |
433 byescreen_timer.attach(callback(&shutdown), 2s); |
431 } else { |
434 } else { |
432 // display related commands |
435 // display related commands |
433 dsp->show(cmd.cmd, cmd.value, cmd.size); |
436 dsp->show(cmd.cmd, cmd.value, cmd.size); |
434 } |
437 } |
435 #if defined(HAS_LED) |
438 #if defined(HAS_LED) |
436 led = 0; |
439 led = 0; |