User Interface.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
Macros | |
#define | RESUME_PIN (GPIO_PUSH_BUTTON_2) |
#define | RESUME_PIO (PIN_PUSHBUTTON_2_PIO) |
#define | RESUME_PIO_ATTR (PIN_PUSHBUTTON_2_ATTR) |
#define | RESUME_PIO_ID (PIN_PUSHBUTTON_2_ID) |
#define | RESUME_PIO_MASK (PIN_PUSHBUTTON_2_MASK) |
#define | RESUME_PMC_FSTT (PMC_FSMR_FSTT14) |
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 (uint32_t id, uint32_t mask) |
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... | |
Host mode user interface functions | |
static uhc_enum_status_t | ui_enum_status = UHC_ENUM_DISCONNECT |
static uint16_t | ui_device_speed_blink |
static int8_t | ui_x |
static int8_t | ui_y |
static int8_t | ui_scroll |
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_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_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) |
#define RESUME_PIN (GPIO_PUSH_BUTTON_2) |
Referenced by ui_disable_asynchronous_interrupt(), ui_enable_asynchronous_interrupt(), and ui_init().
#define RESUME_PIO (PIN_PUSHBUTTON_2_PIO) |
Referenced by ui_disable_asynchronous_interrupt(), ui_enable_asynchronous_interrupt(), and ui_init().
#define RESUME_PIO_ATTR (PIN_PUSHBUTTON_2_ATTR) |
Referenced by ui_init().
#define RESUME_PIO_ID (PIN_PUSHBUTTON_2_ID) |
Referenced by ui_init(), and ui_wakeup_handler().
#define RESUME_PIO_MASK (PIN_PUSHBUTTON_2_MASK) |
Referenced by ui_init(), and ui_wakeup_handler().
#define RESUME_PMC_FSTT (PMC_FSMR_FSTT14) |
Referenced by ui_disable_asynchronous_interrupt(), and ui_enable_asynchronous_interrupt().
|
static |
Disables interrupt pin change.
References pio_disable_pin_interrupt(), pio_get_interrupt_status(), pmc_clr_fast_startup_input(), RESUME_PIN, RESUME_PIO, and RESUME_PMC_FSTT.
Referenced by ui_usb_wakeup_event(), and ui_wakeup_handler().
|
static |
Initializes and enables interrupt pin change.
References pio_enable_pin_interrupt(), pio_get_interrupt_status(), pmc_set_fast_startup_input(), RESUME_PIN, RESUME_PIO, and RESUME_PMC_FSTT.
Referenced by ui_usb_sof_event().
void ui_init | ( | void | ) |
Initializes the user interface.
References LED0_GPIO, LED1_GPIO, LED2_GPIO, LED3_GPIO, LED_Off(), pio_configure_pin(), pio_handler_set(), pmc_enable_periph_clk(), RESUME_PIN, RESUME_PIO, RESUME_PIO_ATTR, RESUME_PIO_ID, RESUME_PIO_MASK, and ui_wakeup_handler().
Referenced by main(), and ui_usb_mode_change().
|
static |
References LED2_GPIO, LED_Off(), and LED_On().
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_move | ( | int8_t | x, |
int8_t | y, | ||
int8_t | scroll | ||
) |
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 LED1_GPIO, LED_Off(), LED_On(), UHC_ENUM_DISCONNECT, 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.
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_scroll, ui_x, and ui_y.
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 ui_init().
void ui_usb_sof_event | ( | void | ) |
Notify that a SOF has been sent (each 1 ms)
References gpio_pin_is_high, GPIO_PUSH_BUTTON_1, LED0_GPIO, LED1_GPIO, LED2_GPIO, LED_Off(), LED_On(), LED_Toggle, UHC_ENUM_SUCCESS, uhc_suspend(), ui_device_speed_blink, ui_enable_asynchronous_interrupt(), ui_enum_status, ui_scroll, ui_x, and ui_y.
void ui_usb_vbus_change | ( | bool | b_vbus_present | ) |
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 |
References pmc_wait_wakeup_clocks_restore(), RESUME_PIO_ID, RESUME_PIO_MASK, uhc_is_suspend(), uhc_resume(), and ui_disable_asynchronous_interrupt().
Referenced by ui_init().
|
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().
|
static |
Referenced by ui_uhi_hid_mouse_move(), ui_usb_enum_event(), and ui_usb_sof_event().
|
static |
Manages device mouse moving
Referenced by ui_uhi_hid_mouse_move(), ui_usb_enum_event(), and ui_usb_sof_event().
|
static |
Referenced by ui_uhi_hid_mouse_move(), ui_usb_enum_event(), and ui_usb_sof_event().