From 0e28f667614e37015a252968e6cfe6ac869fecaa Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 3 May 2019 13:57:33 +1000 Subject: [PATCH] AP_Notify: don't use pinMode for pixracer LEDs this is needed for LEDs that are driven by 5V, which means they need to use OPENDRAIN. --- libraries/AP_Notify/PixRacerLED.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/AP_Notify/PixRacerLED.cpp b/libraries/AP_Notify/PixRacerLED.cpp index 1f3104506a..3ed8564b2f 100644 --- a/libraries/AP_Notify/PixRacerLED.cpp +++ b/libraries/AP_Notify/PixRacerLED.cpp @@ -36,9 +36,13 @@ PixRacerLED::PixRacerLED() : bool PixRacerLED::hw_init(void) { + // when HAL_GPIO_LED_ON is 0 then we must not use pinMode() + // as it could remove the OPENDRAIN attribute on the pin +#if HAL_GPIO_LED_ON != 0 hal.gpio->pinMode(HAL_GPIO_A_LED_PIN, HAL_GPIO_OUTPUT); hal.gpio->pinMode(HAL_GPIO_B_LED_PIN, HAL_GPIO_OUTPUT); hal.gpio->pinMode(HAL_GPIO_C_LED_PIN, HAL_GPIO_OUTPUT); +#endif hal.gpio->write(HAL_GPIO_A_LED_PIN, HAL_GPIO_LED_OFF); hal.gpio->write(HAL_GPIO_B_LED_PIN, HAL_GPIO_LED_OFF); hal.gpio->write(HAL_GPIO_C_LED_PIN, HAL_GPIO_LED_OFF);