DOPLED 1.1.1
ESP32 Library for driving 24-29V low speed Data Over Power LED Sets
 
Loading...
Searching...
No Matches
DOPLED Class Reference

Driver for Data Over Power addressable LEDs. More...

#include <DOPLED.h>

Public Member Functions

 DOPLED (uint8_t pin, uint8_t timeBase_us)
 Creates a DOPLED Object with a specific timebase.
 
 DOPLED (uint8_t pin)
 Creates a DOPLED Object.
 
void begin ()
 Enables the ESP32's RMT output.
 
void end ()
 Disables the ESP32's RMT output and set the pin LOW.
 
void sendRaw (uint8_t *data, size_t size)
 
void fillMatchingAddresses (uint8_t mask, uint8_t address, uint8_t r, uint8_t g, uint8_t b)
 
void writePixel (uint8_t address, uint8_t r, uint8_t g, uint8_t b)
 Sets a specific pixel to a specific color.
 
void fillAll (uint8_t r, uint8_t g, uint8_t b)
 Fills all pixels with a specific color.
 
void fillRandomGroups (uint8_t mask, uint8_t address, uint8_t r, uint8_t g, uint8_t b)
 Creates random groups and sets them to a specific color.
 
void setFlags (uint8_t flagByte)
 
bool transmitDone ()
 Checks if the previous transmission has completed.
 
 ~DOPLED ()
 

Detailed Description

Driver for Data Over Power addressable LEDs.

Note
This library only supports ESP32 microcontrollers.

Constructor & Destructor Documentation

◆ DOPLED() [1/2]

DOPLED::DOPLED ( uint8_t pin,
uint8_t timeBase_us )

Creates a DOPLED Object with a specific timebase.

The timebase defines the width of each pulse. Different LEDs may tolerate different timings. Typical value is 70-120us. Lower timings allow faster updates but may not work with all LEDs.

Parameters
pinESP32 output pin
timeBase_usTimebase in microseconds (default: 70us)

◆ DOPLED() [2/2]

DOPLED::DOPLED ( uint8_t pin)

Creates a DOPLED Object.

Note
Uses a default timebase of 70 us.
See also
DOPLED(uint8_t, uint8_t)
Parameters
pinESP32 output pin

◆ ~DOPLED()

DOPLED::~DOPLED ( )

Destructor for the DOPLED class. Cleans up the RMT channel and encoder.

Member Function Documentation

◆ begin()

void DOPLED::begin ( )

Enables the ESP32's RMT output.

Note
Must be called before sending any data to the LEDs. Calling any write or fill method before begin() will result in no output.

◆ end()

void DOPLED::end ( )

Disables the ESP32's RMT output and set the pin LOW.

DOP LEDs use the same amount of power when displaying black as when displaying white. Call this method when the LEDs are off for long duations to reduce power consumption.

◆ fillAll()

void DOPLED::fillAll ( uint8_t r,
uint8_t g,
uint8_t b )

Fills all pixels with a specific color.

Note
Blocks if a previous transmission is still in progress. Use transmitDone() to avoid blocking.
Parameters
rRed value (0-255)
gGreen value (0-255)
bBlue value (0-255)

◆ fillMatchingAddresses()

void DOPLED::fillMatchingAddresses ( uint8_t mask,
uint8_t address,
uint8_t r,
uint8_t g,
uint8_t b )

Sets a group of pixels according to the mask and address.

Note
Blocks if a previous transmission is still in progress. Use transmitDone() to avoid blocking.

The mask determines which bits of the pixel address are checked by the LEDs. Pixels matching the specified bits will be set.

Ex: fillMatchingAddresses(0b00000011, 0, 255, 0, 0) - set pixels 0, 4, 8, 12, etc. to red.

Ex: fillMatchingAddresses(0b11111000, 0, 0, 0, 255) - set pixels 0-7 to blue.

Ex: fillMatchingAddresses(0b00000010, 0, 0, 255, 0) - set alternating groups of 2 to green.

Parameters
mask8-bit bitmask indicating which address bits will be checked.
address8-bit address of the first pixel to be set.
rRed value (0-255)
gGreen value (0-255)
bBlue value (0-255)

◆ fillRandomGroups()

void DOPLED::fillRandomGroups ( uint8_t mask,
uint8_t address,
uint8_t r,
uint8_t g,
uint8_t b )

Creates random groups and sets them to a specific color.

Note
Blocks if a previous transmission is still in progress. Use transmitDone() to avoid blocking.

The mask and address specify which groups of LEDs will be set. The groups are decided on the fly by the LEDs when the first random command is executed. The same group can be addressed multiple times using the same mask and address. Sending a fillAll command will reset the random groups.

Only the last 4 bits of the mask and address are used.

Ex:

fillRandomGroups(0b0001, 0b0000, 255, 0, 0); - Sets random 50% of the string to red.

fillRandomGroups(0b0001, 0b0001, 0, 255, 0); - Sets the other 50% to green.

See example project Random for more examples.

Parameters
mask4-bit bitmask indicating which group bits will be checked.
address4-bit address indicating the group to be addressed.
rRed value (0-255)
gGreen value (0-255)
bBlue value (0-255)

◆ sendRaw()

void DOPLED::sendRaw ( uint8_t * data,
size_t size )
Warning
Advanced functionality. Improper usage may cause undefined or undocumented behavior.
Note
Blocks if a previous transmission is still in progress. Use transmitDone() to avoid blocking.
Parameters
dataByte array containing the raw data to be sent.
sizeSize of the byte array.

◆ setFlags()

void DOPLED::setFlags ( uint8_t flagByte)
Warning
Advanced functionality. Improper usage may cause undefined or undocumented behavior.

Sets the last 3 bits of the command byte, which are configurable flags. It is not known what these flags do, but they are included for completeness.

Parameters
flagByte3-bit value containing the flags to use.

◆ transmitDone()

bool DOPLED::transmitDone ( )

Checks if the previous transmission has completed.

If this method returns false, calling any command that sends data will block until the previous transmission has finished.

Returns
true if no transmission is in progress, false otherwise.

◆ writePixel()

void DOPLED::writePixel ( uint8_t address,
uint8_t r,
uint8_t g,
uint8_t b )

Sets a specific pixel to a specific color.

Note
Blocks if a previous transmission is still in progress. Use transmitDone() to avoid blocking.
Parameters
address8-bit address of the pixel to be set.
rRed value (0-255)
gGreen value (0-255)
bBlue value (0-255)

The documentation for this class was generated from the following files: