void ui_usb_sof_event(void) { bool b_btn_state; static bool btn_suspend = false; static uint16_t counter_sof = 0; static uint16_t counter_sof_move_refresh = 0; if (ui_enum_status == UHC_ENUM_SUCCESS) { /* Display device enumerated and in active mode */ if (++counter_sof > ui_device_speed_blink) { counter_sof = 0; if (ui_hid_mouse_plug || ui_msc_plug) { LED_Toggle(LED0); } else { LED_On(LED0); } if (ui_test_done && !ui_test_result) { /* Test fail then blink BL */ backlight_toggle(); } } /* Scan button to enter in suspend mode and remote wakeup */ b_btn_state = (!ioport_get_pin_level(GPIO_PUSH_BUTTON_0)) ? true : false; if (b_btn_state != btn_suspend) { /* Button have changed */ btn_suspend = b_btn_state; if (b_btn_state) { /* Button has been pressed */ LED_Off(LED0); backlight_off(); ui_enable_asynchronous_interrupt(); uhc_suspend(true); return; } } /* Move the remote mouse pointer on the Board Monitor screen */ if (++counter_sof_move_refresh > 100) { counter_sof_move_refresh = 0; bm_mouse_pointer_move(bm_x / 8, bm_y / 8); } /* Power on a LED when the mouse button down */ if (ui_nb_down) { LED_On(LED0); } } }
void ui_host_sof_event(void) { bool b_btn_state; static bool btn_suspend_and_remotewakeup = false; static uint16_t counter_sof = 0; static uint16_t counter_sof_move_refresh = 0; if (ui_enum_status == UHC_ENUM_SUCCESS) { /* Display device enumerated and in active mode */ if (++counter_sof > ui_device_speed_blink) { counter_sof = 0; LED_Toggle(LED0); } /* Scan button to enter in suspend mode and remote wakeup */ b_btn_state = !ioport_get_pin_level(GPIO_PUSH_BUTTON_0); if (b_btn_state != btn_suspend_and_remotewakeup) { /* Button have changed */ btn_suspend_and_remotewakeup = b_btn_state; if (b_btn_state) { /* Button has been pressed */ ui_enable_asynchronous_interrupt(); LED_Off(LED0); uhc_suspend(true); return; } } /* Move the remote mouse pointer on the Board Monitor screen */ if (++counter_sof_move_refresh > 200) { counter_sof_move_refresh = 0; bm_mouse_pointer_move(bm_x / 8, bm_y / 8); } /* Power on a LED when the mouse button down */ if (ui_nb_down) { LED_On(LED0); } } }