Allow reinitializing USB

This commit is contained in:
Lynn Ochs 2021-07-16 21:22:13 +02:00
parent e121ecd896
commit 4afb598453
2 changed files with 8 additions and 3 deletions

10
usb.c
View File

@ -314,15 +314,19 @@ void usb_setup() {
}
/* Initialize the device... */
usb_reinit();
/* And use interrupts instead of polling. */
// nvic_enable_irq(NVIC_OTG_FS_IRQ);
}
void usb_reinit() {
g_usbd_dev = usbd_init(&otgfs_usb_driver, &dev, &config,
(char const * const *)usb_strings,
(sizeof usb_strings) / sizeof(usb_strings[0]),
usbd_control_buffer, sizeof(usbd_control_buffer));
usbd_register_set_config_callback(g_usbd_dev, cdcacm_set_config);
/* And use interrupts instead of polling. */
// nvic_enable_irq(NVIC_OTG_FS_IRQ);
}
//void __attribute__((weak)) otg_fs_isr() { }

1
usb.h
View File

@ -6,6 +6,7 @@
extern usbd_device *g_usbd_dev;
void usb_setup(void);
void usb_reinit(void);
int usb_write_cdcacm(uint8_t acm, void *data, size_t len, int tries);
#define ACM_NFC 1