void main_suspend_action(void) { ui_powerdown(); }
/** * \brief Main application function * * This function ensures that the hardware and drivers are initialized before * entering an infinite work loop. * * In the work loop, the maXTouch device is polled for new touch events and any * new event is passed on to the user interface implementation for processing. * The loop then attempts to enter sleep. * * The user interface processing itself is not started by the work loop, but by * the USB callback function for start of frame. */ int main(void) { #ifdef USB_DEVICE_LOW_SPEED uint16_t virtual_sof_sub; uint16_t virtual_sof; #endif /* maXTouch data structure */ static struct mxt_device device; /* Initialize system clocks */ sysclk_init(); /* Initialize interrupt vectors */ irq_initialize_vectors(); /* Enable interrupts */ cpu_irq_enable(); /* Initialize the sleep manager */ sleepmgr_init(); /* Initialize the board */ board_init(); /* Initialize the mXT touch device */ mxt_init(&device); /* Initialize the graphical library */ gfx_init(); /* Set correct landscape orientation */ gfx_set_orientation(GFX_SWITCH_XY | GFX_FLIP_Y); /* Set background color */ gfx_draw_filled_rect(0, 0, gfx_get_width(), gfx_get_height(), COLOR_BACKGROUND); /* Draw the help text */ gfx_draw_string_aligned( "Middle finger to move cursor\n" "Index finger to left click\n" "Ring finger to right click", gfx_get_width() / 2, gfx_get_height() / 2, &sysfont, GFX_COLOR_TRANSPARENT, GFX_COLOR_WHITE, TEXT_POS_CENTER, TEXT_ALIGN_CENTER); /* Initialize the user interface */ ui_init(); ui_powerdown(); /* Start USB stack to authorize VBus monitoring */ udc_start(); /* Check if there are any new touch data pending */ while (true) { if (mxt_is_message_pending(&device)) { if (mxt_read_touch_event(&device, &ui_touch_event) == STATUS_OK) { ui_flag_new_touch_event(); } } /* Try to sleep */ sleepmgr_enter_sleep(); #ifdef USB_DEVICE_LOW_SPEED /* No USB "Keep alive" interrupt available in low speed * to scan mouse interface then use main loop */ if (main_b_mouse_enable) { virtual_sof_sub = 0; virtual_sof = 0; if (virtual_sof_sub++ == 700) { virtual_sof_sub = 0; ui_process(virtual_sof++); } } #endif } }
void main_suspend_action(void) { l("main_suspend_action"); off1(); ui_powerdown(); }
void ui_init(void) { ui_powerdown(); LED_On(LED0); }