This file manages the USB device HID task.
Definition in file device_hid_task.h.
#include "conf_usb.h"
Go to the source code of this file.
Functions | |
void | device_hid_task (void) |
Entry point of the device HID task management. | |
void | device_hid_task_init (void) |
This function initializes the hardware/software resources required for device HID task. |
void device_hid_task | ( | void | ) |
Entry point of the device HID task management.
Write report
Definition at line 224 of file device_hid_task.c.
References EP_KBD_IN, is_usb_hid_event(), and key.
Referenced by main().
00225 { 00226 // First, check the device enumeration state 00227 if (!Is_device_enumerated()) { 00228 return; 00229 } 00230 00231 if (Is_usb_in_ready(EP_KBD_IN)) { 00232 if (is_usb_hid_event()) { 00233 Usb_reset_endpoint_fifo_access(EP_KBD_IN); 00234 00236 Usb_write_endpoint_data(EP_KBD_IN, 8, key); 00237 Usb_ack_in_ready_send(EP_KBD_IN); 00238 } 00239 } 00240 }
void device_hid_task_init | ( | void | ) |
This function initializes the hardware/software resources required for device HID task.
Definition at line 206 of file device_hid_task.c.
References FCPU_HZ, key_timer, and TIMER_STARTUP.
Referenced by main().
00207 { 00208 cpu_set_timeout( cpu_ms_2_cy(TIMER_STARTUP, FCPU_HZ), &key_timer ); 00209 00210 #if USB_HOST_FEATURE == ENABLED 00211 // If both device and host features are enabled, check if device mode is engaged 00212 // (accessing the USB registers of a non-engaged mode, even with load operations, 00213 // may corrupt USB FIFO data). 00214 if (Is_usb_device()) 00215 #endif // USB_HOST_FEATURE == ENABLED 00216 Usb_enable_sof_interrupt(); 00217 }