AP_Notify: add and use AP_NOTIFY_TOSHIBALED_ENABLED

This commit is contained in:
Peter Barker 2022-11-11 10:08:19 +11:00 committed by Andrew Tridgell
parent ab83f42380
commit f7bc68bcbf
5 changed files with 35 additions and 2 deletions

View File

@ -46,12 +46,23 @@ AP_Notify *AP_Notify::_singleton;
#define CONFIG_NOTIFY_DEVICES_MAX 6
#if AP_NOTIFY_TOSHIBALED_ENABLED
#define TOSHIBA_LED_I2C_BUS_INTERNAL 0
#define TOSHIBA_LED_I2C_BUS_EXTERNAL 1
#define ALL_TOSHIBALED_I2C (Notify_LED_ToshibaLED_I2C_Internal | Notify_LED_ToshibaLED_I2C_External)
#else
#define ALL_TOSHIBALED_I2C 0
#endif
#if AP_NOTIFY_NCP5623_ENABLED
#define ALL_NCP5623_I2C (Notify_LED_NCP5623_I2C_Internal | Notify_LED_NCP5623_I2C_External)
#else
#define ALL_NCP5623_I2C 0
#endif
// all I2C_LEDS
#define I2C_LEDS (Notify_LED_ToshibaLED_I2C_Internal | Notify_LED_ToshibaLED_I2C_External | \
Notify_LED_NCP5623_I2C_Internal | Notify_LED_NCP5623_I2C_External)
#define I2C_LEDS (ALL_TOSHIBALED_I2C | ALL_NCP5623_I2C)
#ifndef BUILD_DEFAULT_LED_TYPE
#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
@ -289,12 +300,14 @@ void AP_Notify::add_backends(void)
ADD_BACKEND(new AP_BoardLED2());
#endif
break;
#if AP_NOTIFY_TOSHIBALED_ENABLED
case Notify_LED_ToshibaLED_I2C_Internal:
ADD_BACKEND(new ToshibaLED_I2C(TOSHIBA_LED_I2C_BUS_INTERNAL));
break;
case Notify_LED_ToshibaLED_I2C_External:
ADD_BACKEND(new ToshibaLED_I2C(TOSHIBA_LED_I2C_BUS_EXTERNAL));
break;
#endif
#if AP_NOTIFY_NCP5623_ENABLED
case Notify_LED_NCP5623_I2C_External:
FOREACH_I2C_EXTERNAL(b) {

View File

@ -61,13 +61,19 @@ public:
enum Notify_LED_Type {
Notify_LED_None = 0, // not enabled
Notify_LED_Board = (1 << 0), // Built in board LED's
#if AP_NOTIFY_TOSHIBALED_ENABLED
Notify_LED_ToshibaLED_I2C_Internal = (1 << 1), // Internal ToshibaLED_I2C
Notify_LED_ToshibaLED_I2C_External = (1 << 2), // External ToshibaLED_I2C
#endif
#if AP_NOTIFY_PCA9685_ENABLED
Notify_LED_PCA9685LED_I2C_External = (1 << 3), // External PCA9685_I2C
#endif
Notify_LED_OreoLED = (1 << 4), // Oreo
Notify_LED_UAVCAN = (1 << 5), // UAVCAN RGB LED
#if AP_NOTIFY_NCP5623_ENABLED
Notify_LED_NCP5623_I2C_External = (1 << 6), // External NCP5623
Notify_LED_NCP5623_I2C_Internal = (1 << 7), // Internal NCP5623
#endif
Notify_LED_NeoPixel = (1 << 8), // NeoPixel 5050 AdaFruit 1655 SK6812 Worldsemi WS2812B
Notify_LED_ProfiLED = (1 << 9), // ProfiLED
Notify_LED_Scripting = (1 << 10),// Colour accessor for scripting

View File

@ -20,3 +20,7 @@
#ifndef AP_NOTIFY_PCA9685_ENABLED
#define AP_NOTIFY_PCA9685_ENABLED 1
#endif
#ifndef AP_NOTIFY_TOSHIBALED_ENABLED
#define AP_NOTIFY_TOSHIBALED_ENABLED 1
#endif

View File

@ -20,6 +20,8 @@
#include "ToshibaLED_I2C.h"
#if AP_NOTIFY_TOSHIBALED_ENABLED
#include <utility>
#include <AP_HAL/AP_HAL.h>
@ -95,3 +97,5 @@ void ToshibaLED_I2C::_timer(void)
_dev->transfer(val, sizeof(val), nullptr, 0);
}
#endif // AP_NOTIFY_TOSHIBALED_ENABLED

View File

@ -16,6 +16,10 @@
*/
#pragma once
#include "AP_Notify_config.h"
#if AP_NOTIFY_TOSHIBALED_ENABLED
#include <AP_HAL/I2CDevice.h>
#include "RGBLed.h"
@ -36,3 +40,5 @@ private:
} rgb;
uint8_t _bus;
};
#endif // AP_NOTIFY_TOSHIBALED_ENABLED