Include VictorPV's usb reset code to all generic board when SERIAL_USB is enabled ( by the defined in boards.txt)
This commit is contained in:
parent
f69d71ba9d
commit
cbc78edce3
|
@ -75,6 +75,17 @@ namespace wirish {
|
||||||
|
|
||||||
__weak void board_setup_usb(void) {
|
__weak void board_setup_usb(void) {
|
||||||
#ifdef SERIAL_USB
|
#ifdef SERIAL_USB
|
||||||
|
//Attempt to reset the USB interface - developed by Victor PV
|
||||||
|
|
||||||
|
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP);
|
||||||
|
gpio_write_bit(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit,0);
|
||||||
|
|
||||||
|
|
||||||
|
for(volatile unsigned int i=0;i<5000000;i++)
|
||||||
|
{
|
||||||
|
asm("nop");
|
||||||
|
}
|
||||||
|
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_INPUT_FLOATING);
|
||||||
Serial.begin();// Roger Clark. Changed SerialUSB to Serial for Arduino sketch compatibility
|
Serial.begin();// Roger Clark. Changed SerialUSB to Serial for Arduino sketch compatibility
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,17 @@ namespace wirish {
|
||||||
|
|
||||||
__weak void board_setup_usb(void) {
|
__weak void board_setup_usb(void) {
|
||||||
#ifdef SERIAL_USB
|
#ifdef SERIAL_USB
|
||||||
|
//Attempt to reset the USB interface - developed by Victor PV
|
||||||
|
|
||||||
|
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP);
|
||||||
|
gpio_write_bit(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit,0);
|
||||||
|
|
||||||
|
|
||||||
|
for(volatile unsigned int i=0;i<5000000;i++)
|
||||||
|
{
|
||||||
|
asm("nop");
|
||||||
|
}
|
||||||
|
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_INPUT_FLOATING);
|
||||||
Serial.begin();// Roger Clark. Changed SerialUSB to Serial for Arduino sketch compatibility
|
Serial.begin();// Roger Clark. Changed SerialUSB to Serial for Arduino sketch compatibility
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,6 @@ namespace wirish {
|
||||||
|
|
||||||
|
|
||||||
#ifdef SERIAL_USB
|
#ifdef SERIAL_USB
|
||||||
/*
|
|
||||||
//Attempt to reset the USB interface - developed by Victor PV
|
//Attempt to reset the USB interface - developed by Victor PV
|
||||||
|
|
||||||
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP);
|
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP);
|
||||||
|
@ -90,7 +89,6 @@ namespace wirish {
|
||||||
asm("nop");
|
asm("nop");
|
||||||
}
|
}
|
||||||
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_INPUT_FLOATING);
|
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_INPUT_FLOATING);
|
||||||
*/
|
|
||||||
Serial.begin();// Roger Clark. Changed SerialUSB to Serial for Arduino sketch compatibility
|
Serial.begin();// Roger Clark. Changed SerialUSB to Serial for Arduino sketch compatibility
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue