User Interface.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | MOUSE_MOVE_COUNT 50 |
#define | MOVE_DOWN 2 |
#define | MOVE_LEFT 3 |
#define | MOVE_RIGHT 1 |
#define | MOVE_UP 0 |
#define | UI_WAKEUP_BPM_SRC BPM_BKUPWEN_EIC |
#define | UI_WAKEUP_EIC_LINE GPIO_PUSH_BUTTON_EIC_LINE |
#define | UI_WAKEUP_HANDLER button_handler |
#define | UI_WAKEUP_IRQ_LEVEL 5 |
#define | UI_WAKEUP_IRQN EIC_5_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. In USB device mode, this wakeup the USB host via a upstream resume. In USB host 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... | |
Variables | |
static bool | ui_b_host_mode = false |
Host mode user interface functions | |
static uhc_enum_status_t | ui_enum_status = UHC_ENUM_DISCONNECT |
static uint16_t | ui_device_speed_blink |
static int16_t | bm_x |
static int16_t | bm_y |
static uint8_t | ui_nb_down = 0 |
void | ui_host_vbus_change (bool b_vbus_present) |
Notify that a Vbus are changed Available only in USB hardware with Vbus monitoring. More... | |
void | ui_host_vbus_error (void) |
Notify that a Vbus error has occurred Available only in USB hardware with Vbus monitoring. More... | |
void | ui_host_connection_event (uhc_device_t *dev, bool b_present) |
Notify that a USB device has been connected or disconnected. More... | |
void | ui_host_enum_event (uhc_device_t *dev, uhc_enum_status_t status) |
Notify the end of a USB device enumeration. More... | |
void | ui_host_wakeup_event (void) |
Notify that a USB device or the host has wake up the USB line. More... | |
void | ui_host_sof_event (void) |
Notify that a SOF has been sent (each 1 ms) More... | |
static void | ui_host_hid_mouse_btn (bool b_state) |
void | ui_host_hid_mouse_btn_left (bool b_state) |
void | ui_host_hid_mouse_btn_right (bool b_state) |
void | ui_host_hid_mouse_btn_middle (bool b_state) |
void | ui_host_hid_mouse_move (int8_t x, int8_t y, int8_t scroll) |
Device mode user interface functions | |
#define | MOUSE_MOVE_RANGE 3 |
#define | MOUSE_MOVE_RANGE 3 |
static bool | ui_device_b_mouse_enable = false |
void | ui_device_suspend_action (void) |
Enters the user interface in low power mode Callback called when USB host sets USB line in suspend state. More... | |
void | ui_device_resume_action (void) |
Exits the user interface if the low power mode Callback called when USB host sets USB line in IDLE state. More... | |
void | ui_device_remotewakeup_enable (void) |
Enables the remotewakeup feature. More... | |
void | ui_device_remotewakeup_disable (void) |
Disables the remotewakeup feature. More... | |
bool | ui_device_mouse_enable (void) |
Enables the device mouse interface. More... | |
void | ui_device_mouse_disable (void) |
Disables the device mouse interface. More... | |
void | ui_device_sof_action (void) |
Scans the device mouse controls and shows the device status each USB SOF. More... | |
#define MOUSE_MOVE_COUNT 50 |
Referenced by ui_device_sof_action().
#define MOUSE_MOVE_RANGE 3 |
Referenced by ui_device_sof_action().
#define MOUSE_MOVE_RANGE 3 |
#define MOVE_DOWN 2 |
Referenced by ui_device_sof_action().
#define MOVE_LEFT 3 |
Referenced by ui_device_sof_action().
#define MOVE_RIGHT 1 |
Referenced by ui_device_sof_action().
#define MOVE_UP 0 |
Referenced by ui_device_sof_action().
#define UI_WAKEUP_BPM_SRC BPM_BKUPWEN_EIC |
#define UI_WAKEUP_EIC_LINE GPIO_PUSH_BUTTON_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_5_IRQn |
Referenced by ui_enable_asynchronous_interrupt().
void ui_device_mouse_disable | ( | void | ) |
Disables the device mouse interface.
References ui_device_b_mouse_enable.
bool ui_device_mouse_enable | ( | void | ) |
Enables the device mouse interface.
References ui_device_b_mouse_enable.
void ui_device_remotewakeup_disable | ( | void | ) |
Disables the remotewakeup feature.
References ui_disable_asynchronous_interrupt().
void ui_device_remotewakeup_enable | ( | void | ) |
Enables the remotewakeup feature.
References ui_enable_asynchronous_interrupt().
void ui_device_resume_action | ( | void | ) |
Exits the user interface if the low power mode Callback called when USB host sets USB line in IDLE state.
void ui_device_sof_action | ( | void | ) |
Scans the device mouse controls and shows the device status each USB SOF.
References GPIO_PUSH_BUTTON_0, ioport_get_pin_level(), LED0, LED_Off, LED_On, MOUSE_MOVE_COUNT, MOUSE_MOVE_RANGE, MOVE_DOWN, MOVE_LEFT, MOVE_RIGHT, MOVE_UP, udd_get_frame_number(), udi_hid_mouse_moveX(), udi_hid_mouse_moveY(), and ui_device_b_mouse_enable.
void ui_device_suspend_action | ( | void | ) |
Enters the user interface in low power mode Callback called when USB host sets USB line in suspend state.
References ui_init().
|
static |
Disables interrupt pin change.
References eic_line_disable_interrupt(), sysclk_disable_peripheral_clock(), and UI_WAKEUP_EIC_LINE.
Referenced by ui_device_remotewakeup_disable(), ui_host_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_device_remotewakeup_enable(), and ui_host_sof_event().
void ui_host_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 bm_mouse_pointer_ctrl(), LED0, LED_On, ui_enum_status, and UNUSED.
void ui_host_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 bm_mouse_pointer_ctrl(), bm_x, bm_y, UHD_SPEED_FULL, UHD_SPEED_HIGH, UHD_SPEED_LOW, ui_device_speed_blink, and ui_enum_status.
|
static |
References ui_nb_down.
Referenced by ui_host_hid_mouse_btn_left(), ui_host_hid_mouse_btn_middle(), and ui_host_hid_mouse_btn_right().
void ui_host_hid_mouse_btn_left | ( | bool | b_state | ) |
References ui_host_hid_mouse_btn().
void ui_host_hid_mouse_btn_middle | ( | bool | b_state | ) |
References ui_host_hid_mouse_btn().
void ui_host_hid_mouse_btn_right | ( | bool | b_state | ) |
References ui_host_hid_mouse_btn().
void ui_host_hid_mouse_move | ( | int8_t | x, |
int8_t | y, | ||
int8_t | scroll | ||
) |
void ui_host_sof_event | ( | void | ) |
Notify that a SOF has been sent (each 1 ms)
References bm_mouse_pointer_move(), bm_x, bm_y, GPIO_PUSH_BUTTON_0, ioport_get_pin_level(), LED0, LED_Off, LED_On, LED_Toggle, uhc_suspend(), ui_device_speed_blink, ui_enable_asynchronous_interrupt(), ui_enum_status, and ui_nb_down.
void ui_host_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_host_vbus_error | ( | void | ) |
Notify that a Vbus error has occurred Available only in USB hardware with Vbus monitoring.
void ui_host_wakeup_event | ( | void | ) |
Notify that a USB device or the host has wake up the USB line.
References ui_disable_asynchronous_interrupt().
void ui_init | ( | void | ) |
Initializes the user interface.
References bm_init(), bm_mouse_pointer_ctrl(), LED0, and LED_Off.
Referenced by main(), and ui_device_suspend_action().
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.
b_host_mode | true, if the host mode has been selected |
References LED0, LED_Off, LED_On, and ui_b_host_mode.
|
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(), udc_remotewakeup(), uhc_is_suspend(), uhc_resume(), ui_b_host_mode, ui_disable_asynchronous_interrupt(), and UI_WAKEUP_EIC_LINE.
|
static |
Referenced by ui_host_enum_event(), ui_host_hid_mouse_move(), and ui_host_sof_event().
|
static |
Referenced by ui_host_enum_event(), ui_host_hid_mouse_move(), and ui_host_sof_event().
Current USB mode
Referenced by ui_usb_mode_change(), and UI_WAKEUP_HANDLER().
Referenced by ui_device_mouse_disable(), ui_device_mouse_enable(), and ui_device_sof_action().
|
static |
Referenced by ui_host_enum_event(), and ui_host_sof_event().
|
static |
Referenced by ui_host_connection_event(), ui_host_enum_event(), and ui_host_sof_event().
|
static |
Referenced by ui_host_hid_mouse_btn(), and ui_host_sof_event().