void ui_usb_sof_event(void) { static uint16_t counter_sof = 0; uint8_t i = 0; if (ui_enum_status == UHC_ENUM_SUCCESS) { if (++counter_sof > 2000) { counter_sof = 0; } if (read_complete_flag != AOA_READ_ONGOING) { if (read_complete_flag == AOA_READ_SUCCESS) { ui_usb_message_reception(); } read_complete_flag = AOA_READ_ONGOING; uhi_aoa_read(ui_msg, sizeof(ui_msg), read_complete); } /* Buttons */ for (i = 0; i < 5; i++) { if (button_changed(i)) { ui_button_state[i] = !ui_button_state[i]; ui_msg[0] = MESSAGE_ATD_SIMPLE_SWITCH; ui_msg[1] = i; ui_msg[2] = ui_button_state[i]; uhi_aoa_write(ui_msg, 3, NULL); ui_button_state_toggle[i] = 0; } } } }
void ui_usb_sof_event(void) { static uint16_t counter_sof = 0; if (ui_enum_status == UHC_ENUM_SUCCESS) { /* Display device enumerated and in active mode */ if (++counter_sof > 2000) { counter_sof = 0; } if (counter_sof % 1000 == 0) { ui_adc_read(); } if (read_complete_flag != AOA_READ_ONGOING) { if (read_complete_flag == AOA_READ_SUCCESS) { ui_usb_message_reception(); } read_complete_flag = AOA_READ_ONGOING; uhi_aoa_read(ui_msg, sizeof(ui_msg), read_complete); } /* Buttons */ if (ui_button_state_changed) { ui_button_state[ui_button_state_changed - 1] = !ui_button_state[ui_button_state_changed - 1]; ui_msg[0] = MESSAGE_ATD_SIMPLE_SWITCH; ui_msg[1] = ui_button_state_changed - 1; ui_msg[2] = ui_button_state[ui_button_state_changed - 1]; uhi_aoa_write(ui_msg, 3, NULL); ui_button_state_changed = 0x00; } } }