LP50XX Driver  V1.0
Library for interaction with the LP5009 and LP5012 LED driver
LP50XX Class Reference

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...
 

Detailed Description

Class to communicate with the LP5009 or LP5012.

Constructor & Destructor Documentation

◆ LP50XX() [1/4]

LP50XX::LP50XX ( void  )

This function instantiates the class object.

◆ LP50XX() [2/4]

LP50XX::LP50XX ( LED_Configuration  ledConfiguration)

This function instantiates the class object with a specific LED configuration.

Parameters
ledConfigurationThe LED configuration in which the leds are attached to the outputs. See LED_Configuration

◆ LP50XX() [3/4]

LP50XX::LP50XX ( uint8_t  enablePin)

This function instantiates the class object with an enable pin.

Parameters
enablePinthe pin that is connected to the EN pin of the LP5009 or LP5012

◆ LP50XX() [4/4]

LP50XX::LP50XX ( LED_Configuration  ledConfiguration,
uint8_t  enablePin 
)

This function instantiates the class object with a specific LED configuration and with an enable pin.

Parameters
ledConfigurationThe LED configuration in which the leds are attached to the outputs. See LED_Configuration
enablePinthe pin that is connected to the EN pin of the LP5009 or LP5012

Member Function Documentation

◆ Begin()

void LP50XX::Begin ( uint8_t  i2cAddress = DEFAULT_ADDRESS)

Initializes the I2C bus and the LP5009 or LP5012.

Initialisation functions

Parameters
i2cAddressThe I2C address of the device

◆ Configure()

void LP50XX::Configure ( uint8_t  configuration,
EAddressType  addressType = EAddressType::Normal 
)

Configures the device according to the configuration param.

Configuration functions

Note
A configuration can be Configure(LED_GLOBAL_ON | MAX_CURRENT_25mA | PWM_DITHERING_ON | AUTO_INC_ON | POWER_SAVE_ON | LOG_SCALE_ON);
Parameters
configurationThe configuration of the device, this can be made by bitwise OR ('|') the enum LP50XX_Configuration
addressTypethe I2C address type to write to

◆ ReadRegister()

void LP50XX::ReadRegister ( uint8_t  reg,
uint8_t *  value 
)

Reads a value from a specified register.

Parameters
regThe register to read from
valuea reference to a uint8_t value

◆ Reset()

void LP50XX::Reset ( )

Resets the device by using the enable pin if available and resetting the registers.

◆ ResetRegisters()

void LP50XX::ResetRegisters ( EAddressType  addressType = EAddressType::Normal)

Resets the registers to their original values.

Parameters
addressTypethe I2C address type to write to

◆ SetAutoIncrement()

void LP50XX::SetAutoIncrement ( uint8_t  autoInc)

Sets the auto increment mode of the device.

Parameters
autoIncThe auto increment mode. AUTO_INC_OFF AUTO_INC_ON

◆ SetBankBrightness()

void LP50XX::SetBankBrightness ( uint8_t  brightness,
EAddressType  addressType = EAddressType::Normal 
)

Sets the brightness level of the whole BANK.

Parameters
brightnessThe brightness level from 0 to 0xFF
addressTypethe I2C address type to write to

◆ SetBankColor()

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.

Parameters
redThe red color value from 0 to 0xFF
greenThe green color value from 0 to 0xFF
blueThe blue color value from 0 to 0xFF
addressTypethe I2C address type to write to

◆ SetBankColorA()

void LP50XX::SetBankColorA ( uint8_t  value,
EAddressType  addressType = EAddressType::Normal 
)

Sets BANK color A related to Output 0,3,6,9.

Parameters
valueThe color value from 0 to 0xFF
addressTypethe I2C address type to write to

◆ SetBankColorB()

void LP50XX::SetBankColorB ( uint8_t  value,
EAddressType  addressType = EAddressType::Normal 
)

Sets BANK color B related to Output 1,4,7,10.

Parameters
valueThe color value from 0 to 0xFF
addressTypethe I2C address type to write to

◆ SetBankColorC()

void LP50XX::SetBankColorC ( uint8_t  value,
EAddressType  addressType = EAddressType::Normal 
)

Sets BANK color C related to Output 2,5,8,11.

Parameters
valueThe color value from 0 to 0xFF
addressTypethe I2C address type to write to

◆ SetBankControl()

void LP50XX::SetBankControl ( uint8_t  leds,
EAddressType  addressType = EAddressType::Normal 
)

Enables or Disables BANK control for specific LEDs.

Bank control functions

Parameters
ledsThe LEDs to include in BANK control. See LP50XX_LEDS
addressTypethe I2C address type to write to
Note
Code example could be SetBankControl(LED_0 | LED_1 | LED_2 | LED_3);

◆ SetEnablePin()

void LP50XX::SetEnablePin ( uint8_t  enablePin)

Sets the enable pin of the device. This pin is used to enable the device in Begin.

Parameters
enablePin

◆ SetGlobalLedOff()

void LP50XX::SetGlobalLedOff ( uint8_t  value)

Turns all LED outputs ON or OFF.

Parameters
valueThe desired setting. LED_GLOBAL_OFF LED_GLOBAL_ON

◆ SetI2CAddress()

void LP50XX::SetI2CAddress ( uint8_t  address)

Sets the I2C address.

Parameters
address

◆ SetLEDBrightness()

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

Parameters
ledThe led to set. 0..3
brighnessThe brightness level from 0 to 0xFF
addressTypethe I2C address type to write to

◆ SetLEDColor()

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.

Parameters
ledThe led to set. 0..3
redThe red color value from 0 to 0xFF
greenThe green color value from 0 to 0xFF
blueThe blue color value from 0 to 0xFF
addressTypethe I2C address type to write to

◆ SetLEDConfiguration()

void LP50XX::SetLEDConfiguration ( LED_Configuration  ledConfiguration)

Sets the LED configuration acording the LED_Configuration enum.

Parameters
ledConfiguration

◆ SetMaxCurrentOption()

void LP50XX::SetMaxCurrentOption ( uint8_t  option)

Sets the max current option of the device.

Parameters
optionThe max current option. MAX_CURRENT_25mA MAX_CURRENT_35mA

◆ SetOutputColor()

void LP50XX::SetOutputColor ( uint8_t  output,
uint8_t  value,
EAddressType  addressType = EAddressType::Normal 
)

Sets the color level of a single output.

Parameters
outputThe output to set. 0..11
valueThe color value from 0 to 0xFF
addressTypethe I2C address type to write to

◆ SetPowerSaving()

void LP50XX::SetPowerSaving ( uint8_t  powerSave)

Sets the power saving mode of the device.

Parameters
powerSaveThe power saving mode. POWER_SAVE_OFF POWER_SAVE_ON

◆ SetPWMDithering()

void LP50XX::SetPWMDithering ( uint8_t  dithering)

Sets the PWM dithering of the device.

Parameters
ditheringThe dithering mode. PWM_DITHERING_OFF PWM_DITHERING_ON

◆ SetScaling()

void LP50XX::SetScaling ( uint8_t  scaling)

Sets the PWM scaling used by the device.

Parameters
scalingThe scaling of the device. LOG_SCALE_OFF LOG_SCALE_ON

◆ WriteRegister()

void LP50XX::WriteRegister ( uint8_t  reg,
uint8_t  value,
EAddressType  addressType = EAddressType::Normal 
)

Writes a value to a specified register.

Low level functions

Warning
only use if you know what you're doing
Parameters
regThe register to write to
valueThe value to write to the register
addressTypethe I2C address type to write to

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