LCOV - code coverage report
Current view: top level - AP_SerialLED - AP_SerialLED.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 2 0.0 %
Date: 2026-09-09 11:02:08 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /*
       2             :    This program is free software: you can redistribute it and/or modify
       3             :    it under the terms of the GNU General Public License as published by
       4             :    the Free Software Foundation, either version 3 of the License, or
       5             :    (at your option) any later version.
       6             : 
       7             :    This program is distributed in the hope that it will be useful,
       8             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
       9             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      10             :    GNU General Public License for more details.
      11             : 
      12             :    You should have received a copy of the GNU General Public License
      13             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      14             :  */
      15             : /*
      16             :   AP_SerialLED for controlling serial connected LEDs using WS2812B protocol
      17             :  */
      18             : #pragma once
      19             : 
      20             : #include <AP_HAL/AP_HAL_Boards.h>
      21             : #include <AP_HAL/RCOutput.h>
      22             : 
      23             : #include "AP_SerialLED_config.h"
      24             : 
      25             : #if AP_SERIALLED_ENABLED
      26             : 
      27             : #include <stdint.h>
      28             : 
      29             : // limit number of LEDs, mostly to keep DMA memory consumption within
      30             : // reasonable bounds
      31             : #define AP_SERIALLED_MAX_LEDS 128
      32             : 
      33             : class AP_SerialLED {
      34             : public:
      35             :     // set number of LEDs per pin
      36             :     bool set_num_neopixel(uint8_t chan, uint8_t num_leds);
      37             :     bool set_num_profiled(uint8_t chan, uint8_t num_leds);
      38             :     // set number of LEDs per pin in RGB mode
      39             :     bool set_num_neopixel_rgb(uint8_t chan, uint8_t num_leds);
      40             : 
      41             :     // set RGB value on mask of LEDs. chan is PWM output, 1..16
      42             :     void set_RGB_mask(uint8_t chan, uint32_t ledmask, uint8_t red, uint8_t green, uint8_t blue);
      43             : 
      44             :     // set RGB value on LED. LED -1 is all LEDs. LED 0 is first LED. chan is PWM output, 1..16
      45             :     bool set_RGB(uint8_t chan, int8_t led, uint8_t red, uint8_t green, uint8_t blue);
      46             : 
      47             :     // trigger sending of LED changes to LEDs
      48             :     bool send(uint8_t chan);
      49             : 
      50             :     // singleton support
      51           0 :     static AP_SerialLED *get_singleton(void) {
      52           0 :         return &singleton;
      53             :     }
      54             : 
      55             : private:
      56             :     static AP_SerialLED singleton;
      57             : };
      58             : 
      59             : #endif  // AP_SERIALLED_ENABLED

Generated by: LCOV version 1.14