STM32 core 3.2.0-dev
Arduino core for STM32 based boards: API reference
← STM32duino documentation
Loading...
Searching...
No Matches
RGB_LED_TLC59731 Class Reference

Driver for an RGB LED controlled by a TLC59731 driver through a single wire interface. More...

#include <RGB_LED_TLC59731.h>

Public Member Functions

 RGB_LED_TLC59731 (pin_size_t rgb_pin=LED_BUILTIN, pin_size_t enable_pin=NC)
 Construct the driver and select the pins used to drive the LED.
void on (uint8_t rgb[3])
 Set the RGB LED color.
void on (uint8_t red, uint8_t green, uint8_t blue)
 Set the RGB LED color.
void off (void)
 Turn the RGB LED off and release its pins.
uint8_t getBrightness (void)
 Get the current brightness value.
void setBrightness (uint8_t value)
 Set the brightness value, applied to the predefined colors.

Static Public Attributes

static uint8_t brightness = DEFAULT_BRIGHTNESS
 Current brightness value, used by the predefined colors.
static uint8_t OFF [3] = {0, 0, 0 }
 Predefined color: off (no light).
static uint8_t RED [3] = {DEFAULT_BRIGHTNESS, 0, 0 }
 Predefined color: red.
static uint8_t GREEN [3] = {0, DEFAULT_BRIGHTNESS, 0 }
 Predefined color: green.
static uint8_t BLUE [3] = {0, 0, DEFAULT_BRIGHTNESS}
 Predefined color: blue.
static uint8_t MAGENTA [3] = {DEFAULT_BRIGHTNESS, 0, DEFAULT_BRIGHTNESS}
 Predefined color: magenta.
static uint8_t CYAN [3] = {0, DEFAULT_BRIGHTNESS, DEFAULT_BRIGHTNESS}
 Predefined color: cyan.
static uint8_t YELLOW [3] = {DEFAULT_BRIGHTNESS, DEFAULT_BRIGHTNESS, 0 }
 Predefined color: yellow.
static uint8_t WHITE [3] = {DEFAULT_BRIGHTNESS, DEFAULT_BRIGHTNESS, DEFAULT_BRIGHTNESS}
 Predefined color: white.

Detailed Description

Driver for an RGB LED controlled by a TLC59731 driver through a single wire interface.

Constructor & Destructor Documentation

◆ RGB_LED_TLC59731()

RGB_LED_TLC59731::RGB_LED_TLC59731 ( pin_size_t rgb_pin = LED_BUILTIN,
pin_size_t enable_pin = NC )
inline

Construct the driver and select the pins used to drive the LED.

Parameters
rgb_pinPin connected to the TLC59731 data input. Default: LED_BUILTIN.
enable_pinPin connected to the TLC59731 enable line, NC if not used. Default: NC.

Member Function Documentation

◆ getBrightness()

uint8_t RGB_LED_TLC59731::getBrightness ( void )
inline

Get the current brightness value.

Returns
Brightness value.

◆ on() [1/2]

void RGB_LED_TLC59731::on ( uint8_t red,
uint8_t green,
uint8_t blue )

Set the RGB LED color.

Parameters
redRed value in range [0-255].
greenGreen value in range [0-255].
blueBlue value in range [0-255].

◆ on() [2/2]

void RGB_LED_TLC59731::on ( uint8_t rgb[3])

Set the RGB LED color.

The pins are configured on the first call.

Parameters
rgbArray of red, green and blue values in range [0-255].

◆ setBrightness()

void RGB_LED_TLC59731::setBrightness ( uint8_t value)

Set the brightness value, applied to the predefined colors.

The LED is not updated until on() is called with a predefined color.

Parameters
valueNew brightness value in range [0-255].

The documentation for this class was generated from the following files:
  • libraries/RGB_LED_TLC59731/src/RGB_LED_TLC59731.h
  • libraries/RGB_LED_TLC59731/src/RGB_LED_TLC59731.cpp