Fixed issue with PB10 being set to OUTPUT for use as a USB Disconnect control on boards which do not have the additional USB disconnect hardware e.g. the Blue Pill. Note. Some variants seem to have the disconnect control on another pin, so I did not change those in case they were actually used
This commit is contained in:
parent
747634a31a
commit
f7a576f2e0
|
@ -384,8 +384,12 @@ void usb_cdcacm_enable(gpio_dev *disc_dev, uint8 disc_bit) {
|
||||||
/* Present ourselves to the host. Writing 0 to "disc" pin must
|
/* Present ourselves to the host. Writing 0 to "disc" pin must
|
||||||
* pull USB_DP pin up while leaving USB_DM pulled down by the
|
* pull USB_DP pin up while leaving USB_DM pulled down by the
|
||||||
* transceiver. See USB 2.0 spec, section 7.1.7.3. */
|
* transceiver. See USB 2.0 spec, section 7.1.7.3. */
|
||||||
gpio_set_mode(disc_dev, disc_bit, GPIO_OUTPUT_PP);
|
|
||||||
gpio_write_bit(disc_dev, disc_bit, 0);
|
if (disc_dev!=NULL)
|
||||||
|
{
|
||||||
|
gpio_set_mode(disc_dev, disc_bit, GPIO_OUTPUT_PP);
|
||||||
|
gpio_write_bit(disc_dev, disc_bit, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize the USB peripheral. */
|
/* Initialize the USB peripheral. */
|
||||||
usb_init_usblib(USBLIB, ep_int_in, ep_int_out);
|
usb_init_usblib(USBLIB, ep_int_in, ep_int_out);
|
||||||
|
@ -395,7 +399,10 @@ void usb_cdcacm_disable(gpio_dev *disc_dev, uint8 disc_bit) {
|
||||||
/* Turn off the interrupt and signal disconnect (see e.g. USB 2.0
|
/* Turn off the interrupt and signal disconnect (see e.g. USB 2.0
|
||||||
* spec, section 7.1.7.3). */
|
* spec, section 7.1.7.3). */
|
||||||
nvic_irq_disable(NVIC_USB_LP_CAN_RX0);
|
nvic_irq_disable(NVIC_USB_LP_CAN_RX0);
|
||||||
gpio_write_bit(disc_dev, disc_bit, 1);
|
if (disc_dev!=NULL)
|
||||||
|
{
|
||||||
|
gpio_write_bit(disc_dev, disc_bit, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void usb_cdcacm_putc(char ch) {
|
void usb_cdcacm_putc(char ch) {
|
||||||
|
|
|
@ -70,8 +70,8 @@
|
||||||
#define BOARD_JTDO_PIN 19
|
#define BOARD_JTDO_PIN 19
|
||||||
#define BOARD_NJTRST_PIN 18
|
#define BOARD_NJTRST_PIN 18
|
||||||
|
|
||||||
#define BOARD_USB_DISC_DEV GPIOB
|
#define BOARD_USB_DISC_DEV NULL
|
||||||
#define BOARD_USB_DISC_BIT 10
|
#define BOARD_USB_DISC_BIT NULL
|
||||||
|
|
||||||
// Note this needs to match with the PIN_MAP array in board.cpp
|
// Note this needs to match with the PIN_MAP array in board.cpp
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -70,8 +70,8 @@
|
||||||
#define BOARD_JTDO_PIN 19
|
#define BOARD_JTDO_PIN 19
|
||||||
#define BOARD_NJTRST_PIN 18
|
#define BOARD_NJTRST_PIN 18
|
||||||
|
|
||||||
#define BOARD_USB_DISC_DEV GPIOB
|
#define BOARD_USB_DISC_DEV NULL
|
||||||
#define BOARD_USB_DISC_BIT 10
|
#define BOARD_USB_DISC_BIT NULL
|
||||||
|
|
||||||
#define LED_BUILTIN PC13
|
#define LED_BUILTIN PC13
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,8 @@
|
||||||
#define BOARD_JTDO_PIN 19
|
#define BOARD_JTDO_PIN 19
|
||||||
#define BOARD_NJTRST_PIN 18
|
#define BOARD_NJTRST_PIN 18
|
||||||
|
|
||||||
#define BOARD_USB_DISC_DEV GPIOB
|
#define BOARD_USB_DISC_DEV NULL
|
||||||
#define BOARD_USB_DISC_BIT 10
|
#define BOARD_USB_DISC_BIT NULL
|
||||||
|
|
||||||
// Note this needs to match with the PIN_MAP array in board.cpp
|
// Note this needs to match with the PIN_MAP array in board.cpp
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -102,11 +102,8 @@
|
||||||
/**
|
/**
|
||||||
* Note: there is no USB in this board.
|
* Note: there is no USB in this board.
|
||||||
*/
|
*/
|
||||||
// Roger Clark. These USB disconnect pin definitions have been added as a temporary fix in order that the this board compiles
|
#define BOARD_USB_DISC_DEV NULL
|
||||||
// following changes to add usb serial to other boards
|
#define BOARD_USB_DISC_BIT NULL
|
||||||
// I will remove them when the code in the core usb_serial.cpp has been tidied up so that they are no longer needed.
|
|
||||||
#define BOARD_USB_DISC_DEV GPIOB
|
|
||||||
#define BOARD_USB_DISC_BIT 10
|
|
||||||
|
|
||||||
/* Pin aliases: these give the GPIO port/bit for each pin as an
|
/* Pin aliases: these give the GPIO port/bit for each pin as an
|
||||||
* enum. These are optional, but recommended. They make it easier to
|
* enum. These are optional, but recommended. They make it easier to
|
||||||
|
|
Loading…
Reference in New Issue