Changed definition for BOARD_HAVE_SERIALUSB so its always true (1) so that compiling in of SERIAL_USB is just controlled by the -DSERIAL_USB flag and not reliant on the DISC pin defintions. Also added experimental code into the ZET to reset USB on startup - this is not fully working, but doesnt seem to cause any ill effects

This commit is contained in:
rogerclarkmelbourne 2015-05-13 19:31:23 +10:00
parent 8c0004f573
commit 2ab2e5cac7
3 changed files with 22 additions and 5 deletions

View File

@ -284,4 +284,4 @@ genericSTM32F103Z.menu.upload_method.serialMethod.upload.tool=serial_upload
genericSTM32F103Z.menu.upload_method.STLinkMethod=STLink
genericSTM32F103Z.menu.upload_method.STLinkMethod.upload.protocol=STLink
genericSTM32F103Z.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
genericSTM32F103Z.menu.upload_method.STLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1
genericSTM32F103Z.menu.upload_method.STLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB

View File

@ -167,7 +167,9 @@ bool boardUsesPin(uint8 pin);
/**
* @brief Feature test: nonzero iff the board has SerialUSB.
*/
#define BOARD_HAVE_SERIALUSB (defined(BOARD_USB_DISC_DEV) && \
defined(BOARD_USB_DISC_BIT))
//Roger Clark. Change so that BOARD_HAVE_SERIALUSB is always true, so that it can be controller by -DSERIAL_USB
#define BOARD_HAVE_SERIALUSB 1
/*(defined(BOARD_USB_DISC_DEV) && defined(BOARD_USB_DISC_BIT))*/
#endif

View File

@ -74,11 +74,26 @@ namespace wirish {
}
__weak void board_setup_usb(void) {
#if BOARD_HAVE_SERIALUSB
#ifdef SERIAL_USB
//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);
for(volatile unsigned int i=0;i<5000000;i++)
{
asm("nop");
}
Serial.begin();// Roger Clark. Changed SerialUSB to Serial for Arduino sketch compatibility
#endif
#endif
}
__weak void series_init(void) {