This file manages the USB device mouse HID task.
Definition in file device_mouse_hid_task.h.
#include "conf_usb.h"
Go to the source code of this file.
Functions | |
void | device_mouse_hid_task (void *pvParameters) |
Entry point of the device mouse HID task management. | |
void | device_mouse_hid_task_init (void) |
This function initializes the hardware/software resources required for device mouse HID task. | |
void | usb_sof_action (void) |
usb_sof_action |
void device_mouse_hid_task | ( | void * | pvParameters | ) |
Entry point of the device mouse HID task management.
Write report
Definition at line 353 of file device_mouse_hid_task.c.
References configTSK_USB_DHID_MOUSE_PERIOD, EP_HID_MOUSE_IN, is_usb_mouse_event(), u8_report_buttons, u8_report_disp_wheel, u8_report_disp_x, and u8_report_disp_y.
Referenced by device_mouse_hid_task_init(), and main().
00357 { 00358 #ifdef FREERTOS_USED 00359 portTickType xLastWakeTime; 00360 00361 xLastWakeTime = xTaskGetTickCount(); 00362 while (TRUE) 00363 { 00364 vTaskDelayUntil(&xLastWakeTime, configTSK_USB_DHID_MOUSE_PERIOD); 00365 00366 // First, check the device enumeration state 00367 if (!Is_device_enumerated()) continue; 00368 #else 00369 // First, check the device enumeration state 00370 if (!Is_device_enumerated()) return; 00371 #endif // FREERTOS_USED 00372 00373 if( is_usb_mouse_event() ) 00374 { 00375 if( Is_usb_in_ready(EP_HID_MOUSE_IN) ) 00376 { 00377 Usb_reset_endpoint_fifo_access(EP_HID_MOUSE_IN); 00378 00380 Usb_write_endpoint_data(EP_HID_MOUSE_IN, 8, u8_report_buttons); 00381 Usb_write_endpoint_data(EP_HID_MOUSE_IN, 8, u8_report_disp_x); 00382 Usb_write_endpoint_data(EP_HID_MOUSE_IN, 8, u8_report_disp_y); 00383 Usb_write_endpoint_data(EP_HID_MOUSE_IN, 8, u8_report_disp_wheel); 00384 00385 Usb_ack_in_ready_send(EP_HID_MOUSE_IN); 00386 } 00387 } 00388 #ifdef FREERTOS_USED 00389 } 00390 #endif 00391 }
void device_mouse_hid_task_init | ( | void | ) |
This function initializes the hardware/software resources required for device mouse HID task.
Definition at line 105 of file device_mouse_hid_task.c.
References configTSK_USB_DHID_MOUSE_NAME, configTSK_USB_DHID_MOUSE_PRIORITY, configTSK_USB_DHID_MOUSE_STACK_SIZE, device_mouse_hid_task(), and sof_cnt.
Referenced by main().
00106 { 00107 sof_cnt = 0; 00108 00109 #if BOARD == EVK1101 00110 // Initialize accelerometer driver 00111 acc_init(); 00112 #endif 00113 00114 #ifndef FREERTOS_USED 00115 #if USB_HOST_FEATURE == ENABLED 00116 // If both device and host features are enabled, check if device mode is engaged 00117 // (accessing the USB registers of a non-engaged mode, even with load operations, 00118 // may corrupt USB FIFO data). 00119 if (Is_usb_device()) 00120 #endif // USB_HOST_FEATURE == ENABLED 00121 Usb_enable_sof_interrupt(); 00122 #endif // FREERTOS_USED 00123 00124 #ifdef FREERTOS_USED 00125 xTaskCreate(device_mouse_hid_task, 00126 configTSK_USB_DHID_MOUSE_NAME, 00127 configTSK_USB_DHID_MOUSE_STACK_SIZE, 00128 NULL, 00129 configTSK_USB_DHID_MOUSE_PRIORITY, 00130 NULL); 00131 #endif // FREERTOS_USED 00132 }