mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-06 06:43:21 +08:00
rgbled:Allow I2C and PWM rgb led drivers to be used on the same board
Added RGBLED_PWM0_DEVICE_PATH path Renamed the main of the PWM rgbled driver to create a seperate command
This commit is contained in:
@@ -57,4 +57,6 @@
|
||||
// set the queue size to the number of LED's, so that each led can be controlled individually
|
||||
static const int LED_UORB_QUEUE_LENGTH = BOARD_MAX_LEDS;
|
||||
|
||||
#define RGBLED0_DEVICE_PATH "/dev/rgbled0"
|
||||
// Legacy paths - 2 are need to allow both pwm and i2c drviers to co-exist
|
||||
#define RGBLED0_DEVICE_PATH "/dev/rgbled0" // Primary RGB LED on i2c
|
||||
#define RGBLED_PWM0_DEVICE_PATH "/dev/rgbled_pwm0" // Secondary RGB LED on PWM
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE drivers__rgbled_pwm
|
||||
MAIN rgbled
|
||||
MAIN rgbled_pwm
|
||||
COMPILE_FLAGS
|
||||
SRCS
|
||||
rgbled_pwm.cpp
|
||||
|
||||
@@ -101,7 +101,7 @@ private:
|
||||
int get(bool &on, bool &powersave, uint8_t &r, uint8_t &g, uint8_t &b);
|
||||
};
|
||||
|
||||
extern "C" __EXPORT int rgbled_main(int argc, char *argv[]);
|
||||
extern "C" __EXPORT int rgbled_pwm_main(int argc, char *argv[]);
|
||||
extern int led_pwm_servo_set(unsigned channel, uint8_t value);
|
||||
extern unsigned led_pwm_servo_get(unsigned channel);
|
||||
extern int led_pwm_servo_init(void);
|
||||
@@ -114,10 +114,8 @@ namespace
|
||||
RGBLED_PWM *g_rgbled = nullptr;
|
||||
}
|
||||
|
||||
void rgbled_usage();
|
||||
|
||||
RGBLED_PWM::RGBLED_PWM() :
|
||||
CDev("rgbled", RGBLED0_DEVICE_PATH),
|
||||
CDev("rgbled_pwm", RGBLED_PWM0_DEVICE_PATH),
|
||||
_work{},
|
||||
_r(0),
|
||||
_g(0),
|
||||
@@ -282,14 +280,14 @@ RGBLED_PWM::get(bool &on, bool &powersave, uint8_t &r, uint8_t &g, uint8_t &b)
|
||||
return OK;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
rgbled_usage()
|
||||
{
|
||||
PX4_INFO("missing command: try 'start', 'status', 'stop'");
|
||||
}
|
||||
|
||||
int
|
||||
rgbled_main(int argc, char *argv[])
|
||||
rgbled_pwm_main(int argc, char *argv[])
|
||||
{
|
||||
int ch;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user