mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-02 14:08:45 -04:00
AP_Notify: allow ChibiOS to use PixracerLED driver
This commit is contained in:
parent
66608e8cad
commit
0fdef97c76
@ -220,8 +220,17 @@ void AP_Notify::add_backends(void)
|
||||
ADD_BACKEND(new ToneAlarm_Linux());
|
||||
#endif
|
||||
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
|
||||
#ifdef HAL_HAVE_PIXRACER_LED
|
||||
ADD_BACKEND(new PixRacerLED());
|
||||
#else
|
||||
ADD_BACKEND(new AP_BoardLED());
|
||||
#endif
|
||||
ADD_BACKEND(new ToshibaLED_I2C(TOSHIBA_LED_I2C_BUS_EXTERNAL));
|
||||
ADD_BACKEND(new ToshibaLED_I2C(TOSHIBA_LED_I2C_BUS_INTERNAL));
|
||||
ADD_BACKEND(new Display());
|
||||
#lese
|
||||
ADD_BACKEND(new AP_BoardLED());
|
||||
ADD_BACKEND(new ToshibaLED_I2C(TOSHIBA_LED_I2C_BUS_EXTERNAL));
|
||||
ADD_BACKEND(new ToshibaLED_I2C(TOSHIBA_LED_I2C_BUS_INTERNAL));
|
||||
ADD_BACKEND(new Display());
|
||||
|
@ -21,23 +21,23 @@
|
||||
extern const AP_HAL::HAL& hal;
|
||||
|
||||
PixRacerLED::PixRacerLED() :
|
||||
RGBLed(0, 1, 1, 1)
|
||||
RGBLed(0, HAL_GPIO_LED_OFF, HAL_GPIO_LED_OFF, HAL_GPIO_LED_OFF)
|
||||
{
|
||||
}
|
||||
|
||||
bool PixRacerLED::hw_init(void)
|
||||
{
|
||||
hal.gpio->write(HAL_GPIO_A_LED_PIN, 0);
|
||||
hal.gpio->write(HAL_GPIO_B_LED_PIN, 0);
|
||||
hal.gpio->write(HAL_GPIO_C_LED_PIN, 0);
|
||||
hal.gpio->write(HAL_GPIO_A_LED_PIN, HAL_GPIO_LED_OFF);
|
||||
hal.gpio->write(HAL_GPIO_B_LED_PIN, HAL_GPIO_LED_OFF);
|
||||
hal.gpio->write(HAL_GPIO_C_LED_PIN, HAL_GPIO_LED_OFF);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PixRacerLED::hw_set_rgb(uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
hal.gpio->write(HAL_GPIO_A_LED_PIN, (r > 0));
|
||||
hal.gpio->write(HAL_GPIO_B_LED_PIN, (g > 0));
|
||||
hal.gpio->write(HAL_GPIO_C_LED_PIN, (b > 0));
|
||||
hal.gpio->write(HAL_GPIO_A_LED_PIN, (r > 0)?HAL_GPIO_LED_ON:HAL_GPIO_LED_OFF);
|
||||
hal.gpio->write(HAL_GPIO_B_LED_PIN, (g > 0)?HAL_GPIO_LED_ON:HAL_GPIO_LED_OFF);
|
||||
hal.gpio->write(HAL_GPIO_C_LED_PIN, (b > 0)?HAL_GPIO_LED_ON:HAL_GPIO_LED_OFF);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user