AP_Notify: Catch bad board LED combos

This commit is contained in:
Michael du Breuil 2018-09-17 14:24:18 -07:00 committed by Francisco Ferreira
parent 6f7ced73d6
commit e41b2de5ea
2 changed files with 6 additions and 17 deletions

View File

@ -16,18 +16,12 @@
#include "AP_Notify.h"
#if (defined(HAL_GPIO_A_LED_PIN) || defined(HAL_GPIO_B_LED_PIN) || \
#if (defined(HAL_GPIO_A_LED_PIN) && defined(HAL_GPIO_B_LED_PIN) && \
defined(HAL_GPIO_C_LED_PIN))
#ifndef HAL_GPIO_A_LED_PIN
#define HAL_GPIO_A_LED_PIN -1
#endif
#ifndef HAL_GPIO_B_LED_PIN
#define HAL_GPIO_B_LED_PIN -1
#endif
#ifndef HAL_GPIO_C_LED_PIN
#define HAL_GPIO_C_LED_PIN -1
#endif
static_assert((HAL_GPIO_A_LED_PIN != HAL_GPIO_B_LED_PIN) &&
(HAL_GPIO_A_LED_PIN != HAL_GPIO_C_LED_PIN) &&
(HAL_GPIO_B_LED_PIN != HAL_GPIO_C_LED_PIN), "Duplicate LED assignments detected");
extern const AP_HAL::HAL& hal;

View File

@ -19,14 +19,9 @@
// show all status on only 2 leds
#if defined(HAL_GPIO_A_LED_PIN) || defined(HAL_GPIO_B_LED_PIN)
#if defined(HAL_GPIO_A_LED_PIN) && defined(HAL_GPIO_B_LED_PIN)
#ifndef HAL_GPIO_A_LED_PIN
#define HAL_GPIO_A_LED_PIN -1
#endif
#ifndef HAL_GPIO_B_LED_PIN
#define HAL_GPIO_B_LED_PIN -1
#endif
static_assert((HAL_GPIO_A_LED_PIN != HAL_GPIO_B_LED_PIN), "Duplicate LED assignments detected");
extern const AP_HAL::HAL& hal;