![]() |
EduArt Sensor Ring Library 4.0.0
|
Device wrapper for WS2812b LED strips controlled via the sensorring bus. More...
#include <WS2812b_Device.hpp>
Public Member Functions | |
| WS2812b_Device (WS2812b_Params params, com::ComInterfaceID interface, unsigned int idx) | |
| Construct a new WS2812b device instance. | |
| bool | configure () override |
| Re-apply runtime configuration after board reset. | |
| bool | setDistanceMapRange (double lower_m, double upper_m) |
| Set the distance map range in meters and verify it by reading it back. | |
| bool | getDistanceMapRange (double &lower_m, double &upper_m) |
| Read the current distance map range from the board in meters. | |
| bool | setDistanceMapMaxBrightness (std::int64_t brightness) |
| Set distance map peak channel brightness and verify it by reading it back. | |
| bool | getDistanceMapMaxBrightness (std::int64_t &brightness) |
| Read the current distance map peak channel brightness from the board. | |
| const WS2812b_Params & | getParams () const override |
| Get the parameters used to configure this device. | |
| void | setLight (LightMode mode, std::uint8_t r, std::uint8_t g, std::uint8_t b) override |
| Set the light mode and color. Enqueues a per-device CAN command into the action queue. | |
| Public Member Functions inherited from eduart::sensorring::device::Light | |
| Light (DeviceID id, com::ComInterface *interface, com::ComEndpoint target) | |
| Construct a Light with Device params. | |
| ~Light () override=default | |
| Virtual destructor. | |
| Public Member Functions inherited from eduart::sensorring::device::Device | |
| Device (DeviceID id, com::ComInterface *interface, com::ComEndpoint target) | |
| Construct the device with identity and communication link. | |
| DeviceID | getDeviceID () const |
| Return the full device identifier (type + index). | |
| unsigned int | getHwIdx () const |
| Return the zero-based hardware board index on its bus (used for CAN addressing and protocol bitmasks). | |
| void | setDeviceIndex (unsigned int index) |
| Reassign the logical device index (DeviceID.index) without changing the hardware index. | |
| void | setBoardContext (const board::SensorBoardParams *board_params) |
| Initialize board-level context pointer (non-owning). | |
| const board::SensorBoardParams * | getBoardContext () const |
| Return the board-level context pointer (non-owning). | |
| void | setPoseOffset (const math::Pose &offset) |
| Store a pose offset relative to the board centre. | |
| math::Pose | getPoseOffset () const |
| Return the stored pose offset relative to the board centre. | |
| math::Pose | getGlobalPose () const |
| Compute and return the global pose in the ring coordinate frame. | |
| Public Member Functions inherited from eduart::sensorring::ActionDispatcher | |
| void | setQueue (ActionQueue *queue) |
| void | clearQueue () |
| bool | isManaged () const |
| void | execute (Action action) |
| void | execute (std::string_view key, Action action) |
Static Public Member Functions | |
| static void | syncLight () |
| Synchronize pending light updates on all WS2812b devices. | |
| Static Public Member Functions inherited from eduart::sensorring::device::Light | |
| static void | setAllLights (const std::vector< Light * > &devices, LightMode mode, std::uint8_t red, std::uint8_t green, std::uint8_t blue) |
| Broadcast a mode+color command to ALL WS2812b devices on ALL interfaces. | |
| Static Public Member Functions inherited from eduart::sensorring::ActionDispatcher | |
| static void | globalExecute (Action action) |
Protected Member Functions | |
| WS2812b_Device (WS2812b_Params params, com::ComInterface *interface, unsigned int idx) | |
| Construct with a non-owning communication interface supplied by a subclass. | |
| Protected Member Functions inherited from eduart::sensorring::device::Device | |
| virtual void | comCallback (const com::ComEndpoint source, std::uint8_t command, const std::vector< std::uint8_t > &data)=0 |
Additional Inherited Members | |
| Protected Attributes inherited from eduart::sensorring::device::Device | |
| DeviceID | _id |
| unsigned int | _hw_idx |
| com::ComInterface * | _interface |
| const board::SensorBoardParams * | _board_params = nullptr |
| math::Pose | _offset |
| subscription::Subscription | _com_subscription |
Device wrapper for WS2812b LED strips controlled via the sensorring bus.
| eduart::sensorring::device::WS2812b_Device::WS2812b_Device | ( | WS2812b_Params | params, |
| com::ComInterfaceID | interface, | ||
| unsigned int | idx ) |
Construct a new WS2812b device instance.
| [in] | params | LED strip configuration parameters. |
| [in] | interface | Communication interface used to talk to the device. |
| [in] | idx | Index of the device on the bus. |
|
overridevirtual |
Re-apply runtime configuration after board reset.
Reimplemented from eduart::sensorring::device::Device.
| bool eduart::sensorring::device::WS2812b_Device::getDistanceMapMaxBrightness | ( | std::int64_t & | brightness | ) |
Read the current distance map peak channel brightness from the board.
| [out] | brightness | Current brightness, unchanged on failure. |
| bool eduart::sensorring::device::WS2812b_Device::getDistanceMapRange | ( | double & | lower_m, |
| double & | upper_m ) |
Read the current distance map range from the board in meters.
| [out] | lower_m | Lower distance threshold, unchanged on failure. |
| [out] | upper_m | Upper distance threshold, unchanged on failure. |
|
inlineoverridevirtual |
Get the parameters used to configure this device.
Implements eduart::sensorring::device::Light.
| bool eduart::sensorring::device::WS2812b_Device::setDistanceMapMaxBrightness | ( | std::int64_t | brightness | ) |
Set distance map peak channel brightness and verify it by reading it back.
| [in] | brightness | Integer brightness in [0, 255]. |
| bool eduart::sensorring::device::WS2812b_Device::setDistanceMapRange | ( | double | lower_m, |
| double | upper_m ) |
Set the distance map range in meters and verify it by reading it back.
|
overridevirtual |
Set the light mode and color. Enqueues a per-device CAN command into the action queue.
| [in] | mode | Light mode to apply. |
| [in] | r | Red channel (0-255). |
| [in] | g | Green channel (0-255). |
| [in] | b | Blue channel (0-255). |
Implements eduart::sensorring::device::Light.