2020-07-12 20:27:56 +02:00
|
|
|
#ifndef LEDEVICELPD6803_H
|
|
|
|
#define LEDEVICELPD6803_H
|
2016-05-26 23:44:27 +02:00
|
|
|
|
2020-02-10 15:21:58 +01:00
|
|
|
// Local hyperion includes
|
2016-08-28 07:12:48 +02:00
|
|
|
#include "ProviderSpi.h"
|
2016-05-26 23:44:27 +02:00
|
|
|
|
|
|
|
///
|
2020-07-12 20:27:56 +02:00
|
|
|
/// Implementation of the LedDevice interface for writing to LDP6803 LED-device.
|
2016-05-26 23:44:27 +02:00
|
|
|
///
|
|
|
|
/// 00000000 00000000 00000000 00000000 1RRRRRGG GGGBBBBB 1RRRRRGG GGGBBBBB ...
|
|
|
|
/// |---------------------------------| |---------------| |---------------|
|
2020-07-12 20:27:56 +02:00
|
|
|
/// 32 zeros to start the frame LED1 LED2 ...
|
2016-05-26 23:44:27 +02:00
|
|
|
///
|
|
|
|
/// For each led, the first bit is always 1, and then you have 5 bits each for red, green and blue
|
2020-07-12 20:27:56 +02:00
|
|
|
/// (R, G and B in the above illustration) making 16 bits per led. Total bytes = 4 + (2 x number of LEDs)
|
2016-05-26 23:44:27 +02:00
|
|
|
///
|
2016-08-28 07:12:48 +02:00
|
|
|
class LedDeviceLpd6803 : public ProviderSpi
|
2016-05-26 23:44:27 +02:00
|
|
|
{
|
|
|
|
public:
|
2020-07-12 20:27:56 +02:00
|
|
|
|
2016-05-26 23:44:27 +02:00
|
|
|
///
|
2020-07-12 20:27:56 +02:00
|
|
|
/// @brief Constructs a LDP6803 LED-device
|
2016-05-26 23:44:27 +02:00
|
|
|
///
|
2020-07-12 20:27:56 +02:00
|
|
|
/// @param deviceConfig Device's configuration as JSON-Object
|
2016-05-26 23:44:27 +02:00
|
|
|
///
|
2020-02-10 15:21:58 +01:00
|
|
|
explicit LedDeviceLpd6803(const QJsonObject &deviceConfig);
|
2016-08-23 20:07:12 +02:00
|
|
|
|
2020-07-12 20:27:56 +02:00
|
|
|
///
|
|
|
|
/// @brief Constructs the LED-device
|
|
|
|
///
|
|
|
|
/// @param[in] deviceConfig Device's configuration as JSON-Object
|
|
|
|
/// @return LedDevice constructed
|
|
|
|
///
|
2016-10-13 21:59:58 +02:00
|
|
|
static LedDevice* construct(const QJsonObject &deviceConfig);
|
2016-05-26 23:44:27 +02:00
|
|
|
|
2020-07-12 20:27:56 +02:00
|
|
|
private:
|
|
|
|
|
|
|
|
///
|
|
|
|
/// @brief Initialise the device's configuration
|
2020-02-10 15:21:58 +01:00
|
|
|
///
|
2020-07-12 20:27:56 +02:00
|
|
|
/// @param[in] deviceConfig the JSON device configuration
|
|
|
|
/// @return True, if success
|
2020-02-10 15:21:58 +01:00
|
|
|
///
|
|
|
|
virtual bool init(const QJsonObject &deviceConfig) override;
|
2016-10-08 08:14:36 +02:00
|
|
|
|
2016-05-26 23:44:27 +02:00
|
|
|
///
|
2020-07-12 20:27:56 +02:00
|
|
|
/// @brief Writes the RGB-Color values to the LEDs.
|
2016-05-26 23:44:27 +02:00
|
|
|
///
|
2020-07-12 20:27:56 +02:00
|
|
|
/// @param[in] ledValues The RGB-color per LED
|
|
|
|
/// @return Zero on success, else negative
|
2016-05-26 23:44:27 +02:00
|
|
|
///
|
2020-07-12 20:27:56 +02:00
|
|
|
virtual int write(const std::vector<ColorRgb> & ledValues) override;
|
2016-05-26 23:44:27 +02:00
|
|
|
};
|
2020-07-12 20:27:56 +02:00
|
|
|
|
|
|
|
#endif // LEDEVICELPD6803_H
|