diff --git a/libraries/AP_Notify/AP_Notify.cpp b/libraries/AP_Notify/AP_Notify.cpp
index a74655db832..da5ebde3796 100644
--- a/libraries/AP_Notify/AP_Notify.cpp
+++ b/libraries/AP_Notify/AP_Notify.cpp
@@ -287,19 +287,17 @@ void AP_Notify::add_backends(void)
break;
case Notify_LED_Board:
// select the most appropriate built in LED driver type
-#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
- #if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_NAVIO2
+#if AP_NOTIFY_SYSFS_LED_ENABLED
ADD_BACKEND(NEW_NOTHROW Led_Sysfs("rgb_led0", "rgb_led2", "rgb_led1"));
- #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_EDGE
+#elif AP_NOTIFY_RCOUTPUTRGBLEDINVERTED_LED_ENABLED
ADD_BACKEND(NEW_NOTHROW RCOutputRGBLedInverted(12, 13, 14));
- #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BH
+#elif AP_NOTIFY_RCOUTPUTRGBLED_LED_ENABLED
ADD_BACKEND(NEW_NOTHROW RCOutputRGBLed(HAL_RCOUT_RGBLED_RED, HAL_RCOUT_RGBLED_GREEN, HAL_RCOUT_RGBLED_BLUE));
- #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO
+#elif AP_NOTIFY_DISCO_LED_ENABLED
ADD_BACKEND(NEW_NOTHROW DiscoLED());
- #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_NAVIGATOR
+#elif AP_NOTIFY_NAVIGATOR_LED_ENABLED
ADD_BACKEND(NEW_NOTHROW NavigatorLED());
- #endif
-#endif // CONFIG_HAL_BOARD == HAL_BOARD_LINUX
+#endif
#if AP_NOTIFY_EXTERNALLED_ENABLED
ADD_BACKEND(NEW_NOTHROW ExternalLED()); // despite the name this is a built in set of onboard LED's
diff --git a/libraries/AP_Notify/AP_Notify_config.h b/libraries/AP_Notify/AP_Notify_config.h
index 62238d28ed0..23b7c6c8b16 100644
--- a/libraries/AP_Notify/AP_Notify_config.h
+++ b/libraries/AP_Notify/AP_Notify_config.h
@@ -37,6 +37,14 @@
#define AP_NOTIFY_LP5562_ENABLED 1
#endif
+#ifndef AP_NOTIFY_DISCO_LED_ENABLED
+#define AP_NOTIFY_DISCO_LED_ENABLED 0
+#endif
+
+#ifndef AP_NOTIFY_NAVIGATOR_LED_ENABLED
+#define AP_NOTIFY_NAVIGATOR_LED_ENABLED 0
+#endif
+
#ifndef AP_NOTIFY_GPIO_LED_3_ENABLED
#define AP_NOTIFY_GPIO_LED_3_ENABLED 0
#endif
@@ -51,6 +59,22 @@
#define AP_NOTIFY_GPIO_LED_RGB_ENABLED 0
#endif
+#ifndef AP_NOTIFY_RCOUTPUTRGBLEDINVERTED_LED_ENABLED
+#define AP_NOTIFY_RCOUTPUTRGBLEDINVERTED_LED_ENABLED 0
+#endif
+
+#ifndef AP_NOTIFY_RCOUTPUTRGBLEDOFF_LED_ENABLED
+#define AP_NOTIFY_RCOUTPUTRGBLEDOFF_LED_ENABLED 0
+#endif
+
+#ifndef AP_NOTIFY_RCOUTPUTRGBLED_LED_ENABLED
+#define AP_NOTIFY_RCOUTPUTRGBLED_LED_ENABLED AP_NOTIFY_RCOUTPUTRGBLEDINVERTED_LED_ENABLED || AP_NOTIFY_RCOUTPUTRGBLEDOFF_LED_ENABLED
+#endif
+
+#ifndef AP_NOTIFY_SYSFS_LED_ENABLED
+#define AP_NOTIFY_SYSFS_LED_ENABLED 0
+#endif
+
#ifndef AP_NOTIFY_IS31FL3195_ENABLED
#define AP_NOTIFY_IS31FL3195_ENABLED 1
#endif
diff --git a/libraries/AP_Notify/DiscoLED.cpp b/libraries/AP_Notify/DiscoLED.cpp
index 845972e623e..ec2030d894d 100644
--- a/libraries/AP_Notify/DiscoLED.cpp
+++ b/libraries/AP_Notify/DiscoLED.cpp
@@ -14,9 +14,13 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
+
+#include "AP_Notify_config.h"
+
+#if AP_NOTIFY_DISCO_LED_ENABLED
+
#include
-#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
#include "DiscoLED.h"
#include
@@ -92,4 +96,4 @@ bool DiscoLED::hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue)
return true;
}
-#endif
+#endif // AP_NOTIFY_DISCO_LED_ENABLED
diff --git a/libraries/AP_Notify/DiscoLED.h b/libraries/AP_Notify/DiscoLED.h
index 3c7585327ed..d32ccf818fc 100644
--- a/libraries/AP_Notify/DiscoLED.h
+++ b/libraries/AP_Notify/DiscoLED.h
@@ -16,9 +16,12 @@
*/
#pragma once
+#include "AP_Notify_config.h"
+
+#if AP_NOTIFY_DISCO_LED_ENABLED
+
#include
-#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
#include
#include
@@ -53,4 +56,4 @@ private:
enum led_backend backend;
};
-#endif
+#endif // AP_NOTIFY_DISCO_LED_ENABLED
diff --git a/libraries/AP_Notify/Led_Sysfs.cpp b/libraries/AP_Notify/Led_Sysfs.cpp
index 3bdec24cb7f..e611062a0fc 100644
--- a/libraries/AP_Notify/Led_Sysfs.cpp
+++ b/libraries/AP_Notify/Led_Sysfs.cpp
@@ -14,13 +14,12 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-#include
+#include "AP_Notify_config.h"
+
+#if AP_NOTIFY_SYSFS_LED_ENABLED
-#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
#include "Led_Sysfs.h"
-#include
-
Led_Sysfs::Led_Sysfs(const char *red, const char *green, const char *blue,
uint8_t off_brightness, uint8_t low_brightness, uint8_t medium_brightness, uint8_t high_brightness):
RGBLed(off_brightness, high_brightness, medium_brightness, low_brightness),
@@ -47,4 +46,4 @@ bool Led_Sysfs::hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue)
return true;
}
-#endif
+#endif // AP_NOTIFY_SYSFS_LED_ENABLED
diff --git a/libraries/AP_Notify/Led_Sysfs.h b/libraries/AP_Notify/Led_Sysfs.h
index be8fab15e80..caab49c8488 100644
--- a/libraries/AP_Notify/Led_Sysfs.h
+++ b/libraries/AP_Notify/Led_Sysfs.h
@@ -16,9 +16,10 @@
*/
#pragma once
-#include
+#include "AP_Notify_config.h"
+
+#if AP_NOTIFY_SYSFS_LED_ENABLED
-#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
#include
#include "RGBLed.h"
@@ -39,4 +40,4 @@ private:
Linux::Led_Sysfs green_led;
Linux::Led_Sysfs blue_led;
};
-#endif
+#endif // AP_NOTIFY_SYSFS_LED_ENABLED
diff --git a/libraries/AP_Notify/NavigatorLED.cpp b/libraries/AP_Notify/NavigatorLED.cpp
index 8c7b706aa16..7bdc68e397e 100644
--- a/libraries/AP_Notify/NavigatorLED.cpp
+++ b/libraries/AP_Notify/NavigatorLED.cpp
@@ -19,6 +19,10 @@
// not used. The data is sent to the neopixel in 24 'SPI bytes', where each
// spi byte is formatted to appear as a single bit of data to the neopixel.
+#include "AP_Notify_config.h"
+
+#if AP_NOTIFY_NAVIGATOR_LED_ENABLED
+
#include
#include "AP_Notify/AP_Notify.h"
#include "NavigatorLED.h"
@@ -79,3 +83,5 @@ void NavigatorLED::_setup_data(uint8_t red, uint8_t green, uint8_t blue)
_data[16 + i] = (blue & (1<<(7-i))) ? LED_T1 : LED_T0;
}
}
+
+#endif // AP_NOTIFY_NAVIGATOR_LED_ENABLED
diff --git a/libraries/AP_Notify/NavigatorLED.h b/libraries/AP_Notify/NavigatorLED.h
index 9f93857eb1c..f6ef3a23877 100644
--- a/libraries/AP_Notify/NavigatorLED.h
+++ b/libraries/AP_Notify/NavigatorLED.h
@@ -14,6 +14,10 @@
*/
#pragma once
+#include "AP_Notify_config.h"
+
+#if AP_NOTIFY_NAVIGATOR_LED_ENABLED
+
#include "RGBLed.h"
#include
@@ -30,3 +34,5 @@ private:
void _setup_data(uint8_t red, uint8_t green, uint8_t blue);
AP_HAL::OwnPtr _dev;
};
+
+#endif // AP_NOTIFY_NAVIGATOR_LED_ENABLED
diff --git a/libraries/AP_Notify/RCOutputRGBLed.cpp b/libraries/AP_Notify/RCOutputRGBLed.cpp
index b9049f14684..b9147126f91 100644
--- a/libraries/AP_Notify/RCOutputRGBLed.cpp
+++ b/libraries/AP_Notify/RCOutputRGBLed.cpp
@@ -15,6 +15,10 @@
* with this program. If not, see .
*/
+#include "AP_Notify_config.h"
+
+#if AP_NOTIFY_RCOUTPUTRGBLED_LED_ENABLED
+
#include "RCOutputRGBLed.h"
#include
@@ -58,10 +62,12 @@ uint16_t RCOutputRGBLed::get_duty_cycle_for_color(const uint8_t color, const uin
return usec_period * color / _led_bright;
}
+#if AP_NOTIFY_RCOUTPUTRGBLEDINVERTED_LED_ENABLED
uint16_t RCOutputRGBLedInverted::get_duty_cycle_for_color(const uint8_t color, const uint16_t usec_period) const
{
return usec_period * (255 - color) / _led_bright;
}
+#endif // AP_NOTIFY_RCOUTPUTRGBLEDINVERTED_LED_ENABLED
bool RCOutputRGBLed::hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue)
@@ -91,3 +97,4 @@ bool RCOutputRGBLed::hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue)
return true;
}
+#endif // AP_NOTIFY_RCOUTPUTRGBLED_LED_ENABLED
diff --git a/libraries/AP_Notify/RCOutputRGBLed.h b/libraries/AP_Notify/RCOutputRGBLed.h
index aeae109e945..865d13fcfc9 100644
--- a/libraries/AP_Notify/RCOutputRGBLed.h
+++ b/libraries/AP_Notify/RCOutputRGBLed.h
@@ -2,6 +2,7 @@
#include "RGBLed.h"
+#if AP_NOTIFY_RCOUTPUTRGBLED_LED_ENABLED
class RCOutputRGBLed: public RGBLed {
public:
RCOutputRGBLed(uint8_t red_channel, uint8_t green_channel,
@@ -20,7 +21,9 @@ private:
uint8_t _green_channel;
uint8_t _blue_channel;
};
+#endif // AP_NOTIFY_RCOUTPUTRGBLED_LED_ENABLED
+#if AP_NOTIFY_RCOUTPUTRGBLEDINVERTED_LED_ENABLED
class RCOutputRGBLedInverted : public RCOutputRGBLed {
public:
RCOutputRGBLedInverted(uint8_t red_channel, uint8_t green_channel, uint8_t blue_channel)
@@ -29,7 +32,9 @@ public:
protected:
virtual uint16_t get_duty_cycle_for_color(const uint8_t color, const uint16_t usec_period) const override;
};
+#endif // AP_NOTIFY_RCOUTPUTRGBLEDINVERTED_LED_ENABLED
+#if AP_NOTIFY_RCOUTPUTRGBLEDOFF_LED_ENABLED
class RCOutputRGBLedOff : public RCOutputRGBLed {
public:
RCOutputRGBLedOff(uint8_t red_channel, uint8_t green_channel,
@@ -45,3 +50,4 @@ public:
return RCOutputRGBLed::hw_set_rgb(_led_off, _led_off, _led_off);
}
};
+#endif // AP_NOTIFY_RCOUTPUTRGBLEDOFF_LED_ENABLED