blink1-lib
1.0.0
|
#include <Blink1Device.hpp>
Public Types | |
enum | STRING_INIT_TYPE { STRING_INIT_TYPE::PATH, STRING_INIT_TYPE::SERIAL } |
Public Member Functions | |
Blink1Device () noexcept | |
Blink1Device (const std::uint32_t id) noexcept | |
Blink1Device (const std::string &stringInitializer, const STRING_INIT_TYPE initType) noexcept | |
Blink1Device (const char *stringInitializer, const STRING_INIT_TYPE initType) noexcept | |
Blink1Device (const Blink1Device &other)=delete | |
Blink1Device & | operator= (const Blink1Device &other)=delete |
~Blink1Device () | |
bool | good () const noexcept |
operator bool () const noexcept | |
std::optional< int > | getVersion () const noexcept |
bool | fadeToRGB (const std::uint16_t fadeMillis, const RGB &rgb) noexcept |
bool | fadeToRGBN (const std::uint16_t fadeMillis, const RGBN &rgbn) noexcept |
bool | setRGB (const RGB &rgb) noexcept |
bool | setRGBN (const RGBN &rgbn) noexcept |
std::optional< PatternLine > | readRGBWithFade (const std::uint8_t ledn) const noexcept |
std::optional< RGB > | readRGB (const std::uint8_t ledn) const noexcept |
bool | play (const std::uint8_t pos) noexcept |
bool | playLoop (const std::uint8_t startpos, const std::uint8_t endpos, const std::uint8_t count) noexcept |
bool | stop () noexcept |
std::optional< PlayState > | readPlayState () const noexcept |
bool | writePatternLine (const PatternLine &line, const std::uint8_t pos) noexcept |
bool | writePatternLineN (const PatternLineN &line, const std::uint8_t pos) noexcept |
std::optional< PatternLine > | readPatternLine (const std::uint8_t pos) const noexcept |
std::optional< PatternLineN > | readPatternLineN (const std::uint8_t pos) const noexcept |
bool | savePattern () noexcept |
std::optional< int > | getCacheIndex () const noexcept |
std::optional< int > | clearCache () noexcept |
std::optional< std::string_view > | getSerial () const noexcept |
std::optional< bool > | isMk2 () const noexcept |
void | setBlocking (bool blocking) noexcept |
void | setBlocking () noexcept |
void | setNonBlocking () noexcept |
bool | isBlocking () const noexcept |
Static Public Member Functions | |
static void | enableDegamma () noexcept |
static void | disableDegamma () noexcept |
static int | vid () noexcept |
static int | pid () noexcept |
Public Attributes | |
RGB | clearColor {0, 0, 0} |
bool | clearOnExit {false} |
A wrapper around the blink1 C library used to control blink1 devices
|
strong |
|
noexcept |
Default constructor
|
explicitnoexcept |
id | The ID of the device to initialize |
|
noexcept |
stringInitializer | String to select the device to initialize |
initType | How to interpret the the string |
|
noexcept |
stringInitializer | String to select the device to initialize |
initType | How to interpret the the string |
blink1_lib::Blink1Device::~Blink1Device | ( | ) |
Destructor.
|
noexcept |
Clear blink1 device cache for this device
|
staticnoexcept |
Disable the blink1-lib gamma curve
|
staticnoexcept |
Enables the blink1-lib gamma curve
|
noexcept |
Fades the device to another color over time. If this device has multiple LEDs, all LEDs will fade to that color.
By default this function is non-blocking to allow for processing while the fade is occurring. This behavior can be changed with setBlocking(bool).
fadeMillis | The amount of time in milliseconds for the fade to last |
rgb | RGB color to fade to |
|
noexcept |
Fades the device to another color over time. Only fades the LED specified in the RGBN value.
By default this function is non-blocking to allow for processing while the fade is occurring. This behavior can be changed with setBlocking(bool).
fadeMillis | The amount of time in milliseconds for the fade to last |
rgbn | RGB color to fade to along with which LED on the device to fade to |
|
noexcept |
Returns the cache index for this device
|
noexcept |
Gets serial ID for this device
|
noexcept |
Gets the version of the device that is connected. Returns std::nullopt if good() returns false
|
noexcept |
Returns whether or not the device is successfully connected
|
noexcept |
Returns whether the device is in blocking mode.
|
noexcept |
Returns whether the device is a MK2 device
|
explicitnoexcept |
|
staticnoexcept |
Product ID for blink1 devices
|
noexcept |
Plays a programmed pattern on the device
pos | Position to start playing from |
|
noexcept |
Plays a stored pattern on a loop
startpos | Start position for the loop |
endpos | End position for the loop |
count | Number of times to repeat (0 to repeat forever) |
|
noexcept |
Reads the pattern line stored at the given position
pos | The position to read |
|
noexcept |
Reads the pattern line stored at the given position
pos | The position to read |
|
noexcept |
|
noexcept |
Reads the RGB value of the given LED
ledn | The index of the LED to read |
|
noexcept |
Reads the RGB value of the given LED & the fade time
ledn | The index of the LED to read |
|
noexcept |
Saves the pattern in volatile memory into the non-volatile storage
|
noexcept |
Sets the device to be in blocking mode.
|
noexcept |
Sets the blocking mode for this device (technically just for this library for this device, as the underlying C library does not have a blocking mode).
When in blocking mode, fade commands will not return until the fade time is up. If blocking mode is disabled, the fade commands will return immediately. By default, all functions are non-blocking.
blocking | Whether or not to be in blocking mode |
|
noexcept |
Sets the device to be in non-blocking mode.
|
noexcept |
Sets the color of all LEDs on the device. The same as calling fadeToRGB(const std::uint16_t, const RGB&) with fadeMillis set to 0.
rgb | The color to set |
|
noexcept |
Sets the color of the specified on the device. The same as calling fadeToRGBN(const std::uint16_t, const RGBN&) with fadeMillis set to 0.
rgbn | The color to set along with which LED to set it on |
|
noexcept |
Stop playing the pattern that was playing
|
staticnoexcept |
Vendor ID for blink1 devices
|
noexcept |
Writes a PatternLine to the device at the specified position
line | The line to write |
pos | The position to write the line to - a number from 0 to max_patt (no documentation on what the value is) |
|
noexcept |
Writes a PatternLineN to the device at the specified position
line | The line to write |
pos | The position to write the line to - a number from 0 to max_patt (no documentation on what the value is) |
RGB blink1_lib::Blink1Device::clearColor {0, 0, 0} |
Color to clear to if Blink1Device::clearOnExit is set to true. Defaults to black/off.
bool blink1_lib::Blink1Device::clearOnExit {false} |
Set to true to clear the LEDs when the destructor is called. The clear color can be changed with Blink1Device::clearColor.