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

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "SIM_config.h"
       4             : 
       5             : #if AP_SIM_TOSHIBALED_ENABLED
       6             : 
       7             : #include "SIM_RGBLED.h"
       8             : #include "SIM_I2CDevice.h"
       9             : 
      10             : namespace SITL {
      11             : 
      12             : class ToshibaLEDDevReg : public I2CRegEnum {
      13             : public:
      14             :     static constexpr uint8_t PWM0 = 0x01;
      15             :     static constexpr uint8_t PWM1 = 0x02;
      16             :     static constexpr uint8_t PWM2 = 0x03;
      17             :     static constexpr uint8_t ENABLE = 0x04;
      18             : };
      19             : 
      20             : class ToshibaLED : public I2CDevice, protected I2CRegisters_8Bit
      21             : {
      22             : public:
      23        2094 :     void init() override {
      24        2094 :         rgbled.init();
      25             : 
      26        2094 :         add_register("PWM0", ToshibaLEDDevReg::PWM0, I2CRegisters::RegMode::WRONLY);
      27        2094 :         add_register("PWM1", ToshibaLEDDevReg::PWM1, I2CRegisters::RegMode::WRONLY);
      28        2094 :         add_register("PWM2", ToshibaLEDDevReg::PWM2, I2CRegisters::RegMode::WRONLY);
      29        2094 :         add_register("ENABLE", ToshibaLEDDevReg::ENABLE, I2CRegisters::RegMode::WRONLY);
      30        2094 :     }
      31             : 
      32             :     void update(const class Aircraft &aircraft) override;
      33             : 
      34      368169 :     int rdwr(I2C::i2c_rdwr_ioctl_data *&data) override {
      35      368169 :         return I2CRegisters_8Bit::rdwr(data);
      36             :     }
      37             : 
      38             : private:
      39             :     uint8_t last_print_pwm0;
      40             :     uint8_t last_print_pwm1;
      41             :     uint8_t last_print_pwm2;
      42             :     uint8_t last_print_enable;
      43             : 
      44             :     SIM_RGBLED rgbled{"ToshibaLED"};
      45             : };
      46             : 
      47             : } // namespace SITL
      48             : 
      49             : #endif  // AP_SIM_TOSHIBALED_ENABLED

Generated by: LCOV version 1.14