|
|
|
@ -84,4 +84,45 @@ void RCOutput::push(void)
@@ -84,4 +84,45 @@ void RCOutput::push(void)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Serial LED emulation |
|
|
|
|
*/ |
|
|
|
|
bool RCOutput::set_neopixel_num_LEDs(const uint16_t chan, uint8_t num_leds) |
|
|
|
|
{ |
|
|
|
|
if (chan > 15 || num_leds > 32) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
SITL::SITL *sitl = AP::sitl(); |
|
|
|
|
if (sitl) { |
|
|
|
|
sitl->led.num_leds[chan] = num_leds; |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void RCOutput::set_neopixel_rgb_data(const uint16_t chan, uint32_t ledmask, uint8_t red, uint8_t green, uint8_t blue) |
|
|
|
|
{ |
|
|
|
|
if (chan > 15) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
SITL::SITL *sitl = AP::sitl(); |
|
|
|
|
if (sitl) { |
|
|
|
|
for (uint8_t i=0; i<32; i++) { |
|
|
|
|
if ((1U<<i) & ledmask) { |
|
|
|
|
sitl->led.rgb[chan][i].rgb[0] = red; |
|
|
|
|
sitl->led.rgb[chan][i].rgb[1] = green; |
|
|
|
|
sitl->led.rgb[chan][i].rgb[2] = blue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void RCOutput::neopixel_send(void) |
|
|
|
|
{ |
|
|
|
|
SITL::SITL *sitl = AP::sitl(); |
|
|
|
|
if (sitl) { |
|
|
|
|
sitl->led.send_counter++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|