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.
This commit is contained in:
Andrew Tridgell 2019-05-03 13:57:33 +10:00
parent 26a6cccf21
commit 0e28f66761
1 changed files with 4 additions and 0 deletions

View File

@ -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);