Skip to content

Commit 7fe2e78

Browse files
author
rogerclarkmelbourne
committed
Disabled generic bootloader USB reset
1 parent 4f6667a commit 7fe2e78

4 files changed

Lines changed: 15 additions & 6 deletions

File tree

STM32F1/variants/generic_stm32f103c/wirish/boards_setup.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,16 @@ namespace wirish {
7474
}
7575

7676
__weak void board_setup_usb(void) {
77-
#ifdef SERIAL_USB
78-
//Reset the USB interface on generic boards - developed by Victor PV
77+
#ifdef SERIAL_USB
7978

79+
#ifdef GENERIC_BOOTLOADER
80+
//Reset the USB interface on generic boards - developed by Victor PV
8081
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP);
8182
gpio_write_bit(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit,0);
8283

8384
for(volatile unsigned int i=0;i<256;i++);// Only small delay seems to be needed, and USB pins will get configured in Serial.begin
8485
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_INPUT_FLOATING);
85-
86+
#endif
8687
Serial.begin();// Roger Clark. Changed SerialUSB to Serial for Arduino sketch compatibility
8788
#endif
8889
}

STM32F1/variants/generic_stm32f103r/wirish/boards_setup.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,14 @@ namespace wirish {
7676
__weak void board_setup_usb(void) {
7777
#ifdef SERIAL_USB
7878

79+
#ifdef GENERIC_BOOTLOADER
7980
//Reset the USB interface on generic boards - developed by Victor PV
8081
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP);
8182
gpio_write_bit(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit,0);
83+
8284
for(volatile unsigned int i=0;i<256;i++);// Only small delay seems to be needed, and USB pins will get configured in Serial.begin
8385
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_INPUT_FLOATING);
86+
#endif
8487

8588
Serial.begin();// Roger Clark. Changed SerialUSB to Serial for Arduino sketch compatibility
8689
#endif

STM32F1/variants/generic_stm32f103v/wirish/boards_setup.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,14 @@ namespace wirish {
7777
#ifdef SERIAL_USB
7878

7979

80+
#ifdef GENERIC_BOOTLOADER
8081
//Reset the USB interface on generic boards - developed by Victor PV
8182
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP);
8283
gpio_write_bit(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit,0);
84+
8385
for(volatile unsigned int i=0;i<256;i++);// Only small delay seems to be needed, and USB pins will get configured in Serial.begin
8486
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_INPUT_FLOATING);
85-
87+
#endif
8688
Serial.begin();// Roger Clark. Changed SerialUSB to Serial for Arduino sketch compatibility
8789
#endif
8890
}

STM32F1/variants/generic_stm32f103z/wirish/boards_setup.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,18 @@ namespace wirish {
7777

7878

7979

80-
#ifdef SERIAL_USB
80+
#ifdef SERIAL_USB
81+
#ifdef GENERIC_BOOTLOADER
8182
//Reset the USB interface on generic boards - developed by Victor PV
8283
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP);
8384
gpio_write_bit(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit,0);
85+
8486
for(volatile unsigned int i=0;i<256;i++);// Only small delay seems to be needed, and USB pins will get configured in Serial.begin
8587
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_INPUT_FLOATING);
88+
#endif
8689

8790
Serial.begin();// Roger Clark. Changed SerialUSB to Serial for Arduino sketch compatibility
88-
#endif
91+
#endif
8992
}
9093

9194
__weak void series_init(void) {

0 commit comments

Comments
 (0)