@@ -95,7 +95,6 @@ uint8_t USBClass::addEntry(Entry **head, int interfaces, const uint8_t *descript
95
95
static uint8_t id = 1 ;
96
96
97
97
Entry *n = (Entry *)malloc (sizeof (Entry));
98
- assert (n);
99
98
n->descriptor = descriptor;
100
99
n->len = len;
101
100
n->interfaces = interfaces;
@@ -151,7 +150,6 @@ unsigned int USBClass::findID(Entry *head, unsigned int localid) {
151
150
head = head->next ;
152
151
x++;
153
152
}
154
- assert (head);
155
153
return x;
156
154
}
157
155
@@ -285,7 +283,6 @@ void USBClass::setupDescHIDReport() {
285
283
286
284
// Allocate the "real" HID report descriptor
287
285
_hid_report = (uint8_t *)malloc (_hid_report_len);
288
- assert (_hid_report);
289
286
290
287
// Now copy the descriptors
291
288
uint8_t *p = _hid_report;
@@ -362,7 +359,6 @@ void USBClass::setupUSBDescriptor() {
362
359
363
360
// Allocate the "real" HID report descriptor
364
361
usbd_desc_cfg = (uint8_t *)malloc (usbd_desc_cfg_len);
365
- assert (usbd_desc_cfg);
366
362
bzero (usbd_desc_cfg, usbd_desc_cfg_len);
367
363
368
364
// Now copy the descriptors
@@ -409,7 +405,7 @@ const uint16_t *USBClass::tud_descriptor_string_cb(uint8_t index, uint16_t langi
409
405
}
410
406
411
407
#ifdef __FREERTOS
412
- void __freertos_usb_task (void *param) {
408
+ void USBClass::freertosUSBTask (void *param) {
413
409
(void ) param;
414
410
415
411
Serial.begin (115200 );
@@ -429,7 +425,7 @@ void __freertos_usb_task(void *param) {
429
425
}
430
426
}
431
427
#else
432
- static void usb_irq () {
428
+ void USBClass::usbIRQ () {
433
429
// if the mutex is already owned, then we are in user code
434
430
// in this file which will do a tud_task itself, so we'll just do nothing
435
431
// until the next tick; we won't starve
@@ -439,7 +435,7 @@ static void usb_irq() {
439
435
}
440
436
}
441
437
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) {
443
439
irq_set_pending (USB.usbTaskIRQ );
444
440
return USB_TASK_INTERVAL;
445
441
}
@@ -508,13 +504,13 @@ void USBClass::begin() {
508
504
#ifdef __FREERTOS
509
505
// Make high prio and locked to core 0
510
506
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);
512
508
vTaskCoreAffinitySet (usbTask, 1 << 0 );
513
509
#else
514
510
usbTaskIRQ = user_irq_claim_unused (true );
515
- irq_set_exclusive_handler (usbTaskIRQ, usb_irq );
511
+ irq_set_exclusive_handler (usbTaskIRQ, usbIRQ );
516
512
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 );
518
514
#endif
519
515
}
520
516
0 commit comments