SITL: make ToshibaLED simulator optional

This commit is contained in:
Peter Barker 2021-10-11 16:06:06 +11:00 committed by Peter Barker
parent d0872abdf9
commit 1abef3275e
3 changed files with 18 additions and 0 deletions

View File

@ -49,7 +49,9 @@ public:
};
static IgnoredI2CDevice ignored;
#if AP_SIM_TOSHIBALED_ENABLED
static ToshibaLED toshibaled;
#endif
static MaxSonarI2CXL maxsonari2cxl;
static MaxSonarI2CXL maxsonari2cxl_2;
static Maxell maxell;
@ -70,7 +72,9 @@ struct i2c_device_at_address {
{ 0, 0x60, mcp9600 }, // 0x60 is low address
{ 0, 0x71, maxsonari2cxl_2 },
{ 1, 0x01, icm40609 },
#if AP_SIM_TOSHIBALED_ENABLED
{ 1, 0x55, toshibaled },
#endif
{ 1, 0x38, ignored }, // NCP5623
{ 1, 0x39, ignored }, // NCP5623C
{ 1, 0x40, ignored }, // KellerLD

View File

@ -1,5 +1,7 @@
#include "SIM_ToshibaLED.h"
#if AP_SIM_TOSHIBALED_ENABLED
#include <stdio.h>
void SITL::ToshibaLED::update(const class Aircraft &aircraft)
@ -17,3 +19,5 @@ void SITL::ToshibaLED::update(const class Aircraft &aircraft)
last_print_enable = get_register(ToshibaLEDDevReg::ENABLE);
// gcs().send_text(MAV_SEVERITY_INFO, "SIM_ToshibaLED: PWM0=%u PWM1=%u PWM2=%u ENABLE=%u", last_print_pwm0, last_print_pwm1, last_print_pwm2, last_print_enable);
}
#endif

View File

@ -1,5 +1,13 @@
#include "SIM_I2CDevice.h"
#include <AP_HAL/AP_HAL_Boards.h>
#ifndef AP_SIM_TOSHIBALED_ENABLED
#define AP_SIM_TOSHIBALED_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif
#if AP_SIM_TOSHIBALED_ENABLED
namespace SITL {
class ToshibaLEDDevReg : public I2CRegEnum {
@ -34,3 +42,5 @@ private:
};
} // namespace SITL
#endif // AP_SIM_TOSHIBALED_ENABLED