User Interface.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | UI_WAKEUP_BPM_SRC BPM_BKUPWEN_EIC |
#define | UI_WAKEUP_EIC_LINE SW0_EIC_LINE |
#define | UI_WAKEUP_HANDLER button_handler |
#define | UI_WAKEUP_IRQ_LEVEL 5 |
#define | UI_WAKEUP_IRQN EIC_1_IRQn |
Functions | |
Internal routines to manage asynchronous interrupt pin change | |
This interrupt is connected to a switch and allows to wakeup CPU in low sleep mode. This wakeup the USB devices connected via a downstream resume. | |
static void | ui_enable_asynchronous_interrupt (void) |
Initializes and enables interrupt pin change. More... | |
static void | ui_disable_asynchronous_interrupt (void) |
Disables interrupt pin change. More... | |
static void | UI_WAKEUP_HANDLER (void) |
Interrupt handler for interrupt pin change. More... | |
Main user interface functions | |
void | ui_init (void) |
Initializes the user interface. More... | |
void | ui_usb_mode_change (bool b_host_mode) |
Notify that the USB mode are switched automatically. This is possible only when ID pin is available. More... | |
Callback to mange the HID mouse events | |
void | ui_uhi_hid_mouse_btn_left (bool b_state) |
void | ui_uhi_hid_mouse_btn_right (bool b_state) |
void | ui_uhi_hid_mouse_btn_middle (bool b_state) |
void | ui_uhi_hid_mouse_move (int8_t x, int8_t y, int8_t scroll) |
Callback to show the MSC read and write access | |
void | ui_start_read (void) |
void | ui_stop_read (void) |
void | ui_start_write (void) |
void | ui_stop_write (void) |
Host mode user interface functions | |
static uhc_enum_status_t | ui_enum_status = UHC_ENUM_DISCONNECT |
static uint16_t | ui_device_speed_blink |
static bool | ui_hid_mouse_plug = false |
static bool | ui_msc_plug = false |
static bool | ui_test_done |
static bool | ui_test_result |
static uint8_t | ui_nb_down = 0 |
void | ui_usb_vbus_change (bool b_vbus_present) |
Notify that a Vbus are 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_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. More... | |
void | ui_uhi_hid_mouse_change (uhc_device_t *dev, bool b_plug) |
Notify that a USB device HID has been connected or disconnected. More... | |
void | ui_uhi_msc_change (uhc_device_t *dev, bool b_plug) |
Notify that a USB device MSC has been connected or disconnected. More... | |
void | ui_usb_wakeup_event (void) |
Notify that a USB device or the host has wake up the USB line. More... | |
void | ui_usb_sof_event (void) |
Notify that a SOF has been sent (each 1 ms) More... | |
static void | ui_uhi_hid_mouse_btn (bool b_state) |
void | ui_test_flag_reset (void) |
Resets the status flag of the test. More... | |
void | ui_test_finish (bool b_success) |
Displays the result of the test. More... | |
#define UI_WAKEUP_BPM_SRC BPM_BKUPWEN_EIC |
#define UI_WAKEUP_EIC_LINE SW0_EIC_LINE |
Referenced by ui_disable_asynchronous_interrupt(), ui_enable_asynchronous_interrupt(), and UI_WAKEUP_HANDLER().
#define UI_WAKEUP_HANDLER button_handler |
Referenced by ui_enable_asynchronous_interrupt().
#define UI_WAKEUP_IRQ_LEVEL 5 |
Referenced by ui_enable_asynchronous_interrupt().
#define UI_WAKEUP_IRQN EIC_1_IRQn |
Referenced by ui_enable_asynchronous_interrupt().
|
static |
Disables interrupt pin change.
References eic_line_disable_interrupt(), sysclk_disable_peripheral_clock(), and UI_WAKEUP_EIC_LINE.
Referenced by ui_usb_wakeup_event(), and UI_WAKEUP_HANDLER().
|
static |
Initializes and enables interrupt pin change.
References EIC_ASYNCH_MODE, EIC_EDGE_FALLING_EDGE, eic_enable(), EIC_FILTER_DISABLED, EIC_LEVEL_LOW_LEVEL, eic_line_enable(), eic_line_enable_interrupt(), eic_line_set_callback(), eic_line_set_config(), eic_line_config::eic_mode, EIC_MODE_EDGE_TRIGGERED, sysclk_enable_peripheral_clock(), UI_WAKEUP_EIC_LINE, UI_WAKEUP_HANDLER, UI_WAKEUP_IRQ_LEVEL, and UI_WAKEUP_IRQN.
Referenced by ui_usb_sof_event().
void ui_init | ( | void | ) |
void ui_test_finish | ( | bool | b_success | ) |
Displays the result of the test.
b_success | true, if the test is successful |
References ui_test_done, and ui_test_result.
Referenced by main().
void ui_test_flag_reset | ( | void | ) |
|
static |
References ui_nb_down.
Referenced by ui_uhi_hid_mouse_btn_left(), ui_uhi_hid_mouse_btn_middle(), and ui_uhi_hid_mouse_btn_right().
void ui_uhi_hid_mouse_btn_left | ( | bool | b_state | ) |
References ui_uhi_hid_mouse_btn().
void ui_uhi_hid_mouse_btn_middle | ( | bool | b_state | ) |
References ui_uhi_hid_mouse_btn().
void ui_uhi_hid_mouse_btn_right | ( | bool | b_state | ) |
References ui_uhi_hid_mouse_btn().
void ui_uhi_hid_mouse_change | ( | uhc_device_t * | dev, |
bool | b_plug | ||
) |
Notify that a USB device HID has been connected or disconnected.
dev | Pointer on USB device information |
b_plug | true, if the device has been connected |
References ui_hid_mouse_plug, and UNUSED.
void ui_uhi_hid_mouse_move | ( | int8_t | x, |
int8_t | y, | ||
int8_t | scroll | ||
) |
References UNUSED.
void ui_uhi_msc_change | ( | uhc_device_t * | dev, |
bool | b_plug | ||
) |
Notify that a USB device MSC has been connected or disconnected.
dev | Pointer on USB device information |
b_plug | true, if the device has been connected |
References ui_msc_plug, and UNUSED.
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 LED0, LED_On, UHC_ENUM_DISCONNECT, ui_enum_status, and UNUSED.
Referenced by main_usb_connection_event().
void ui_usb_enum_event | ( | uhc_device_t * | dev, |
uhc_enum_status_t | status | ||
) |
Notify the end of a USB device enumeration.
dev | Pointer on USB device information |
status | Status of the USB enumeration |
References uhc_device_t::speed, UHC_ENUM_SUCCESS, UHD_SPEED_FULL, UHD_SPEED_HIGH, UHD_SPEED_LOW, ui_device_speed_blink, ui_enum_status, ui_test_done, and UNUSED.
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 GPIO_PUSH_BUTTON_0, ioport_get_pin_level(), LED0, LED_Off, LED_On, LED_Toggle, UHC_ENUM_SUCCESS, uhc_suspend(), ui_device_speed_blink, ui_enable_asynchronous_interrupt(), ui_enum_status, ui_hid_mouse_plug, ui_msc_plug, ui_nb_down, ui_test_done, and ui_test_result.
Referenced by main_usb_sof_event().
void ui_usb_vbus_change | ( | bool | b_vbus_present | ) |
Notify that a Vbus are changed Available only in USB hardware with Vbus monitoring.
b_vbus_present | true, if Vbus is high. |
References UNUSED.
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 has wake up the USB line.
References ui_disable_asynchronous_interrupt().
|
static |
Interrupt handler for interrupt pin change.
References eic_line_clear_interrupt(), eic_line_interrupt_is_pending(), sysclk_disable_peripheral_clock(), sysclk_enable_peripheral_clock(), uhc_is_suspend(), uhc_resume(), ui_disable_asynchronous_interrupt(), and UI_WAKEUP_EIC_LINE.
|
static |
Blink frequency depending on device speed
Referenced by ui_usb_enum_event(), and ui_usb_sof_event().
|
static |
Status of device enumeration
Referenced by ui_usb_connection_event(), ui_usb_enum_event(), and ui_usb_sof_event().
Notify the presence of a USB device mouse
Referenced by ui_uhi_hid_mouse_change(), and ui_usb_sof_event().
Notify the presence of a USB device MSC
Referenced by ui_uhi_msc_change(), and ui_usb_sof_event().
|
static |
Manages device mouse button down
Referenced by ui_uhi_hid_mouse_btn(), and ui_usb_sof_event().
|
static |
Status of the MSC test
Referenced by ui_test_finish(), ui_test_flag_reset(), ui_usb_enum_event(), and ui_usb_sof_event().
|
static |
Result of the MSC test
Referenced by ui_test_finish(), and ui_usb_sof_event().