@@ -95,7 +95,6 @@ uint8_t USBClass::addEntry(Entry **head, int interfaces, const uint8_t *descript
9595 static uint8_t id = 1;
9696
9797 Entry *n = (Entry *)malloc(sizeof(Entry));
98- assert(n);
9998 n->descriptor = descriptor;
10099 n->len = len;
101100 n->interfaces = interfaces;
@@ -151,7 +150,6 @@ unsigned int USBClass::findID(Entry *head, unsigned int localid) {
151150 head = head->next;
152151 x++;
153152 }
154- assert(head);
155153 return x;
156154}
157155
@@ -285,7 +283,6 @@ void USBClass::setupDescHIDReport() {
285283
286284 // Allocate the "real" HID report descriptor
287285 _hid_report = (uint8_t *)malloc(_hid_report_len);
288- assert(_hid_report);
289286
290287 // Now copy the descriptors
291288 uint8_t *p = _hid_report;
@@ -362,7 +359,6 @@ void USBClass::setupUSBDescriptor() {
362359
363360 // Allocate the "real" HID report descriptor
364361 usbd_desc_cfg = (uint8_t *)malloc(usbd_desc_cfg_len);
365- assert(usbd_desc_cfg);
366362 bzero(usbd_desc_cfg, usbd_desc_cfg_len);
367363
368364 // Now copy the descriptors
@@ -409,7 +405,7 @@ const uint16_t *USBClass::tud_descriptor_string_cb(uint8_t index, uint16_t langi
409405}
410406
411407#ifdef __FREERTOS
412- void __freertos_usb_task (void *param) {
408+ void USBClass::freertosUSBTask (void *param) {
413409 (void) param;
414410
415411 Serial.begin(115200);
@@ -429,7 +425,7 @@ void __freertos_usb_task(void *param) {
429425 }
430426}
431427#else
432- static void usb_irq () {
428+ void USBClass::usbIRQ () {
433429 // if the mutex is already owned, then we are in user code
434430 // in this file which will do a tud_task itself, so we'll just do nothing
435431 // until the next tick; we won't starve
@@ -439,7 +435,7 @@ static void usb_irq() {
439435 }
440436}
441437
442- static int64_t timer_task (__unused alarm_id_t id, __unused void *user_data) {
438+ int64_t USBClass::timerTask (__unused alarm_id_t id, __unused void *user_data) {
443439 irq_set_pending(USB.usbTaskIRQ);
444440 return USB_TASK_INTERVAL;
445441}
@@ -508,13 +504,13 @@ void USBClass::begin() {
508504#ifdef __FREERTOS
509505 // Make high prio and locked to core 0
510506 TaskHandle_t usbTask;
511- xTaskCreate(__freertos_usb_task , "USB", 256, 0, configMAX_PRIORITIES - 2, &usbTask);
507+ xTaskCreate(freertosUSBTask , "USB", 256, 0, configMAX_PRIORITIES - 2, &usbTask);
512508 vTaskCoreAffinitySet(usbTask, 1 << 0);
513509#else
514510 usbTaskIRQ = user_irq_claim_unused(true);
515- irq_set_exclusive_handler(usbTaskIRQ, usb_irq );
511+ irq_set_exclusive_handler(usbTaskIRQ, usbIRQ );
516512 irq_set_enabled(usbTaskIRQ, true);
517- add_alarm_in_us(USB_TASK_INTERVAL, timer_task , nullptr, true);
513+ add_alarm_in_us(USB_TASK_INTERVAL, timerTask , nullptr, true);
518514#endif
519515}
520516
0 commit comments