diff --git a/libraries/AP_SerialLED/AP_SerialLED.cpp b/libraries/AP_SerialLED/AP_SerialLED.cpp index ca1d837796..fafccd2af2 100644 --- a/libraries/AP_SerialLED/AP_SerialLED.cpp +++ b/libraries/AP_SerialLED/AP_SerialLED.cpp @@ -36,6 +36,15 @@ bool AP_SerialLED::set_num_neopixel(uint8_t chan, uint8_t num_leds) return false; } +// set number of NeoPixels per pin in RGB mode +bool AP_SerialLED::set_num_neopixel_rgb(uint8_t chan, uint8_t num_leds) +{ + if (chan >= 1 && chan <= 16 && num_leds <= AP_SERIALLED_MAX_LEDS) { + return hal.rcout->set_serial_led_num_LEDs(chan-1, num_leds, AP_HAL::RCOutput::MODE_NEOPIXELRGB); + } + return false; +} + // set number of ProfiLEDs per pin bool AP_SerialLED::set_num_profiled(uint8_t chan, uint8_t num_leds) { diff --git a/libraries/AP_SerialLED/AP_SerialLED.h b/libraries/AP_SerialLED/AP_SerialLED.h index 8f83c887ab..4ec45ab8d5 100644 --- a/libraries/AP_SerialLED/AP_SerialLED.h +++ b/libraries/AP_SerialLED/AP_SerialLED.h @@ -18,6 +18,7 @@ #pragma once #include +#include #include "AP_SerialLED_config.h" @@ -34,13 +35,15 @@ public: // set number of LEDs per pin bool set_num_neopixel(uint8_t chan, uint8_t num_leds); bool set_num_profiled(uint8_t chan, uint8_t num_leds); + // set number of LEDs per pin in RGB mode + bool set_num_neopixel_rgb(uint8_t chan, uint8_t num_leds); // set RGB value on mask of LEDs. chan is PWM output, 1..16 void set_RGB_mask(uint8_t chan, uint32_t ledmask, uint8_t red, uint8_t green, uint8_t blue); // set RGB value on LED. LED -1 is all LEDs. LED 0 is first LED. chan is PWM output, 1..16 void set_RGB(uint8_t chan, int8_t led, uint8_t red, uint8_t green, uint8_t blue); - + // trigger sending of LED changes to LEDs void send(uint8_t chan);