Init
This commit is contained in:
parent
8b448aebd7
commit
e7d9c94e93
|
|
@ -306,15 +306,19 @@ static uint16_t vSerialPortReceiveQueue(
|
|||
static uint16_t vSerialPortUsbTransmit(tSerialPortUsbArtery *env, uint8_t *data, uint16_t size, uint32_t timeout) {
|
||||
|
||||
if (env->USB_ID == 1) {
|
||||
if (usb_vcp_send_data(&otg1_core_struct.dev, data, size) == SUCCESS) {
|
||||
return size;
|
||||
if ((otg1_timeout != 0) && (otg1_timeout < SystemGetMs())) {
|
||||
if (usb_vcp_send_data(&otg1_core_struct.dev, data, size) == SUCCESS) {
|
||||
return size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (env->USB_ID == 2) {
|
||||
#if (OTG2_USB_ID == 1)
|
||||
if (usb_vcp_send_data(&otg2_core_struct.dev, data, size) == SUCCESS) {
|
||||
return size;
|
||||
if ((otg2_timeout != 0) && (otg2_timeout < SystemGetMs())) {
|
||||
if (usb_vcp_send_data(&otg2_core_struct.dev, data, size) == SUCCESS) {
|
||||
return size;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -335,8 +339,7 @@ vSerialPortUsbSnifferReceive(tSerialPortUsbArtery *env, uint8_t *data, uint16_t
|
|||
}
|
||||
|
||||
|
||||
usb_sts_type SerialPortUsb_ReInit(uint8_t USB_ID)
|
||||
{
|
||||
usb_sts_type SerialPortUsb_ReInit(uint8_t USB_ID) {
|
||||
usb_sts_type status = USB_OK;
|
||||
|
||||
if (USB_ID == 1) {
|
||||
|
|
@ -383,8 +386,7 @@ usb_sts_type SerialPortUsb_ReInit(uint8_t USB_ID)
|
|||
&cdc_desc_handler);
|
||||
|
||||
#endif
|
||||
}
|
||||
else if (USB_ID == 2) {
|
||||
} else if (USB_ID == 2) {
|
||||
#if (OTG2_USB_ID == 1)
|
||||
if (SerialPortUsbArteryOtg2 == NULL) {
|
||||
return USB_ERROR;
|
||||
|
|
@ -428,8 +430,7 @@ usb_sts_type SerialPortUsb_ReInit(uint8_t USB_ID)
|
|||
&cdc_desc_handler);
|
||||
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return USB_ERROR;
|
||||
}
|
||||
|
||||
|
|
@ -441,9 +442,9 @@ static _Noreturn void UsbDriver_Thread(tSerialPortUsbArtery *env) {
|
|||
for (;;) {
|
||||
|
||||
#if (OTG1_USB_ID == 1)
|
||||
if ((otg1_timeout != 0) && (otg1_timeout < SystemGetMs())) {
|
||||
SerialPortUsb_ReInit(1);
|
||||
}
|
||||
if ((otg1_timeout != 0) && (otg1_timeout < SystemGetMs())) {
|
||||
SerialPortUsb_ReInit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (OTG2_USB_ID == 1)
|
||||
|
|
@ -465,8 +466,6 @@ void UsbDriver_StartThread(tSerialPortUsbArtery *env) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void SerialPortUsb_Init(
|
||||
tSerialPortUsbArtery *env,
|
||||
uint8_t USB_ID,
|
||||
|
|
@ -565,7 +564,7 @@ void SerialPortUsb_Init(
|
|||
UsbDriver_StartThread(env);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
tSerialPortIO SerialPortUsb_GetIo(tSerialPortUsbArtery *env) {
|
||||
tSerialPortIO io = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue