mirror of https://github.com/ArduPilot/ardupilot
AP_Notify: add support for NeoPixelRGB via set_num_neopixel_rgb()
This commit is contained in:
parent
c91ca2d87a
commit
1035ac76b2
|
@ -207,7 +207,7 @@ const AP_Param::GroupInfo AP_Notify::var_info[] = {
|
||||||
// @Param: LED_TYPES
|
// @Param: LED_TYPES
|
||||||
// @DisplayName: LED Driver Types
|
// @DisplayName: LED Driver Types
|
||||||
// @Description: Controls what types of LEDs will be enabled
|
// @Description: Controls what types of LEDs will be enabled
|
||||||
// @Bitmask: 0:Built-in LED, 1:Internal ToshibaLED, 2:External ToshibaLED, 3:External PCA9685, 4:Oreo LED, 5:DroneCAN, 6:NCP5623 External, 7:NCP5623 Internal, 8:NeoPixel, 9:ProfiLED, 10:Scripting, 11:DShot, 12:ProfiLED_SPI, 13:LP5562 External, 14: LP5562 Internal, 17: DiscreteRGB
|
// @Bitmask: 0:Built-in LED, 1:Internal ToshibaLED, 2:External ToshibaLED, 3:External PCA9685, 4:Oreo LED, 5:DroneCAN, 6:NCP5623 External, 7:NCP5623 Internal, 8:NeoPixel, 9:ProfiLED, 10:Scripting, 11:DShot, 12:ProfiLED_SPI, 13:LP5562 External, 14: LP5562 Internal, 17: DiscreteRGB, 18: NeoPixelRGB
|
||||||
// @User: Advanced
|
// @User: Advanced
|
||||||
AP_GROUPINFO("LED_TYPES", 6, AP_Notify, _led_type, DEFAULT_NTF_LED_TYPES),
|
AP_GROUPINFO("LED_TYPES", 6, AP_Notify, _led_type, DEFAULT_NTF_LED_TYPES),
|
||||||
|
|
||||||
|
@ -339,6 +339,7 @@ void AP_Notify::add_backends(void)
|
||||||
#endif
|
#endif
|
||||||
#if AP_NOTIFY_NEOPIXEL_ENABLED
|
#if AP_NOTIFY_NEOPIXEL_ENABLED
|
||||||
case Notify_LED_NeoPixel:
|
case Notify_LED_NeoPixel:
|
||||||
|
case Notify_LED_NeoPixelRGB:
|
||||||
ADD_BACKEND(new NeoPixel());
|
ADD_BACKEND(new NeoPixel());
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -96,6 +96,9 @@ public:
|
||||||
#endif
|
#endif
|
||||||
#if AP_NOTIFY_DISCRETE_RGB_ENABLED
|
#if AP_NOTIFY_DISCRETE_RGB_ENABLED
|
||||||
Notify_LED_DiscreteRGB = (1 << 17), // DiscreteRGB
|
Notify_LED_DiscreteRGB = (1 << 17), // DiscreteRGB
|
||||||
|
#endif
|
||||||
|
#if AP_NOTIFY_NEOPIXEL_ENABLED
|
||||||
|
Notify_LED_NeoPixelRGB = (1 << 18), // NeoPixel AdaFruit 4544 Worldsemi WS2811
|
||||||
#endif
|
#endif
|
||||||
Notify_LED_MAX
|
Notify_LED_MAX
|
||||||
};
|
};
|
||||||
|
@ -213,6 +216,7 @@ public:
|
||||||
uint8_t get_buzz_level() const { return _buzzer_level; }
|
uint8_t get_buzz_level() const { return _buzzer_level; }
|
||||||
uint8_t get_buzz_volume() const { return _buzzer_volume; }
|
uint8_t get_buzz_volume() const { return _buzzer_volume; }
|
||||||
uint8_t get_led_len() const { return _led_len; }
|
uint8_t get_led_len() const { return _led_len; }
|
||||||
|
uint32_t get_led_type() const { return _led_type; }
|
||||||
int8_t get_rgb_led_brightness_percent() const;
|
int8_t get_rgb_led_brightness_percent() const;
|
||||||
|
|
||||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
||||||
|
|
|
@ -61,7 +61,11 @@ uint16_t NeoPixel::init_ports()
|
||||||
|
|
||||||
for (uint16_t chan=0; chan<16; chan++) {
|
for (uint16_t chan=0; chan<16; chan++) {
|
||||||
if ((1U<<chan) & mask) {
|
if ((1U<<chan) & mask) {
|
||||||
led->set_num_neopixel(chan+1, (pNotify->get_led_len()));
|
if (pNotify->get_led_type() & AP_Notify::Notify_LED_NeoPixel) {
|
||||||
|
led->set_num_neopixel(chan+1, pNotify->get_led_len());
|
||||||
|
} else if (pNotify->get_led_type() & AP_Notify::Notify_LED_NeoPixelRGB) {
|
||||||
|
led->set_num_neopixel_rgb(chan+1, pNotify->get_led_len());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue