AP_Periph: adjust for updated LED API

This commit is contained in:
Andrew Tridgell 2020-02-09 21:36:34 +11:00
parent e582432a2f
commit d83f380521
2 changed files with 3 additions and 4 deletions

View File

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

View File

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