AP_Periph: adjust for updated LED API

This commit is contained in:
Andrew Tridgell 2020-02-09 21:36:34 +11:00 committed by Randy Mackay
parent 434ad4e990
commit f42fad8c1e
2 changed files with 3 additions and 4 deletions

View File

@ -124,7 +124,7 @@ static void update_rainbow()
uint32_t now = AP_HAL::millis();
if (now-start_ms > 1500) {
rainbow_done = true;
hal.rcout->set_neopixel_rgb_data(HAL_PERIPH_NEOPIXEL_CHAN, 0xFF, 0, 0, 0);
hal.rcout->set_neopixel_rgb_data(HAL_PERIPH_NEOPIXEL_CHAN, -1, 0, 0, 0);
hal.rcout->neopixel_send();
return;
}
@ -153,7 +153,7 @@ static void update_rainbow()
float brightness = 0.3;
for (uint8_t n=0; n<8; n++) {
uint8_t i = (step + n) % nsteps;
hal.rcout->set_neopixel_rgb_data(HAL_PERIPH_NEOPIXEL_CHAN, 1U<<n,
hal.rcout->set_neopixel_rgb_data(HAL_PERIPH_NEOPIXEL_CHAN, n,
rgb_rainbow[i].red*brightness,
rgb_rainbow[i].green*brightness,
rgb_rainbow[i].blue*brightness);

View File

@ -476,8 +476,7 @@ static void handle_safety_state(CanardInstance* ins, CanardRxTransfer* transfer)
static void set_rgb_led(uint8_t red, uint8_t green, uint8_t blue)
{
#ifdef HAL_PERIPH_NEOPIXEL_COUNT
hal.rcout->set_neopixel_rgb_data(HAL_PERIPH_NEOPIXEL_CHAN, (1U<<HAL_PERIPH_NEOPIXEL_COUNT)-1,
red, green, blue);
hal.rcout->set_neopixel_rgb_data(HAL_PERIPH_NEOPIXEL_CHAN, -1, red, green, blue);
hal.rcout->neopixel_send();
#endif // HAL_PERIPH_NEOPIXEL_COUNT
#ifdef HAL_PERIPH_ENABLE_NCP5623_LED