AP_Notify: allow pca9685 to be compiled out of code

This commit is contained in:
Peter Barker 2022-11-08 12:22:04 +11:00 committed by Andrew Tridgell
parent 2ee0fb671b
commit d99e5b91d8
4 changed files with 14 additions and 0 deletions

View File

@ -307,9 +307,11 @@ void AP_Notify::add_backends(void)
} }
break; break;
#endif #endif
#if AP_NOTIFY_PCA9685_ENABLED
case Notify_LED_PCA9685LED_I2C_External: case Notify_LED_PCA9685LED_I2C_External:
ADD_BACKEND(new PCA9685LED_I2C()); ADD_BACKEND(new PCA9685LED_I2C());
break; break;
#endif
case Notify_LED_NeoPixel: case Notify_LED_NeoPixel:
ADD_BACKEND(new NeoPixel()); ADD_BACKEND(new NeoPixel());
break; break;

View File

@ -16,3 +16,7 @@
#ifndef AP_NOTIFY_NCP5623_ENABLED #ifndef AP_NOTIFY_NCP5623_ENABLED
#define AP_NOTIFY_NCP5623_ENABLED 1 #define AP_NOTIFY_NCP5623_ENABLED 1
#endif #endif
#ifndef AP_NOTIFY_PCA9685_ENABLED
#define AP_NOTIFY_PCA9685_ENABLED 1
#endif

View File

@ -17,6 +17,8 @@
*/ */
#include "PCA9685LED_I2C.h" #include "PCA9685LED_I2C.h"
#if AP_NOTIFY_PCA9685_ENABLED
#include <AP_HAL/AP_HAL.h> #include <AP_HAL/AP_HAL.h>
#define NAVIO_LED_BRIGHT 0x0 // full brightness #define NAVIO_LED_BRIGHT 0x0 // full brightness
@ -110,3 +112,5 @@ void PCA9685LED_I2C::_timer(void)
_dev->transfer(transaction, sizeof(transaction), nullptr, 0); _dev->transfer(transaction, sizeof(transaction), nullptr, 0);
} }
#endif // AP_NOTIFY_PCA9685_ENABLED

View File

@ -19,6 +19,8 @@
#include <AP_HAL/I2CDevice.h> #include <AP_HAL/I2CDevice.h>
#include "RGBLed.h" #include "RGBLed.h"
#if AP_NOTIFY_PCA9685_ENABLED
class PCA9685LED_I2C : public RGBLed class PCA9685LED_I2C : public RGBLed
{ {
public: public:
@ -35,3 +37,5 @@ private:
} rgb; } rgb;
bool _need_update; bool _need_update;
}; };
#endif // AP_NOTIFY_PCA9685_ENABLED