AP_Notify: tidy use of DiscreteRGB

This commit is contained in:
Peter Barker 2023-09-14 12:00:30 +10:00 committed by Randy Mackay
parent 83636e6ef3
commit 62950169f7
5 changed files with 18 additions and 4 deletions

View File

@ -155,10 +155,6 @@ AP_Notify *AP_Notify::_singleton;
#define DEFAULT_BUZZ_ON_LVL 1 #define DEFAULT_BUZZ_ON_LVL 1
#endif #endif
#ifndef AP_NOTIFY_DISCRETE_RGB_ENABLED
#define AP_NOTIFY_DISCRETE_RGB_ENABLED 0
#endif
// table of user settable parameters // table of user settable parameters
const AP_Param::GroupInfo AP_Notify::var_info[] = { const AP_Param::GroupInfo AP_Notify::var_info[] = {

View File

@ -94,7 +94,9 @@ public:
Notify_LED_IS31FL3195_I2C_External = (1 << 15), // IS31FL3195 Notify_LED_IS31FL3195_I2C_External = (1 << 15), // IS31FL3195
Notify_LED_IS31FL3195_I2C_Internal = (1 << 16), // IS31FL3195 Notify_LED_IS31FL3195_I2C_Internal = (1 << 16), // IS31FL3195
#endif #endif
#if AP_NOTIFY_DISCRETE_RGB_ENABLED
Notify_LED_DiscreteRGB = (1 << 17), // DiscreteRGB Notify_LED_DiscreteRGB = (1 << 17), // DiscreteRGB
#endif
Notify_LED_MAX Notify_LED_MAX
}; };

View File

@ -9,6 +9,10 @@
#include <AP_SerialLED/AP_SerialLED_config.h> #include <AP_SerialLED/AP_SerialLED_config.h>
#include <AP_Scripting/AP_Scripting_config.h> #include <AP_Scripting/AP_Scripting_config.h>
#ifndef AP_NOTIFY_DISCRETE_RGB_ENABLED
#define AP_NOTIFY_DISCRETE_RGB_ENABLED 0
#endif
#ifndef HAL_DISPLAY_ENABLED #ifndef HAL_DISPLAY_ENABLED
#define HAL_DISPLAY_ENABLED 1 #define HAL_DISPLAY_ENABLED 1
#endif #endif

View File

@ -11,6 +11,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "AP_Notify_config.h"
#if AP_NOTIFY_DISCRETE_RGB_ENABLED
#include "DiscreteRGBLed.h" #include "DiscreteRGBLed.h"
#include <AP_HAL/HAL.h> #include <AP_HAL/HAL.h>
@ -55,3 +59,5 @@ bool DiscreteRGBLed::hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue)
return true; return true;
} }
#endif // AP_NOTIFY_DISCRETE_RGB_ENABLED

View File

@ -18,6 +18,10 @@
#pragma once #pragma once
#include "AP_Notify_config.h"
#if AP_NOTIFY_DISCRETE_RGB_ENABLED
#include "RGBLed.h" #include "RGBLed.h"
class DiscreteRGBLed: public RGBLed { class DiscreteRGBLed: public RGBLed {
@ -35,3 +39,5 @@ private:
uint16_t red_pin_number, green_pin_number, blue_pin_number; uint16_t red_pin_number, green_pin_number, blue_pin_number;
}; };
#endif // AP_NOTIFY_DISCRETE_RGB_ENABLED