Allow reinitializing USB
This commit is contained in:
parent
e121ecd896
commit
4afb598453
10
usb.c
10
usb.c
|
@ -314,15 +314,19 @@ void usb_setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the device... */
|
/* 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,
|
g_usbd_dev = usbd_init(&otgfs_usb_driver, &dev, &config,
|
||||||
(char const * const *)usb_strings,
|
(char const * const *)usb_strings,
|
||||||
(sizeof usb_strings) / sizeof(usb_strings[0]),
|
(sizeof usb_strings) / sizeof(usb_strings[0]),
|
||||||
usbd_control_buffer, sizeof(usbd_control_buffer));
|
usbd_control_buffer, sizeof(usbd_control_buffer));
|
||||||
|
|
||||||
usbd_register_set_config_callback(g_usbd_dev, cdcacm_set_config);
|
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() { }
|
//void __attribute__((weak)) otg_fs_isr() { }
|
||||||
|
|
1
usb.h
1
usb.h
|
@ -6,6 +6,7 @@
|
||||||
extern usbd_device *g_usbd_dev;
|
extern usbd_device *g_usbd_dev;
|
||||||
|
|
||||||
void usb_setup(void);
|
void usb_setup(void);
|
||||||
|
void usb_reinit(void);
|
||||||
int usb_write_cdcacm(uint8_t acm, void *data, size_t len, int tries);
|
int usb_write_cdcacm(uint8_t acm, void *data, size_t len, int tries);
|
||||||
|
|
||||||
#define ACM_NFC 1
|
#define ACM_NFC 1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user