Common User Interface for USB host Android Open Accessory Protocol.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include "uhc.h"
Macros | |
Commands from accessory to Android device | |
#define | MESSAGE_ATD_SIMPLE_SWITCH 0x01 |
#define | MESSAGE_ATD_SENSOR_TEMPERATURE 0x10 |
#define | MESSAGE_ATD_SENSOR_LIGHT 0x11 |
Commands from Android device to accessory | |
#define | MESSAGE_DTA_SIMPLE_LED 0x02 |
#define | MESSAGE_DTA_SIMPLE_DISPLAY_BACKLIGHT 0x03 |
#define | MESSAGE_DTA_STRING_BASIC 0x20 |
Functions | |
void | read_complete (usb_add_t add, usb_ep_t ep, uhd_trans_status_t, iram_size_t) |
Called when Bulk IN Transfer is finished. More... | |
void | ui_init (void) |
Initializes the user interface. More... | |
void | ui_uhi_aoa_change (uhc_device_t *dev, bool b_plug) |
void | ui_usb_connection_event (uhc_device_t *dev, bool b_present) |
Notify that a USB device has been connected or disconnected. More... | |
void | ui_usb_enum_event (uhc_device_t *dev, uhc_enum_status_t status) |
Notify the end of a USB device enumeration process. More... | |
void | ui_usb_message_reception (void) |
Processing of a Message from the Android device. More... | |
void | ui_usb_mode_change (bool b_host_mode) |
Notify that the USB mode is switched automatically. This is only possible when the ID pin is available. More... | |
void | ui_usb_sof_event (void) |
Notify that a SOF has been sent (each 1 ms) More... | |
void | ui_usb_vbus_change (bool b_vbus_present) |
Notify that a Vbus is changed Available only in USB hardware with Vbus monitoring. More... | |
void | ui_usb_vbus_error (void) |
Notify that a Vbus error has occurred Available only in USB hardware with Vbus monitoring. More... | |
void | ui_usb_wakeup_event (void) |
Notify that a USB device or the host woke up the USB line. More... | |
#define MESSAGE_ATD_SENSOR_LIGHT 0x11 |
#define MESSAGE_ATD_SENSOR_TEMPERATURE 0x10 |
#define MESSAGE_ATD_SIMPLE_SWITCH 0x01 |
Referenced by ui_usb_sof_event().
#define MESSAGE_DTA_SIMPLE_DISPLAY_BACKLIGHT 0x03 |
Referenced by ui_usb_message_reception().
#define MESSAGE_DTA_SIMPLE_LED 0x02 |
Referenced by ui_usb_message_reception().
#define MESSAGE_DTA_STRING_BASIC 0x20 |
Referenced by ui_usb_message_reception().
void read_complete | ( | usb_add_t | add, |
usb_ep_t | ep, | ||
uhd_trans_status_t | , | ||
iram_size_t | |||
) |
Called when Bulk IN Transfer is finished.
References AOA_READ_ERROR, AOA_READ_SUCCESS, AOA_READ_TIMEOUT, read_complete_flag, UHD_TRANS_ABORTED, UHD_TRANS_CRC, UHD_TRANS_DISCONNECT, UHD_TRANS_DT_MISMATCH, UHD_TRANS_NOERROR, UHD_TRANS_NOTRESPONDING, UHD_TRANS_PIDFAILURE, UHD_TRANS_STALL, and UHD_TRANS_TIMEOUT.
Referenced by ui_usb_sof_event().
void ui_init | ( | void | ) |
Initializes the user interface.
References AOA_READ_TIMEOUT, LED0, LED1, LED2, LED3, LED_Off(), read_complete_flag, ui_buttons_enable(), ui_display_enable(), ui_pwm_init(), and ui_pwm_led_init().
Referenced by main().
void ui_uhi_aoa_change | ( | uhc_device_t * | dev, |
bool | b_plug | ||
) |
References ui_aoa_plug.
void ui_usb_connection_event | ( | uhc_device_t * | dev, |
bool | b_present | ||
) |
Notify that a USB device has been connected or disconnected.
dev | Pointer on USB device information |
b_present | true, if the device has been connected |
References uhi_aoa_uninstall(), ui_display_init_rtc(), ui_display_welcome_msg(), and ui_enum_status.
void ui_usb_enum_event | ( | uhc_device_t * | dev, |
uhc_enum_status_t | status | ||
) |
Notify the end of a USB device enumeration process.
dev | Pointer on USB device information |
status | Status of the USB enumeration |
References BLACK, BLUE, et024006_DrawFilledRect(), ET024006_HEIGHT, et024006_PrintString(), ET024006_WIDTH, FONT8x16, ui_display_disable_rtc(), ui_display_draw_textbox(), ui_enum_status, and WHITE.
void ui_usb_message_reception | ( | void | ) |
Processing of a Message from the Android device.
References BLUE, DISPLAY_FIRST_LINE_X, DISPLAY_FIRST_LINE_Y, DISPLAY_MAX_LINES, DISPLAY_PWM_CHANNEL_ID, et024006_PrintString(), FONT8x16, LED1, LED2_PWM_CHANNEL_ID, LED3_PWM_CHANNEL_ID, LED_Off(), LED_On(), MESSAGE_DTA_SIMPLE_DISPLAY_BACKLIGHT, MESSAGE_DTA_SIMPLE_LED, MESSAGE_DTA_STRING_BASIC, ui_display_clr_screen(), ui_msg, and ui_pwm_update().
Referenced by ui_usb_sof_event().
void ui_usb_mode_change | ( | bool | b_host_mode | ) |
void ui_usb_sof_event | ( | void | ) |
Notify that a SOF has been sent (each 1 ms)
References AOA_READ_ONGOING, AOA_READ_SUCCESS, button_changed(), MESSAGE_ATD_SIMPLE_SWITCH, read_complete(), read_complete_flag, uhi_aoa_read(), uhi_aoa_write(), ui_button_state, ui_button_state_toggle, ui_enum_status, ui_msg, and ui_usb_message_reception().
void ui_usb_vbus_change | ( | bool | b_vbus_present | ) |
Notify that a Vbus is changed Available only in USB hardware with Vbus monitoring.
b_vbus_present | true, if Vbus is high. |
void ui_usb_vbus_error | ( | void | ) |
Notify that a Vbus error has occurred Available only in USB hardware with Vbus monitoring.
void ui_usb_wakeup_event | ( | void | ) |
Notify that a USB device or the host woke up the USB line.