usb_cables: don't drive shield pins

This commit is contained in:
King Kévin 2019-12-11 18:44:16 +01:00
parent 060704a7d9
commit 0fde15e6ba
1 changed files with 4 additions and 2 deletions

View File

@ -2086,8 +2086,10 @@ uint8_t usb_cables_check_pins(const struct usb_pin_t* pin1, const struct usb_pin
uint16_t from_pin = (0 == direction ? pin2->pin : pin1->pin);
uint32_t to_port = (0 == direction ? pin1->port : pin2->port);
uint16_t to_pin = (0 == direction ? pin1->pin : pin2->pin);
// don't drive a ground pin high
if (((0 == direction && USB_PIN_TYPE_GROUND == pin2->type) || (1 == direction && USB_PIN_TYPE_GROUND == pin1->type)) && (USB_PIN_CONNECTION_DRIVE_FLOAT == (1 << mode) || USB_PIN_CONNECTION_DRIVE_PULL == (1 << mode))) {
// don't drive a ground or shield pin high (shield might be connected to ground)
if (((0 == direction && (USB_PIN_TYPE_GROUND == pin2->type || USB_PIN_TYPE_SHIELD == pin2->type)) || \
(1 == direction && (USB_PIN_TYPE_GROUND == pin1->type || USB_PIN_TYPE_SHIELD == pin1->type))) && \
(USB_PIN_CONNECTION_DRIVE_FLOAT == (1 << mode) || USB_PIN_CONNECTION_DRIVE_PULL == (1 << mode))) {
continue;
}