From b624f32f944acdc59dcb130674c09090c5c404cb Mon Sep 17 00:00:00 2001 From: skullY Date: Fri, 30 Aug 2019 11:19:03 -0700 Subject: clang-format changes --- tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c | 789 ++++++++++---------------- 1 file changed, 315 insertions(+), 474 deletions(-) (limited to 'tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c') diff --git a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c index b715b70265..c3952d50c8 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c +++ b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c @@ -61,15 +61,15 @@ //*************************************************************************** #ifdef KBD -bool udi_hid_kbd_enable(void); -void udi_hid_kbd_disable(void); -bool udi_hid_kbd_setup(void); +bool udi_hid_kbd_enable(void); +void udi_hid_kbd_disable(void); +bool udi_hid_kbd_setup(void); uint8_t udi_hid_kbd_getsetting(void); UDC_DESC_STORAGE udi_api_t udi_api_hid_kbd = { - .enable = (bool(*)(void))udi_hid_kbd_enable, - .disable = (void (*)(void))udi_hid_kbd_disable, - .setup = (bool(*)(void))udi_hid_kbd_setup, + .enable = (bool (*)(void))udi_hid_kbd_enable, + .disable = (void (*)(void))udi_hid_kbd_disable, + .setup = (bool (*)(void))udi_hid_kbd_setup, .getsetting = (uint8_t(*)(void))udi_hid_kbd_getsetting, .sof_notify = NULL, }; @@ -94,40 +94,38 @@ COMPILER_WORD_ALIGNED static uint8_t udi_hid_kbd_report_trans[UDI_HID_KBD_REPORT_SIZE]; COMPILER_WORD_ALIGNED -UDC_DESC_STORAGE udi_hid_kbd_report_desc_t udi_hid_kbd_report_desc = { - { - 0x05, 0x01, // Usage Page (Generic Desktop) - 0x09, 0x06, // Usage (Keyboard) - 0xA1, 0x01, // Collection (Application) - 0x05, 0x07, // Usage Page (Keyboard) - 0x19, 0xE0, // Usage Minimum (224) - 0x29, 0xE7, // Usage Maximum (231) - 0x15, 0x00, // Logical Minimum (0) - 0x25, 0x01, // Logical Maximum (1) - 0x75, 0x01, // Report Size (1) - 0x95, 0x08, // Report Count (8) - 0x81, 0x02, // Input (Data, Variable, Absolute) - 0x81, 0x01, // Input (Constant) - 0x19, 0x00, // Usage Minimum (0) - 0x29, 0xFF, // Usage Maximum (255) - 0x15, 0x00, // Logical Minimum (0) - 0x25, 0xFF, // Logical Maximum (255) - 0x75, 0x08, // Report Size (8) - 0x95, 0x06, // Report Count (6) - 0x81, 0x00, // Input (Data, Array) - 0x05, 0x08, // Usage Page (LED) - 0x19, 0x01, // Usage Minimum (1) - 0x29, 0x05, // Usage Maximum (5) - 0x15, 0x00, // Logical Minimum (0) - 0x25, 0x01, // Logical Maximum (1) - 0x75, 0x01, // Report Size (1) - 0x95, 0x05, // Report Count (5) - 0x91, 0x02, // Output (Data, Variable, Absolute) - 0x95, 0x03, // Report Count (3) - 0x91, 0x01, // Output (Constant) - 0xC0 // End Collection - } -}; +UDC_DESC_STORAGE udi_hid_kbd_report_desc_t udi_hid_kbd_report_desc = {{ + 0x05, 0x01, // Usage Page (Generic Desktop) + 0x09, 0x06, // Usage (Keyboard) + 0xA1, 0x01, // Collection (Application) + 0x05, 0x07, // Usage Page (Keyboard) + 0x19, 0xE0, // Usage Minimum (224) + 0x29, 0xE7, // Usage Maximum (231) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x75, 0x01, // Report Size (1) + 0x95, 0x08, // Report Count (8) + 0x81, 0x02, // Input (Data, Variable, Absolute) + 0x81, 0x01, // Input (Constant) + 0x19, 0x00, // Usage Minimum (0) + 0x29, 0xFF, // Usage Maximum (255) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0xFF, // Logical Maximum (255) + 0x75, 0x08, // Report Size (8) + 0x95, 0x06, // Report Count (6) + 0x81, 0x00, // Input (Data, Array) + 0x05, 0x08, // Usage Page (LED) + 0x19, 0x01, // Usage Minimum (1) + 0x29, 0x05, // Usage Maximum (5) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x75, 0x01, // Report Size (1) + 0x95, 0x05, // Report Count (5) + 0x91, 0x02, // Output (Data, Variable, Absolute) + 0x95, 0x03, // Report Count (3) + 0x91, 0x01, // Output (Constant) + 0xC0 // End Collection +}}; static bool udi_hid_kbd_setreport(void); @@ -135,51 +133,34 @@ static void udi_hid_kbd_report_sent(udd_ep_status_t status, iram_size_t nb_sent, static void udi_hid_kbd_setreport_valid(void); -bool udi_hid_kbd_enable(void) -{ +bool udi_hid_kbd_enable(void) { // Initialize internal values - udi_hid_kbd_rate = 0; - udi_hid_kbd_protocol = 0; + udi_hid_kbd_rate = 0; + udi_hid_kbd_protocol = 0; udi_hid_kbd_b_report_trans_ongoing = false; memset(udi_hid_kbd_report, 0, UDI_HID_KBD_REPORT_SIZE); udi_hid_kbd_b_report_valid = false; return UDI_HID_KBD_ENABLE_EXT(); } -void udi_hid_kbd_disable(void) -{ - UDI_HID_KBD_DISABLE_EXT(); -} +void udi_hid_kbd_disable(void) { UDI_HID_KBD_DISABLE_EXT(); } -bool udi_hid_kbd_setup(void) -{ - return udi_hid_setup(&udi_hid_kbd_rate, - &udi_hid_kbd_protocol, - (uint8_t *) &udi_hid_kbd_report_desc, - udi_hid_kbd_setreport); -} +bool udi_hid_kbd_setup(void) { return udi_hid_setup(&udi_hid_kbd_rate, &udi_hid_kbd_protocol, (uint8_t *)&udi_hid_kbd_report_desc, udi_hid_kbd_setreport); } -uint8_t udi_hid_kbd_getsetting(void) -{ - return 0; -} +uint8_t udi_hid_kbd_getsetting(void) { return 0; } -static bool udi_hid_kbd_setreport(void) -{ - if ((USB_HID_REPORT_TYPE_OUTPUT == (udd_g_ctrlreq.req.wValue >> 8)) - && (0 == (0xFF & udd_g_ctrlreq.req.wValue)) - && (1 == udd_g_ctrlreq.req.wLength)) { +static bool udi_hid_kbd_setreport(void) { + if ((USB_HID_REPORT_TYPE_OUTPUT == (udd_g_ctrlreq.req.wValue >> 8)) && (0 == (0xFF & udd_g_ctrlreq.req.wValue)) && (1 == udd_g_ctrlreq.req.wLength)) { // Report OUT type on report ID 0 from USB Host - udd_g_ctrlreq.payload = &udi_hid_kbd_report_set; - udd_g_ctrlreq.callback = udi_hid_kbd_setreport_valid; + udd_g_ctrlreq.payload = &udi_hid_kbd_report_set; + udd_g_ctrlreq.callback = udi_hid_kbd_setreport_valid; udd_g_ctrlreq.payload_size = 1; return true; } return false; } -bool udi_hid_kbd_send_report(void) -{ +bool udi_hid_kbd_send_report(void) { if (!main_b_kbd_enable) { return false; } @@ -189,19 +170,13 @@ bool udi_hid_kbd_send_report(void) } memcpy(udi_hid_kbd_report_trans, udi_hid_kbd_report, UDI_HID_KBD_REPORT_SIZE); - udi_hid_kbd_b_report_valid = false; - udi_hid_kbd_b_report_trans_ongoing = - udd_ep_run(UDI_HID_KBD_EP_IN | USB_EP_DIR_IN, - false, - udi_hid_kbd_report_trans, - UDI_HID_KBD_REPORT_SIZE, - udi_hid_kbd_report_sent); + udi_hid_kbd_b_report_valid = false; + udi_hid_kbd_b_report_trans_ongoing = udd_ep_run(UDI_HID_KBD_EP_IN | USB_EP_DIR_IN, false, udi_hid_kbd_report_trans, UDI_HID_KBD_REPORT_SIZE, udi_hid_kbd_report_sent); return udi_hid_kbd_b_report_trans_ongoing; } -static void udi_hid_kbd_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep) -{ +static void udi_hid_kbd_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep) { UNUSED(status); UNUSED(nb_sent); UNUSED(ep); @@ -211,27 +186,26 @@ static void udi_hid_kbd_report_sent(udd_ep_status_t status, iram_size_t nb_sent, } } -static void udi_hid_kbd_setreport_valid(void) -{ - //UDI_HID_KBD_CHANGE_LED(udi_hid_kbd_report_set); +static void udi_hid_kbd_setreport_valid(void) { + // UDI_HID_KBD_CHANGE_LED(udi_hid_kbd_report_set); } -#endif //KBD +#endif // KBD //******************************************************************************************** // NKRO Keyboard //******************************************************************************************** #ifdef NKRO -bool udi_hid_nkro_enable(void); -void udi_hid_nkro_disable(void); -bool udi_hid_nkro_setup(void); +bool udi_hid_nkro_enable(void); +void udi_hid_nkro_disable(void); +bool udi_hid_nkro_setup(void); uint8_t udi_hid_nkro_getsetting(void); UDC_DESC_STORAGE udi_api_t udi_api_hid_nkro = { - .enable = (bool(*)(void))udi_hid_nkro_enable, - .disable = (void (*)(void))udi_hid_nkro_disable, - .setup = (bool(*)(void))udi_hid_nkro_setup, + .enable = (bool (*)(void))udi_hid_nkro_enable, + .disable = (void (*)(void))udi_hid_nkro_disable, + .setup = (bool (*)(void))udi_hid_nkro_setup, .getsetting = (uint8_t(*)(void))udi_hid_nkro_getsetting, .sof_notify = NULL, }; @@ -256,98 +230,79 @@ COMPILER_WORD_ALIGNED static uint8_t udi_hid_nkro_report_trans[UDI_HID_NKRO_REPORT_SIZE]; COMPILER_WORD_ALIGNED -UDC_DESC_STORAGE udi_hid_nkro_report_desc_t udi_hid_nkro_report_desc = { - { - 0x05, 0x01, // Usage Page (Generic Desktop), - 0x09, 0x06, // Usage (Keyboard), - 0xA1, 0x01, // Collection (Application) - Keyboard, - - //Mods - 0x75, 0x01, // Report Size (1), - 0x95, 0x08, // Report Count (8), - 0x15, 0x00, // Logical Minimum (0), - 0x25, 0x01, // Logical Maximum (1), - 0x05, 0x07, // Usage Page (Key Codes), - 0x19, 0xE0, // Usage Minimum (224), - 0x29, 0xE7, // Usage Maximum (231), - 0x81, 0x02, // Input (Data, Variable, Absolute), - - //LED Report - 0x75, 0x01, // Report Size (1), - 0x95, 0x05, // Report Count (5), - 0x05, 0x08, // Usage Page (LEDs), - 0x19, 0x01, // Usage Minimum (1), - 0x29, 0x05, // Usage Maximum (5), - 0x91, 0x02, // Output (Data, Variable, Absolute), - - //LED Report Padding - 0x75, 0x03, // Report Size (3), - 0x95, 0x01, // Report Count (1), - 0x91, 0x03, // Output (Constant), - - //Main keys - 0x75, 0x01, // Report Size (1), - 0x95, 0xF8, // Report Count (248), - 0x15, 0x00, // Logical Minimum (0), - 0x25, 0x01, // Logical Maximum (1), - 0x05, 0x07, // Usage Page (Key Codes), - 0x19, 0x00, // Usage Minimum (0), - 0x29, 0xF7, // Usage Maximum (247), - 0x81, 0x02, // Input (Data, Variable, Absolute, Bitfield), - 0xc0, // End Collection - Keyboard - } -}; +UDC_DESC_STORAGE udi_hid_nkro_report_desc_t udi_hid_nkro_report_desc = {{ + 0x05, 0x01, // Usage Page (Generic Desktop), + 0x09, 0x06, // Usage (Keyboard), + 0xA1, 0x01, // Collection (Application) - Keyboard, + + // Mods + 0x75, 0x01, // Report Size (1), + 0x95, 0x08, // Report Count (8), + 0x15, 0x00, // Logical Minimum (0), + 0x25, 0x01, // Logical Maximum (1), + 0x05, 0x07, // Usage Page (Key Codes), + 0x19, 0xE0, // Usage Minimum (224), + 0x29, 0xE7, // Usage Maximum (231), + 0x81, 0x02, // Input (Data, Variable, Absolute), + + // LED Report + 0x75, 0x01, // Report Size (1), + 0x95, 0x05, // Report Count (5), + 0x05, 0x08, // Usage Page (LEDs), + 0x19, 0x01, // Usage Minimum (1), + 0x29, 0x05, // Usage Maximum (5), + 0x91, 0x02, // Output (Data, Variable, Absolute), + + // LED Report Padding + 0x75, 0x03, // Report Size (3), + 0x95, 0x01, // Report Count (1), + 0x91, 0x03, // Output (Constant), + + // Main keys + 0x75, 0x01, // Report Size (1), + 0x95, 0xF8, // Report Count (248), + 0x15, 0x00, // Logical Minimum (0), + 0x25, 0x01, // Logical Maximum (1), + 0x05, 0x07, // Usage Page (Key Codes), + 0x19, 0x00, // Usage Minimum (0), + 0x29, 0xF7, // Usage Maximum (247), + 0x81, 0x02, // Input (Data, Variable, Absolute, Bitfield), + 0xc0, // End Collection - Keyboard +}}; static bool udi_hid_nkro_setreport(void); static void udi_hid_nkro_setreport_valid(void); static void udi_hid_nkro_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep); -bool udi_hid_nkro_enable(void) -{ +bool udi_hid_nkro_enable(void) { // Initialize internal values - udi_hid_nkro_rate = 0; - udi_hid_nkro_protocol = 0; + udi_hid_nkro_rate = 0; + udi_hid_nkro_protocol = 0; udi_hid_nkro_b_report_trans_ongoing = false; memset(udi_hid_nkro_report, 0, UDI_HID_NKRO_REPORT_SIZE); udi_hid_nkro_b_report_valid = false; return UDI_HID_NKRO_ENABLE_EXT(); } -void udi_hid_nkro_disable(void) -{ - UDI_HID_NKRO_DISABLE_EXT(); -} +void udi_hid_nkro_disable(void) { UDI_HID_NKRO_DISABLE_EXT(); } -bool udi_hid_nkro_setup(void) -{ - return udi_hid_setup(&udi_hid_nkro_rate, - &udi_hid_nkro_protocol, - (uint8_t *) &udi_hid_nkro_report_desc, - udi_hid_nkro_setreport); -} +bool udi_hid_nkro_setup(void) { return udi_hid_setup(&udi_hid_nkro_rate, &udi_hid_nkro_protocol, (uint8_t *)&udi_hid_nkro_report_desc, udi_hid_nkro_setreport); } -uint8_t udi_hid_nkro_getsetting(void) -{ - return 0; -} +uint8_t udi_hid_nkro_getsetting(void) { return 0; } -//keyboard receives LED report here -static bool udi_hid_nkro_setreport(void) -{ - if ((USB_HID_REPORT_TYPE_OUTPUT == (udd_g_ctrlreq.req.wValue >> 8)) - && (0 == (0xFF & udd_g_ctrlreq.req.wValue)) - && (1 == udd_g_ctrlreq.req.wLength)) { +// keyboard receives LED report here +static bool udi_hid_nkro_setreport(void) { + if ((USB_HID_REPORT_TYPE_OUTPUT == (udd_g_ctrlreq.req.wValue >> 8)) && (0 == (0xFF & udd_g_ctrlreq.req.wValue)) && (1 == udd_g_ctrlreq.req.wLength)) { // Report OUT type on report ID 0 from USB Host - udd_g_ctrlreq.payload = &udi_hid_nkro_report_set; - udd_g_ctrlreq.callback = udi_hid_nkro_setreport_valid; //must call routine to transform setreport to LED state + udd_g_ctrlreq.payload = &udi_hid_nkro_report_set; + udd_g_ctrlreq.callback = udi_hid_nkro_setreport_valid; // must call routine to transform setreport to LED state udd_g_ctrlreq.payload_size = 1; return true; } return false; } -bool udi_hid_nkro_send_report(void) -{ +bool udi_hid_nkro_send_report(void) { if (!main_b_nkro_enable) { return false; } @@ -357,19 +312,13 @@ bool udi_hid_nkro_send_report(void) } memcpy(udi_hid_nkro_report_trans, udi_hid_nkro_report, UDI_HID_NKRO_REPORT_SIZE); - udi_hid_nkro_b_report_valid = false; - udi_hid_nkro_b_report_trans_ongoing = - udd_ep_run(UDI_HID_NKRO_EP_IN | USB_EP_DIR_IN, - false, - udi_hid_nkro_report_trans, - UDI_HID_NKRO_REPORT_SIZE, - udi_hid_nkro_report_sent); + udi_hid_nkro_b_report_valid = false; + udi_hid_nkro_b_report_trans_ongoing = udd_ep_run(UDI_HID_NKRO_EP_IN | USB_EP_DIR_IN, false, udi_hid_nkro_report_trans, UDI_HID_NKRO_REPORT_SIZE, udi_hid_nkro_report_sent); return udi_hid_nkro_b_report_trans_ongoing; } -static void udi_hid_nkro_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep) -{ +static void udi_hid_nkro_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep) { UNUSED(status); UNUSED(nb_sent); UNUSED(ep); @@ -379,27 +328,26 @@ static void udi_hid_nkro_report_sent(udd_ep_status_t status, iram_size_t nb_sent } } -static void udi_hid_nkro_setreport_valid(void) -{ - //UDI_HID_NKRO_CHANGE_LED(udi_hid_nkro_report_set); +static void udi_hid_nkro_setreport_valid(void) { + // UDI_HID_NKRO_CHANGE_LED(udi_hid_nkro_report_set); } -#endif //NKRO +#endif // NKRO //******************************************************************************************** // EXK (extra-keys) SYS-CTRL Keyboard //******************************************************************************************** #ifdef EXK -bool udi_hid_exk_enable(void); -void udi_hid_exk_disable(void); -bool udi_hid_exk_setup(void); +bool udi_hid_exk_enable(void); +void udi_hid_exk_disable(void); +bool udi_hid_exk_setup(void); uint8_t udi_hid_exk_getsetting(void); UDC_DESC_STORAGE udi_api_t udi_api_hid_exk = { - .enable = (bool(*)(void))udi_hid_exk_enable, - .disable = (void (*)(void))udi_hid_exk_disable, - .setup = (bool(*)(void))udi_hid_exk_setup, + .enable = (bool (*)(void))udi_hid_exk_enable, + .disable = (void (*)(void))udi_hid_exk_disable, + .setup = (bool (*)(void))udi_hid_exk_setup, .getsetting = (uint8_t(*)(void))udi_hid_exk_getsetting, .sof_notify = NULL, }; @@ -424,39 +372,37 @@ COMPILER_WORD_ALIGNED static uint8_t udi_hid_exk_report_trans[UDI_HID_EXK_REPORT_SIZE]; COMPILER_WORD_ALIGNED -UDC_DESC_STORAGE udi_hid_exk_report_desc_t udi_hid_exk_report_desc = { - { - // System Control Collection (8 bits) - - 0x05, 0x01, // Usage Page (Generic Desktop), - 0x09, 0x80, // Usage (System Control), - 0xA1, 0x01, // Collection (Application), - 0x85, REPORT_ID_SYSTEM, // Report ID (2) (System), - 0x16, 0x01, 0x00, // Logical Minimum (1), - 0x26, 0x03, 0x00, // Logical Maximum (3), - 0x1A, 0x81, 0x00, // Usage Minimum (81) (System Power Down), - 0x2A, 0x83, 0x00, // Usage Maximum (83) (System Wake Up), - 0x75, 0x10, // Report Size (16), - 0x95, 0x01, // Report Count (1), - 0x81, 0x00, // Input (Data, Array), - 0xC0, // End Collection - System Control - - // Consumer Control Collection - Media Keys (16 bits) - - 0x05, 0x0C, // Usage Page (Consumer), - 0x09, 0x01, // Usage (Consumer Control), - 0xA1, 0x01, // Collection (Application), - 0x85, REPORT_ID_CONSUMER, // Report ID (3) (Consumer), - 0x16, 0x01, 0x00, // Logical Minimum (1), - 0x26, 0x9C, 0x02, // Logical Maximum (668), - 0x1A, 0x01, 0x00, // Usage Minimum (1), - 0x2A, 0x9C, 0x02, // Usage Maximum (668), - 0x75, 0x10, // Report Size (16), - 0x95, 0x01, // Report Count (1), - 0x81, 0x00, // Input (Data, Array), - 0xC0, // End Collection - Consumer Control - } -}; +UDC_DESC_STORAGE udi_hid_exk_report_desc_t udi_hid_exk_report_desc = {{ + // System Control Collection (8 bits) + + 0x05, 0x01, // Usage Page (Generic Desktop), + 0x09, 0x80, // Usage (System Control), + 0xA1, 0x01, // Collection (Application), + 0x85, REPORT_ID_SYSTEM, // Report ID (2) (System), + 0x16, 0x01, 0x00, // Logical Minimum (1), + 0x26, 0x03, 0x00, // Logical Maximum (3), + 0x1A, 0x81, 0x00, // Usage Minimum (81) (System Power Down), + 0x2A, 0x83, 0x00, // Usage Maximum (83) (System Wake Up), + 0x75, 0x10, // Report Size (16), + 0x95, 0x01, // Report Count (1), + 0x81, 0x00, // Input (Data, Array), + 0xC0, // End Collection - System Control + + // Consumer Control Collection - Media Keys (16 bits) + + 0x05, 0x0C, // Usage Page (Consumer), + 0x09, 0x01, // Usage (Consumer Control), + 0xA1, 0x01, // Collection (Application), + 0x85, REPORT_ID_CONSUMER, // Report ID (3) (Consumer), + 0x16, 0x01, 0x00, // Logical Minimum (1), + 0x26, 0x9C, 0x02, // Logical Maximum (668), + 0x1A, 0x01, 0x00, // Usage Minimum (1), + 0x2A, 0x9C, 0x02, // Usage Maximum (668), + 0x75, 0x10, // Report Size (16), + 0x95, 0x01, // Report Count (1), + 0x81, 0x00, // Input (Data, Array), + 0xC0, // End Collection - Consumer Control +}}; static bool udi_hid_exk_setreport(void); @@ -464,51 +410,34 @@ static void udi_hid_exk_report_sent(udd_ep_status_t status, iram_size_t nb_sent, static void udi_hid_exk_setreport_valid(void); -bool udi_hid_exk_enable(void) -{ +bool udi_hid_exk_enable(void) { // Initialize internal values - udi_hid_exk_rate = 0; - udi_hid_exk_protocol = 0; + udi_hid_exk_rate = 0; + udi_hid_exk_protocol = 0; udi_hid_exk_b_report_trans_ongoing = false; memset(udi_hid_exk_report.raw, 0, UDI_HID_EXK_REPORT_SIZE); udi_hid_exk_b_report_valid = false; return UDI_HID_EXK_ENABLE_EXT(); } -void udi_hid_exk_disable(void) -{ - UDI_HID_EXK_DISABLE_EXT(); -} +void udi_hid_exk_disable(void) { UDI_HID_EXK_DISABLE_EXT(); } -bool udi_hid_exk_setup(void) -{ - return udi_hid_setup(&udi_hid_exk_rate, - &udi_hid_exk_protocol, - (uint8_t *) &udi_hid_exk_report_desc, - udi_hid_exk_setreport); -} +bool udi_hid_exk_setup(void) { return udi_hid_setup(&udi_hid_exk_rate, &udi_hid_exk_protocol, (uint8_t *)&udi_hid_exk_report_desc, udi_hid_exk_setreport); } -uint8_t udi_hid_exk_getsetting(void) -{ - return 0; -} +uint8_t udi_hid_exk_getsetting(void) { return 0; } -static bool udi_hid_exk_setreport(void) -{ - if ((USB_HID_REPORT_TYPE_OUTPUT == (udd_g_ctrlreq.req.wValue >> 8)) - && (0 == (0xFF & udd_g_ctrlreq.req.wValue)) - && (1 == udd_g_ctrlreq.req.wLength)) { +static bool udi_hid_exk_setreport(void) { + if ((USB_HID_REPORT_TYPE_OUTPUT == (udd_g_ctrlreq.req.wValue >> 8)) && (0 == (0xFF & udd_g_ctrlreq.req.wValue)) && (1 == udd_g_ctrlreq.req.wLength)) { // Report OUT type on report ID 0 from USB Host - udd_g_ctrlreq.payload = &udi_hid_exk_report_set; - udd_g_ctrlreq.callback = udi_hid_exk_setreport_valid; + udd_g_ctrlreq.payload = &udi_hid_exk_report_set; + udd_g_ctrlreq.callback = udi_hid_exk_setreport_valid; udd_g_ctrlreq.payload_size = 1; return true; } return false; } -bool udi_hid_exk_send_report(void) -{ +bool udi_hid_exk_send_report(void) { if (!main_b_exk_enable) { return false; } @@ -518,19 +447,13 @@ bool udi_hid_exk_send_report(void) } memcpy(udi_hid_exk_report_trans, udi_hid_exk_report.raw, UDI_HID_EXK_REPORT_SIZE); - udi_hid_exk_b_report_valid = false; - udi_hid_exk_b_report_trans_ongoing = - udd_ep_run(UDI_HID_EXK_EP_IN | USB_EP_DIR_IN, - false, - udi_hid_exk_report_trans, - UDI_HID_EXK_REPORT_SIZE, - udi_hid_exk_report_sent); + udi_hid_exk_b_report_valid = false; + udi_hid_exk_b_report_trans_ongoing = udd_ep_run(UDI_HID_EXK_EP_IN | USB_EP_DIR_IN, false, udi_hid_exk_report_trans, UDI_HID_EXK_REPORT_SIZE, udi_hid_exk_report_sent); return udi_hid_exk_b_report_trans_ongoing; } -static void udi_hid_exk_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep) -{ +static void udi_hid_exk_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep) { UNUSED(status); UNUSED(nb_sent); UNUSED(ep); @@ -540,27 +463,24 @@ static void udi_hid_exk_report_sent(udd_ep_status_t status, iram_size_t nb_sent, } } -static void udi_hid_exk_setreport_valid(void) -{ +static void udi_hid_exk_setreport_valid(void) {} -} - -#endif //EXK +#endif // EXK //******************************************************************************************** // MOU Mouse //******************************************************************************************** #ifdef MOU -bool udi_hid_mou_enable(void); -void udi_hid_mou_disable(void); -bool udi_hid_mou_setup(void); +bool udi_hid_mou_enable(void); +void udi_hid_mou_disable(void); +bool udi_hid_mou_setup(void); uint8_t udi_hid_mou_getsetting(void); UDC_DESC_STORAGE udi_api_t udi_api_hid_mou = { - .enable = (bool(*)(void))udi_hid_mou_enable, - .disable = (void (*)(void))udi_hid_mou_disable, - .setup = (bool(*)(void))udi_hid_mou_setup, + .enable = (bool (*)(void))udi_hid_mou_enable, + .disable = (void (*)(void))udi_hid_mou_disable, + .setup = (bool (*)(void))udi_hid_mou_setup, .getsetting = (uint8_t(*)(void))udi_hid_mou_getsetting, .sof_notify = NULL, }; @@ -571,8 +491,8 @@ static uint8_t udi_hid_mou_rate; COMPILER_WORD_ALIGNED static uint8_t udi_hid_mou_protocol; -//COMPILER_WORD_ALIGNED -//uint8_t udi_hid_mou_report_set; //No set report +// COMPILER_WORD_ALIGNED +// uint8_t udi_hid_mou_report_set; //No set report bool udi_hid_mou_b_report_valid; @@ -585,87 +505,71 @@ COMPILER_WORD_ALIGNED static uint8_t udi_hid_mou_report_trans[UDI_HID_MOU_REPORT_SIZE]; COMPILER_WORD_ALIGNED -UDC_DESC_STORAGE udi_hid_mou_report_desc_t udi_hid_mou_report_desc = { - { - 0x05, 0x01, // Usage Page (Generic Desktop), - 0x09, 0x02, // Usage (Mouse), - 0xA1, 0x01, // Collection (Application), - 0x09, 0x01, // Usage (Pointer), - 0xA1, 0x00, // Collection (Physical), - 0x05, 0x09, // Usage Page (Buttons), - 0x19, 0x01, // Usage Minimum (01), - 0x29, 0x05, // Usage Maximun (05), - 0x15, 0x00, // Logical Minimum (0), - 0x25, 0x01, // Logical Maximum (1), - 0x95, 0x05, // Report Count (5), - 0x75, 0x01, // Report Size (1), - 0x81, 0x02, // Input (Data, Variable, Absolute), ;5 button bits - 0x95, 0x01, // Report Count (1), - 0x75, 0x03, // Report Size (3), - 0x81, 0x01, // Input (Constant), ;3 bit padding, - - 0x05, 0x01, // Usage Page (Generic Desktop), - 0x09, 0x30, // Usage (X), - 0x09, 0x31, // Usage (Y), - 0x15, 0x81, // Logical Minimum (-127), - 0x25, 0x7F, // Logical Maximum (127), - 0x95, 0x02, // Report Count (2), - 0x75, 0x08, // Report Size (8), - 0x81, 0x06, // Input (Data, Variable, Relative), ;2 position bytes (X & Y), - - 0x09, 0x38, // Usage (Wheel), - 0x15, 0x81, // Logical Minimum (-127), - 0x25, 0x7F, // Logical Maximum (127), - 0x95, 0x01, // Report Count (1), - 0x75, 0x08, // Report Size (8), - 0x81, 0x06, // Input (Data, Variable, Relative), - - 0x05, 0x0C, // Usage Page (Consumer), - 0x0A, 0x38, 0x02, // Usage (AC Pan (Horizontal wheel)), - 0x15, 0x81, // Logical Minimum (-127), - 0x25, 0x7F, // Logical Maximum (127), - 0x95, 0x01, // Report Count (1), - 0x75, 0x08, // Report Size (8), - 0x81, 0x06, // Input (Data, Variable, Relative), - - 0xC0, // End Collection, - 0xC0, // End Collection - } -}; +UDC_DESC_STORAGE udi_hid_mou_report_desc_t udi_hid_mou_report_desc = {{ + 0x05, 0x01, // Usage Page (Generic Desktop), + 0x09, 0x02, // Usage (Mouse), + 0xA1, 0x01, // Collection (Application), + 0x09, 0x01, // Usage (Pointer), + 0xA1, 0x00, // Collection (Physical), + 0x05, 0x09, // Usage Page (Buttons), + 0x19, 0x01, // Usage Minimum (01), + 0x29, 0x05, // Usage Maximun (05), + 0x15, 0x00, // Logical Minimum (0), + 0x25, 0x01, // Logical Maximum (1), + 0x95, 0x05, // Report Count (5), + 0x75, 0x01, // Report Size (1), + 0x81, 0x02, // Input (Data, Variable, Absolute), ;5 button bits + 0x95, 0x01, // Report Count (1), + 0x75, 0x03, // Report Size (3), + 0x81, 0x01, // Input (Constant), ;3 bit padding, + + 0x05, 0x01, // Usage Page (Generic Desktop), + 0x09, 0x30, // Usage (X), + 0x09, 0x31, // Usage (Y), + 0x15, 0x81, // Logical Minimum (-127), + 0x25, 0x7F, // Logical Maximum (127), + 0x95, 0x02, // Report Count (2), + 0x75, 0x08, // Report Size (8), + 0x81, 0x06, // Input (Data, Variable, Relative), ;2 position bytes (X & Y), + + 0x09, 0x38, // Usage (Wheel), + 0x15, 0x81, // Logical Minimum (-127), + 0x25, 0x7F, // Logical Maximum (127), + 0x95, 0x01, // Report Count (1), + 0x75, 0x08, // Report Size (8), + 0x81, 0x06, // Input (Data, Variable, Relative), + + 0x05, 0x0C, // Usage Page (Consumer), + 0x0A, 0x38, 0x02, // Usage (AC Pan (Horizontal wheel)), + 0x15, 0x81, // Logical Minimum (-127), + 0x25, 0x7F, // Logical Maximum (127), + 0x95, 0x01, // Report Count (1), + 0x75, 0x08, // Report Size (8), + 0x81, 0x06, // Input (Data, Variable, Relative), + + 0xC0, // End Collection, + 0xC0, // End Collection +}}; static void udi_hid_mou_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep); -bool udi_hid_mou_enable(void) -{ +bool udi_hid_mou_enable(void) { // Initialize internal values - udi_hid_mou_rate = 0; - udi_hid_mou_protocol = 0; + udi_hid_mou_rate = 0; + udi_hid_mou_protocol = 0; udi_hid_mou_b_report_trans_ongoing = false; memset(udi_hid_mou_report, 0, UDI_HID_MOU_REPORT_SIZE); udi_hid_mou_b_report_valid = false; return UDI_HID_MOU_ENABLE_EXT(); } -void udi_hid_mou_disable(void) -{ - UDI_HID_MOU_DISABLE_EXT(); -} +void udi_hid_mou_disable(void) { UDI_HID_MOU_DISABLE_EXT(); } -bool udi_hid_mou_setup(void) -{ - return udi_hid_setup(&udi_hid_mou_rate, - &udi_hid_mou_protocol, - (uint8_t *) &udi_hid_mou_report_desc, - NULL); -} +bool udi_hid_mou_setup(void) { return udi_hid_setup(&udi_hid_mou_rate, &udi_hid_mou_protocol, (uint8_t *)&udi_hid_mou_report_desc, NULL); } -uint8_t udi_hid_mou_getsetting(void) -{ - return 0; -} +uint8_t udi_hid_mou_getsetting(void) { return 0; } -bool udi_hid_mou_send_report(void) -{ +bool udi_hid_mou_send_report(void) { if (!main_b_mou_enable) { return false; } @@ -675,19 +579,13 @@ bool udi_hid_mou_send_report(void) } memcpy(udi_hid_mou_report_trans, udi_hid_mou_report, UDI_HID_MOU_REPORT_SIZE); - udi_hid_mou_b_report_valid = false; - udi_hid_mou_b_report_trans_ongoing = - udd_ep_run(UDI_HID_MOU_EP_IN | USB_EP_DIR_IN, - false, - udi_hid_mou_report_trans, - UDI_HID_MOU_REPORT_SIZE, - udi_hid_mou_report_sent); + udi_hid_mou_b_report_valid = false; + udi_hid_mou_b_report_trans_ongoing = udd_ep_run(UDI_HID_MOU_EP_IN | USB_EP_DIR_IN, false, udi_hid_mou_report_trans, UDI_HID_MOU_REPORT_SIZE, udi_hid_mou_report_sent); return udi_hid_mou_b_report_trans_ongoing; } -static void udi_hid_mou_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep) -{ +static void udi_hid_mou_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep) { UNUSED(status); UNUSED(nb_sent); UNUSED(ep); @@ -697,22 +595,22 @@ static void udi_hid_mou_report_sent(udd_ep_status_t status, iram_size_t nb_sent, } } -#endif //MOU +#endif // MOU //******************************************************************************************** // RAW //******************************************************************************************** #ifdef RAW -bool udi_hid_raw_enable(void); -void udi_hid_raw_disable(void); -bool udi_hid_raw_setup(void); +bool udi_hid_raw_enable(void); +void udi_hid_raw_disable(void); +bool udi_hid_raw_setup(void); uint8_t udi_hid_raw_getsetting(void); UDC_DESC_STORAGE udi_api_t udi_api_hid_raw = { - .enable = (bool(*)(void))udi_hid_raw_enable, - .disable = (void (*)(void))udi_hid_raw_disable, - .setup = (bool(*)(void))udi_hid_raw_setup, + .enable = (bool (*)(void))udi_hid_raw_enable, + .disable = (void (*)(void))udi_hid_raw_disable, + .setup = (bool (*)(void))udi_hid_raw_setup, .getsetting = (uint8_t(*)(void))udi_hid_raw_getsetting, .sof_notify = NULL, }; @@ -737,76 +635,56 @@ COMPILER_WORD_ALIGNED static uint8_t udi_hid_raw_report_trans[UDI_HID_RAW_REPORT_SIZE]; COMPILER_WORD_ALIGNED -UDC_DESC_STORAGE udi_hid_raw_report_desc_t udi_hid_raw_report_desc = { - { - 0x06, // Usage Page (Vendor Defined) - 0xFF, 0xFF, - 0x0A, // Usage (Mouse) - 0xFF, 0xFF, - 0xA1, 0x01, // Collection (Application) - 0x75, 0x08, // Report Size (8) - 0x15, 0x00, // Logical Minimum (0) - 0x25, 0xFF, // Logical Maximum (255) - 0x95, 0x40, // Report Count - 0x09, 0x01, // Usage (Input) - 0x81, 0x02, // Input (Data - 0x95, 0x40, // Report Count - 0x09, 0x02, // Usage (Output) - 0x91, 0x02, // Output (Data - 0xC0, // End Collection - Consumer Control - } -}; +UDC_DESC_STORAGE udi_hid_raw_report_desc_t udi_hid_raw_report_desc = {{ + 0x06, // Usage Page (Vendor Defined) + 0xFF, 0xFF, + 0x0A, // Usage (Mouse) + 0xFF, 0xFF, 0xA1, 0x01, // Collection (Application) + 0x75, 0x08, // Report Size (8) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0xFF, // Logical Maximum (255) + 0x95, 0x40, // Report Count + 0x09, 0x01, // Usage (Input) + 0x81, 0x02, // Input (Data + 0x95, 0x40, // Report Count + 0x09, 0x02, // Usage (Output) + 0x91, 0x02, // Output (Data + 0xC0, // End Collection - Consumer Control +}}; static bool udi_hid_raw_setreport(void); static void udi_hid_raw_setreport_valid(void); static void udi_hid_raw_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep); -bool udi_hid_raw_enable(void) -{ +bool udi_hid_raw_enable(void) { // Initialize internal values - udi_hid_raw_rate = 0; - udi_hid_raw_protocol = 0; + udi_hid_raw_rate = 0; + udi_hid_raw_protocol = 0; udi_hid_raw_b_report_trans_ongoing = false; memset(udi_hid_raw_report, 0, UDI_HID_RAW_REPORT_SIZE); udi_hid_raw_b_report_valid = false; return UDI_HID_RAW_ENABLE_EXT(); } -void udi_hid_raw_disable(void) -{ - UDI_HID_RAW_DISABLE_EXT(); -} +void udi_hid_raw_disable(void) { UDI_HID_RAW_DISABLE_EXT(); } -bool udi_hid_raw_setup(void) -{ - return udi_hid_setup(&udi_hid_raw_rate, - &udi_hid_raw_protocol, - (uint8_t *) &udi_hid_raw_report_desc, - udi_hid_raw_setreport); -} +bool udi_hid_raw_setup(void) { return udi_hid_setup(&udi_hid_raw_rate, &udi_hid_raw_protocol, (uint8_t *)&udi_hid_raw_report_desc, udi_hid_raw_setreport); } -uint8_t udi_hid_raw_getsetting(void) -{ - return 0; -} +uint8_t udi_hid_raw_getsetting(void) { return 0; } -static bool udi_hid_raw_setreport(void) -{ - if ((USB_HID_REPORT_TYPE_OUTPUT == (udd_g_ctrlreq.req.wValue >> 8)) - && (0 == (0xFF & udd_g_ctrlreq.req.wValue)) - && (UDI_HID_RAW_REPORT_SIZE == udd_g_ctrlreq.req.wLength)) { +static bool udi_hid_raw_setreport(void) { + if ((USB_HID_REPORT_TYPE_OUTPUT == (udd_g_ctrlreq.req.wValue >> 8)) && (0 == (0xFF & udd_g_ctrlreq.req.wValue)) && (UDI_HID_RAW_REPORT_SIZE == udd_g_ctrlreq.req.wLength)) { // Report OUT type on report ID 0 from USB Host - udd_g_ctrlreq.payload = udi_hid_raw_report_set; - udd_g_ctrlreq.callback = udi_hid_raw_setreport_valid; //must call routine to transform setreport to LED state + udd_g_ctrlreq.payload = udi_hid_raw_report_set; + udd_g_ctrlreq.callback = udi_hid_raw_setreport_valid; // must call routine to transform setreport to LED state udd_g_ctrlreq.payload_size = UDI_HID_RAW_REPORT_SIZE; return true; } return false; } -bool udi_hid_raw_send_report(void) -{ +bool udi_hid_raw_send_report(void) { if (!main_b_raw_enable) { return false; } @@ -815,20 +693,14 @@ bool udi_hid_raw_send_report(void) return false; } - memcpy(udi_hid_raw_report_trans, udi_hid_raw_report,UDI_HID_RAW_REPORT_SIZE); - udi_hid_raw_b_report_valid = false; - udi_hid_raw_b_report_trans_ongoing = - udd_ep_run(UDI_HID_RAW_EP_IN | USB_EP_DIR_IN, - false, - udi_hid_raw_report_trans, - UDI_HID_RAW_REPORT_SIZE, - udi_hid_raw_report_sent); + memcpy(udi_hid_raw_report_trans, udi_hid_raw_report, UDI_HID_RAW_REPORT_SIZE); + udi_hid_raw_b_report_valid = false; + udi_hid_raw_b_report_trans_ongoing = udd_ep_run(UDI_HID_RAW_EP_IN | USB_EP_DIR_IN, false, udi_hid_raw_report_trans, UDI_HID_RAW_REPORT_SIZE, udi_hid_raw_report_sent); return udi_hid_raw_b_report_trans_ongoing; } -static void udi_hid_raw_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep) -{ +static void udi_hid_raw_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep) { UNUSED(status); UNUSED(nb_sent); UNUSED(ep); @@ -838,27 +710,24 @@ static void udi_hid_raw_report_sent(udd_ep_status_t status, iram_size_t nb_sent, } } -static void udi_hid_raw_setreport_valid(void) -{ +static void udi_hid_raw_setreport_valid(void) {} -} - -#endif //RAW +#endif // RAW //******************************************************************************************** // CON //******************************************************************************************** #ifdef CON -bool udi_hid_con_enable(void); -void udi_hid_con_disable(void); -bool udi_hid_con_setup(void); +bool udi_hid_con_enable(void); +void udi_hid_con_disable(void); +bool udi_hid_con_setup(void); uint8_t udi_hid_con_getsetting(void); UDC_DESC_STORAGE udi_api_t udi_api_hid_con = { - .enable = (bool(*)(void))udi_hid_con_enable, - .disable = (void (*)(void))udi_hid_con_disable, - .setup = (bool(*)(void))udi_hid_con_setup, + .enable = (bool (*)(void))udi_hid_con_enable, + .disable = (void (*)(void))udi_hid_con_disable, + .setup = (bool (*)(void))udi_hid_con_setup, .getsetting = (uint8_t(*)(void))udi_hid_con_getsetting, .sof_notify = NULL, }; @@ -883,76 +752,57 @@ COMPILER_WORD_ALIGNED static uint8_t udi_hid_con_report_trans[UDI_HID_CON_REPORT_SIZE]; COMPILER_WORD_ALIGNED -UDC_DESC_STORAGE udi_hid_con_report_desc_t udi_hid_con_report_desc = { - { - 0x06, 0x31, 0xFF, // Vendor Page (PJRC Teensy compatible) - 0x09, 0x74, // Vendor Usage (PJRC Teensy compatible) - 0xA1, 0x01, // Collection (Application) - 0x09, 0x75, // Usage (Vendor) - 0x15, 0x00, // Logical Minimum (0x00) - 0x26, 0xFF, 0x00, // Logical Maximum (0x00FF) - 0x95, CONSOLE_EPSIZE, // Report Count - 0x75, 0x08, // Report Size (8) - 0x81, 0x02, // Input (Data) - 0x09, 0x76, // Usage (Vendor) - 0x15, 0x00, // Logical Minimum (0x00) - 0x26, 0xFF, 0x00, // Logical Maximum (0x00FF) - 0x95, CONSOLE_EPSIZE, // Report Count - 0x75, 0x08, // Report Size (8) - 0x91, 0x02, // Output (Data) - 0xC0, // End Collection - } -}; +UDC_DESC_STORAGE udi_hid_con_report_desc_t udi_hid_con_report_desc = {{ + 0x06, 0x31, 0xFF, // Vendor Page (PJRC Teensy compatible) + 0x09, 0x74, // Vendor Usage (PJRC Teensy compatible) + 0xA1, 0x01, // Collection (Application) + 0x09, 0x75, // Usage (Vendor) + 0x15, 0x00, // Logical Minimum (0x00) + 0x26, 0xFF, 0x00, // Logical Maximum (0x00FF) + 0x95, CONSOLE_EPSIZE, // Report Count + 0x75, 0x08, // Report Size (8) + 0x81, 0x02, // Input (Data) + 0x09, 0x76, // Usage (Vendor) + 0x15, 0x00, // Logical Minimum (0x00) + 0x26, 0xFF, 0x00, // Logical Maximum (0x00FF) + 0x95, CONSOLE_EPSIZE, // Report Count + 0x75, 0x08, // Report Size (8) + 0x91, 0x02, // Output (Data) + 0xC0, // End Collection +}}; static bool udi_hid_con_setreport(void); static void udi_hid_con_setreport_valid(void); static void udi_hid_con_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep); -bool udi_hid_con_enable(void) -{ +bool udi_hid_con_enable(void) { // Initialize internal values - udi_hid_con_rate = 0; - udi_hid_con_protocol = 0; + udi_hid_con_rate = 0; + udi_hid_con_protocol = 0; udi_hid_con_b_report_trans_ongoing = false; memset(udi_hid_con_report, 0, UDI_HID_CON_REPORT_SIZE); udi_hid_con_b_report_valid = false; return UDI_HID_CON_ENABLE_EXT(); } -void udi_hid_con_disable(void) -{ - UDI_HID_CON_DISABLE_EXT(); -} +void udi_hid_con_disable(void) { UDI_HID_CON_DISABLE_EXT(); } -bool udi_hid_con_setup(void) -{ - return udi_hid_setup(&udi_hid_con_rate, - &udi_hid_con_protocol, - (uint8_t *) &udi_hid_con_report_desc, - udi_hid_con_setreport); -} +bool udi_hid_con_setup(void) { return udi_hid_setup(&udi_hid_con_rate, &udi_hid_con_protocol, (uint8_t *)&udi_hid_con_report_desc, udi_hid_con_setreport); } -uint8_t udi_hid_con_getsetting(void) -{ - return 0; -} +uint8_t udi_hid_con_getsetting(void) { return 0; } -static bool udi_hid_con_setreport(void) -{ - if ((USB_HID_REPORT_TYPE_OUTPUT == (udd_g_ctrlreq.req.wValue >> 8)) - && (0 == (0xFF & udd_g_ctrlreq.req.wValue)) - && (UDI_HID_CON_REPORT_SIZE == udd_g_ctrlreq.req.wLength)) { - udd_g_ctrlreq.payload = udi_hid_con_report_set; - udd_g_ctrlreq.callback = udi_hid_con_setreport_valid; +static bool udi_hid_con_setreport(void) { + if ((USB_HID_REPORT_TYPE_OUTPUT == (udd_g_ctrlreq.req.wValue >> 8)) && (0 == (0xFF & udd_g_ctrlreq.req.wValue)) && (UDI_HID_CON_REPORT_SIZE == udd_g_ctrlreq.req.wLength)) { + udd_g_ctrlreq.payload = udi_hid_con_report_set; + udd_g_ctrlreq.callback = udi_hid_con_setreport_valid; udd_g_ctrlreq.payload_size = UDI_HID_CON_REPORT_SIZE; return true; } return false; } -bool udi_hid_con_send_report(void) -{ +bool udi_hid_con_send_report(void) { if (!main_b_con_enable) { return false; } @@ -961,20 +811,14 @@ bool udi_hid_con_send_report(void) return false; } - memcpy(udi_hid_con_report_trans, udi_hid_con_report,UDI_HID_CON_REPORT_SIZE); - udi_hid_con_b_report_valid = false; - udi_hid_con_b_report_trans_ongoing = - udd_ep_run(UDI_HID_CON_EP_IN | USB_EP_DIR_IN, - false, - udi_hid_con_report_trans, - UDI_HID_CON_REPORT_SIZE, - udi_hid_con_report_sent); + memcpy(udi_hid_con_report_trans, udi_hid_con_report, UDI_HID_CON_REPORT_SIZE); + udi_hid_con_b_report_valid = false; + udi_hid_con_b_report_trans_ongoing = udd_ep_run(UDI_HID_CON_EP_IN | USB_EP_DIR_IN, false, udi_hid_con_report_trans, UDI_HID_CON_REPORT_SIZE, udi_hid_con_report_sent); return udi_hid_con_b_report_trans_ongoing; } -static void udi_hid_con_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep) -{ +static void udi_hid_con_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep) { UNUSED(status); UNUSED(nb_sent); UNUSED(ep); @@ -984,9 +828,6 @@ static void udi_hid_con_report_sent(udd_ep_status_t status, iram_size_t nb_sent, } } -static void udi_hid_con_setreport_valid(void) -{ - -} +static void udi_hid_con_setreport_valid(void) {} -#endif //CON +#endif // CON -- cgit v1.2.3