Class to communicate with the LP5009 or LP5012. More...
#include <LP50XX.h>
Public Member Functions | |
LP50XX (void) | |
This function instantiates the class object. More... | |
LP50XX (LED_Configuration ledConfiguration) | |
This function instantiates the class object with a specific LED configuration. More... | |
LP50XX (uint8_t enablePin) | |
This function instantiates the class object with an enable pin. More... | |
LP50XX (LED_Configuration ledConfiguration, uint8_t enablePin) | |
This function instantiates the class object with a specific LED configuration and with an enable pin. More... | |
void | Begin (uint8_t i2c_address=DEFAULT_ADDRESS) |
Initializes the I2C bus and the LP5009 or LP5012. More... | |
void | Reset () |
Resets the device by using the enable pin if available and resetting the registers. More... | |
void | ResetRegisters (EAddressType addressType=EAddressType::Normal) |
Resets the registers to their original values. More... | |
void | Configure (uint8_t configuration, EAddressType addressType=EAddressType::Normal) |
Configures the device according to the configuration param. More... | |
void | SetScaling (uint8_t scaling) |
Sets the PWM scaling used by the device. More... | |
void | SetPowerSaving (uint8_t powerSave) |
Sets the power saving mode of the device. More... | |
void | SetAutoIncrement (uint8_t autoInc) |
Sets the auto increment mode of the device. More... | |
void | SetPWMDithering (uint8_t dithering) |
Sets the PWM dithering of the device. More... | |
void | SetMaxCurrentOption (uint8_t option) |
Sets the max current option of the device. More... | |
void | SetGlobalLedOff (uint8_t value) |
Turns all LED outputs ON or OFF. More... | |
void | SetEnablePin (uint8_t enablePin) |
Sets the enable pin of the device. This pin is used to enable the device in Begin. More... | |
void | SetLEDConfiguration (LED_Configuration ledConfiguration) |
Sets the LED configuration acording the LED_Configuration enum. More... | |
void | SetI2CAddress (uint8_t address) |
Sets the I2C address. More... | |
void | SetBankControl (uint8_t leds, EAddressType addressType=EAddressType::Normal) |
Enables or Disables BANK control for specific LEDs. More... | |
void | SetBankBrightness (uint8_t brightness, EAddressType addressType=EAddressType::Normal) |
Sets the brightness level of the whole BANK. More... | |
void | SetBankColorA (uint8_t value, EAddressType addressType=EAddressType::Normal) |
Sets BANK color A related to Output 0,3,6,9. More... | |
void | SetBankColorB (uint8_t value, EAddressType addressType=EAddressType::Normal) |
Sets BANK color B related to Output 1,4,7,10. More... | |
void | SetBankColorC (uint8_t value, EAddressType addressType=EAddressType::Normal) |
Sets BANK color C related to Output 2,5,8,11. More... | |
void | SetBankColor (uint8_t red, uint8_t green, uint8_t blue, EAddressType addressType=EAddressType::Normal) |
Sets the BANK color according to the set LED configuration SetLEDConfiguration. More... | |
void | SetLEDBrightness (uint8_t led, uint8_t brighness, EAddressType addressType=EAddressType::Normal) |
Sets the brightness level of a single LED (3 outputs) More... | |
void | SetOutputColor (uint8_t output, uint8_t value, EAddressType addressType=EAddressType::Normal) |
Sets the color level of a single output. More... | |
void | SetLEDColor (uint8_t led, uint8_t red, uint8_t green, uint8_t blue, EAddressType addressType=EAddressType::Normal) |
Sets the LED color according to the set LED configuration SetLEDConfiguration. More... | |
void | WriteRegister (uint8_t reg, uint8_t value, EAddressType addressType=EAddressType::Normal) |
Writes a value to a specified register. More... | |
void | ReadRegister (uint8_t reg, uint8_t *value) |
Reads a value from a specified register. More... | |
Class to communicate with the LP5009 or LP5012.
LP50XX::LP50XX | ( | void | ) |
This function instantiates the class object.
LP50XX::LP50XX | ( | LED_Configuration | ledConfiguration | ) |
This function instantiates the class object with a specific LED configuration.
ledConfiguration | The LED configuration in which the leds are attached to the outputs. See LED_Configuration |
LP50XX::LP50XX | ( | uint8_t | enablePin | ) |
This function instantiates the class object with an enable pin.
enablePin | the pin that is connected to the EN pin of the LP5009 or LP5012 |
LP50XX::LP50XX | ( | LED_Configuration | ledConfiguration, |
uint8_t | enablePin | ||
) |
This function instantiates the class object with a specific LED configuration and with an enable pin.
ledConfiguration | The LED configuration in which the leds are attached to the outputs. See LED_Configuration |
enablePin | the pin that is connected to the EN pin of the LP5009 or LP5012 |
void LP50XX::Begin | ( | uint8_t | i2cAddress = DEFAULT_ADDRESS | ) |
Initializes the I2C bus and the LP5009 or LP5012.
Initialisation functions
i2cAddress | The I2C address of the device |
void LP50XX::Configure | ( | uint8_t | configuration, |
EAddressType | addressType = EAddressType::Normal |
||
) |
Configures the device according to the configuration param.
Configuration functions
Configure(LED_GLOBAL_ON | MAX_CURRENT_25mA | PWM_DITHERING_ON | AUTO_INC_ON | POWER_SAVE_ON | LOG_SCALE_ON);
configuration | The configuration of the device, this can be made by bitwise OR ('|') the enum LP50XX_Configuration |
addressType | the I2C address type to write to |
void LP50XX::ReadRegister | ( | uint8_t | reg, |
uint8_t * | value | ||
) |
Reads a value from a specified register.
reg | The register to read from |
value | a reference to a uint8_t value |
void LP50XX::Reset | ( | ) |
Resets the device by using the enable pin if available and resetting the registers.
void LP50XX::ResetRegisters | ( | EAddressType | addressType = EAddressType::Normal | ) |
Resets the registers to their original values.
addressType | the I2C address type to write to |
void LP50XX::SetAutoIncrement | ( | uint8_t | autoInc | ) |
Sets the auto increment mode of the device.
autoInc | The auto increment mode. AUTO_INC_OFF AUTO_INC_ON |
void LP50XX::SetBankBrightness | ( | uint8_t | brightness, |
EAddressType | addressType = EAddressType::Normal |
||
) |
Sets the brightness level of the whole BANK.
brightness | The brightness level from 0 to 0xFF |
addressType | the I2C address type to write to |
void LP50XX::SetBankColor | ( | uint8_t | red, |
uint8_t | green, | ||
uint8_t | blue, | ||
EAddressType | addressType = EAddressType::Normal |
||
) |
Sets the BANK color according to the set LED configuration SetLEDConfiguration.
red | The red color value from 0 to 0xFF |
green | The green color value from 0 to 0xFF |
blue | The blue color value from 0 to 0xFF |
addressType | the I2C address type to write to |
void LP50XX::SetBankColorA | ( | uint8_t | value, |
EAddressType | addressType = EAddressType::Normal |
||
) |
Sets BANK color A related to Output 0,3,6,9.
value | The color value from 0 to 0xFF |
addressType | the I2C address type to write to |
void LP50XX::SetBankColorB | ( | uint8_t | value, |
EAddressType | addressType = EAddressType::Normal |
||
) |
Sets BANK color B related to Output 1,4,7,10.
value | The color value from 0 to 0xFF |
addressType | the I2C address type to write to |
void LP50XX::SetBankColorC | ( | uint8_t | value, |
EAddressType | addressType = EAddressType::Normal |
||
) |
Sets BANK color C related to Output 2,5,8,11.
value | The color value from 0 to 0xFF |
addressType | the I2C address type to write to |
void LP50XX::SetBankControl | ( | uint8_t | leds, |
EAddressType | addressType = EAddressType::Normal |
||
) |
Enables or Disables BANK control for specific LEDs.
Bank control functions
leds | The LEDs to include in BANK control. See LP50XX_LEDS |
addressType | the I2C address type to write to |
SetBankControl(LED_0 | LED_1 | LED_2 | LED_3);
void LP50XX::SetEnablePin | ( | uint8_t | enablePin | ) |
Sets the enable pin of the device. This pin is used to enable the device in Begin.
enablePin |
void LP50XX::SetGlobalLedOff | ( | uint8_t | value | ) |
Turns all LED outputs ON or OFF.
value | The desired setting. LED_GLOBAL_OFF LED_GLOBAL_ON |
void LP50XX::SetI2CAddress | ( | uint8_t | address | ) |
Sets the I2C address.
address |
void LP50XX::SetLEDBrightness | ( | uint8_t | led, |
uint8_t | brighness, | ||
EAddressType | addressType = EAddressType::Normal |
||
) |
Sets the brightness level of a single LED (3 outputs)
Output control functions
led | The led to set. 0..3 |
brighness | The brightness level from 0 to 0xFF |
addressType | the I2C address type to write to |
void LP50XX::SetLEDColor | ( | uint8_t | led, |
uint8_t | red, | ||
uint8_t | green, | ||
uint8_t | blue, | ||
EAddressType | addressType = EAddressType::Normal |
||
) |
Sets the LED color according to the set LED configuration SetLEDConfiguration.
led | The led to set. 0..3 |
red | The red color value from 0 to 0xFF |
green | The green color value from 0 to 0xFF |
blue | The blue color value from 0 to 0xFF |
addressType | the I2C address type to write to |
void LP50XX::SetLEDConfiguration | ( | LED_Configuration | ledConfiguration | ) |
Sets the LED configuration acording the LED_Configuration enum.
ledConfiguration |
void LP50XX::SetMaxCurrentOption | ( | uint8_t | option | ) |
Sets the max current option of the device.
option | The max current option. MAX_CURRENT_25mA MAX_CURRENT_35mA |
void LP50XX::SetOutputColor | ( | uint8_t | output, |
uint8_t | value, | ||
EAddressType | addressType = EAddressType::Normal |
||
) |
Sets the color level of a single output.
output | The output to set. 0..11 |
value | The color value from 0 to 0xFF |
addressType | the I2C address type to write to |
void LP50XX::SetPowerSaving | ( | uint8_t | powerSave | ) |
Sets the power saving mode of the device.
powerSave | The power saving mode. POWER_SAVE_OFF POWER_SAVE_ON |
void LP50XX::SetPWMDithering | ( | uint8_t | dithering | ) |
Sets the PWM dithering of the device.
dithering | The dithering mode. PWM_DITHERING_OFF PWM_DITHERING_ON |
void LP50XX::SetScaling | ( | uint8_t | scaling | ) |
Sets the PWM scaling used by the device.
scaling | The scaling of the device. LOG_SCALE_OFF LOG_SCALE_ON |
void LP50XX::WriteRegister | ( | uint8_t | reg, |
uint8_t | value, | ||
EAddressType | addressType = EAddressType::Normal |
||
) |
Writes a value to a specified register.
Low level functions
reg | The register to write to |
value | The value to write to the register |
addressType | the I2C address type to write to |