From 6172d3a71d2804f17aa57ed4acc6b3eedb461b82 Mon Sep 17 00:00:00 2001 From: Peter Hall <33176108+IamPete1@users.noreply.github.com> Date: Tue, 10 Mar 2020 22:45:09 +0000 Subject: [PATCH] AP_Periph: update to new NeoPixel API --- Tools/AP_Periph/AP_Periph.cpp | 12 ++++++------ Tools/AP_Periph/can.cpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Tools/AP_Periph/AP_Periph.cpp b/Tools/AP_Periph/AP_Periph.cpp index d0e7176d05..fdb81fc80e 100644 --- a/Tools/AP_Periph/AP_Periph.cpp +++ b/Tools/AP_Periph/AP_Periph.cpp @@ -93,7 +93,7 @@ void AP_Periph_FW::init() #ifdef HAL_PERIPH_NEOPIXEL_COUNT hal.rcout->init(); - hal.rcout->set_neopixel_num_LEDs(HAL_PERIPH_NEOPIXEL_CHAN, HAL_PERIPH_NEOPIXEL_COUNT); + hal.rcout->set_serial_led_num_LEDs(HAL_PERIPH_NEOPIXEL_CHAN, AP_HAL::RCOutput::MODE_NEOPIXEL); #endif #ifdef HAL_PERIPH_ENABLE_ADSB @@ -124,8 +124,8 @@ 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, -1, 0, 0, 0); - hal.rcout->neopixel_send(); + hal.rcout->set_serial_led_rgb_data(HAL_PERIPH_NEOPIXEL_CHAN, -1, 0, 0, 0); + hal.rcout->serial_led_send(HAL_PERIPH_NEOPIXEL_CHAN); return; } static uint32_t last_update_ms; @@ -153,13 +153,13 @@ 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, n, + hal.rcout->set_serial_led_rgb_data(HAL_PERIPH_NEOPIXEL_CHAN, n, rgb_rainbow[i].red*brightness, rgb_rainbow[i].green*brightness, rgb_rainbow[i].blue*brightness); } step++; - hal.rcout->neopixel_send(); + hal.rcout->serial_led_send(HAL_PERIPH_NEOPIXEL_CHAN); } #endif @@ -187,7 +187,7 @@ void AP_Periph_FW::update() show_stack_usage(); #endif #ifdef HAL_PERIPH_NEOPIXEL_COUNT - hal.rcout->set_neopixel_num_LEDs(HAL_PERIPH_NEOPIXEL_CHAN, HAL_PERIPH_NEOPIXEL_COUNT); + hal.rcout->set_serial_led_num_LEDs(HAL_PERIPH_NEOPIXEL_CHAN, HAL_PERIPH_NEOPIXEL_COUNT, AP_HAL::RCOutput::MODE_NEOPIXEL); #endif } can_update(); diff --git a/Tools/AP_Periph/can.cpp b/Tools/AP_Periph/can.cpp index 794b78c948..54f3ab77c1 100644 --- a/Tools/AP_Periph/can.cpp +++ b/Tools/AP_Periph/can.cpp @@ -476,8 +476,8 @@ 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, -1, red, green, blue); - hal.rcout->neopixel_send(); + hal.rcout->set_serial_led_rgb_data(HAL_PERIPH_NEOPIXEL_CHAN, -1, red, green, blue); + hal.rcout->serial_led_send(HAL_PERIPH_NEOPIXEL_CHAN); #endif // HAL_PERIPH_NEOPIXEL_COUNT #ifdef HAL_PERIPH_ENABLE_NCP5623_LED {