1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +00:00

trezorhal: add usb_deinit

This commit is contained in:
Jan Pochyla 2017-04-06 18:34:03 +02:00 committed by Pavol Rusnak
parent b592a95fb1
commit 0e33357ee7
2 changed files with 11 additions and 2 deletions

View File

@ -71,12 +71,20 @@ int usb_init(const usb_dev_info_t *dev_info) {
// Reset the iface state map // Reset the iface state map
memset(&usb_ifaces, 0, sizeof(usb_ifaces)); memset(&usb_ifaces, 0, sizeof(usb_ifaces));
USBD_Init(&usb_dev_handle, (USBD_DescriptorsTypeDef*)&usb_descriptors, USB_PHY_FS_ID); if (0 != USBD_Init(&usb_dev_handle, (USBD_DescriptorsTypeDef*)&usb_descriptors, USB_PHY_FS_ID)) {
USBD_RegisterClass(&usb_dev_handle, (USBD_ClassTypeDef*)&usb_class); return 1;
}
if (0 != USBD_RegisterClass(&usb_dev_handle, (USBD_ClassTypeDef*)&usb_class)) {
return 1;
}
return 0; return 0;
} }
int usb_deinit(void) {
return USBD_DeInit(&usb_dev_handle);
}
int usb_start(void) { int usb_start(void) {
return USBD_Start(&usb_dev_handle); return USBD_Start(&usb_dev_handle);
} }

View File

@ -113,6 +113,7 @@ typedef struct {
} usb_iface_t; } usb_iface_t;
int usb_init(const usb_dev_info_t *dev_info); int usb_init(const usb_dev_info_t *dev_info);
int usb_deinit(void);
int usb_start(void); int usb_start(void);
int usb_stop(void); int usb_stop(void);