AP_Notify: init gpio state for LEDs

This commit is contained in:
Andrew Tridgell 2018-10-06 19:43:29 +10:00 committed by Randy Mackay
parent 36aa666786
commit 927105cd25
1 changed files with 4 additions and 2 deletions

View File

@ -15,8 +15,7 @@
#include "PixRacerLED.h" #include "PixRacerLED.h"
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 && CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_PX4_V4 \ #if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_PX4_V4 || CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
|| CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
#ifndef HAL_GPIO_A_LED_PIN #ifndef HAL_GPIO_A_LED_PIN
#define HAL_GPIO_A_LED_PIN -1 #define HAL_GPIO_A_LED_PIN -1
@ -37,6 +36,9 @@ PixRacerLED::PixRacerLED() :
bool PixRacerLED::hw_init(void) bool PixRacerLED::hw_init(void)
{ {
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);
hal.gpio->write(HAL_GPIO_A_LED_PIN, HAL_GPIO_LED_OFF); 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_B_LED_PIN, HAL_GPIO_LED_OFF);
hal.gpio->write(HAL_GPIO_C_LED_PIN, HAL_GPIO_LED_OFF); hal.gpio->write(HAL_GPIO_C_LED_PIN, HAL_GPIO_LED_OFF);