/*! \brief Main function. Execution starts here. */ int main(void) { static bool qtb0_last_state = false; static bool qtb1_last_state = false; bool qtb_state; irq_initialize_vectors(); cpu_irq_enable(); // Initialize ASF services sleepmgr_init(); sysclk_init(); board_init(); // Initialize sub task app_touch_init(); // The main loop while (true) { // Enter in sleep mode sleepmgr_enter_sleep(); // Check state of QTouch buttons qtb_state = app_touch_check_key_pressed(0); if (qtb_state != qtb0_last_state) { // QTouch button have changed qtb0_last_state = qtb_state; if (!qtb_state) { LED_On(LED0_GPIO); } else { LED_Off(LED0_GPIO); } } qtb_state = app_touch_check_key_pressed(1); if (qtb_state != qtb1_last_state) { // QTouch button have changed qtb1_last_state = qtb_state; if (!qtb_state) { LED_On(LED1_GPIO); } else { LED_Off(LED1_GPIO); } } } }
/*! \brief Main function. Execution starts here. */ int main(void) { irq_initialize_vectors(); cpu_irq_enable(); /* Initialize ASF services */ sleepmgr_init(); sysclk_init(); board_init(); gfx_mono_init(); sd_mmc_init(); rtc_init(); stdio_usb_init(); /* Initialize STDIO and start USB */ udc_stop(); /* Stop USB by default */ main_introduction(); /* Initialize tasks */ app_touch_init(); app_cpu_load_init(); app_sampling_init(); /* The main loop */ while (true) { /* Enter in sleep mode */ app_cpu_load_enter_sleep(); sleepmgr_enter_sleep(); /* Execute tasks */ app_usb_task(); app_microsd_task(); app_sampling_task(); app_touch_task(); app_cpu_load_task(); } }