36 #include <uavcan/equipment/indication/LightsCommand.hpp> 41 unsigned self_light_index = 0;
43 void cb_light_command(
const uavcan::ReceivedDataStructure<uavcan::equipment::indication::LightsCommand> &
msg)
45 uavcan::uint32_t red = 0;
46 uavcan::uint32_t green = 0;
47 uavcan::uint32_t blue = 0;
49 for (
auto &cmd : msg.commands) {
50 if (cmd.light_id == self_light_index) {
51 using uavcan::equipment::indication::RGB565;
53 red = uavcan::uint32_t(
float(cmd.color.red) *
56 green = uavcan::uint32_t(
float(cmd.color.green) *
59 blue = uavcan::uint32_t(
float(cmd.color.blue) *
62 red = uavcan::min<uavcan::uint32_t>(red, 0xFFU);
63 green = uavcan::min<uavcan::uint32_t>(green, 0xFFU);
64 blue = uavcan::min<uavcan::uint32_t>(blue, 0xFFU);
72 static uavcan::Subscriber<uavcan::equipment::indication::LightsCommand> sub_light(node);
78 res = sub_light.start(cb_light_command);
static char msg[NUM_MSG][CONFIG_USART1_TXBUFSIZE]
int init_indication_controller(uavcan::INode &node)
constexpr _Tp max(_Tp a, _Tp b)