2020-08-03 00:24:27 -03:00
|
|
|
#include "SIM_I2CDevice.h"
|
|
|
|
|
|
|
|
namespace SITL {
|
|
|
|
|
2020-11-12 00:19:13 -04:00
|
|
|
class ToshibaLEDDevReg : public I2CRegEnum {
|
|
|
|
public:
|
|
|
|
static constexpr uint8_t PWM0 = 0x01;
|
|
|
|
static constexpr uint8_t PWM1 = 0x02;
|
|
|
|
static constexpr uint8_t PWM2 = 0x03;
|
|
|
|
static constexpr uint8_t ENABLE = 0x04;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ToshibaLED : public I2CDevice, protected I2CRegisters_8Bit
|
2020-08-03 00:24:27 -03:00
|
|
|
{
|
|
|
|
public:
|
2020-11-12 00:19:13 -04:00
|
|
|
void init() override {
|
|
|
|
add_register("PWM0", ToshibaLEDDevReg::PWM0, O_WRONLY);
|
|
|
|
add_register("PWM1", ToshibaLEDDevReg::PWM1, O_WRONLY);
|
|
|
|
add_register("PWM2", ToshibaLEDDevReg::PWM2, O_WRONLY);
|
|
|
|
add_register("ENABLE", ToshibaLEDDevReg::ENABLE, O_WRONLY);
|
|
|
|
}
|
|
|
|
|
|
|
|
void update(const class Aircraft &aircraft) override;
|
|
|
|
|
|
|
|
int rdwr(I2C::i2c_rdwr_ioctl_data *&data) override {
|
|
|
|
return I2CRegisters_8Bit::rdwr(data);
|
|
|
|
}
|
|
|
|
|
2020-08-03 00:24:27 -03:00
|
|
|
private:
|
2020-11-12 00:19:13 -04:00
|
|
|
uint8_t last_print_pwm0;
|
|
|
|
uint8_t last_print_pwm1;
|
|
|
|
uint8_t last_print_pwm2;
|
|
|
|
uint8_t last_print_enable;
|
2020-08-03 00:24:27 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace SITL
|