#include <modm/driver/pwm/lp503x.hpp>
|
using | RegisterValue_t = FlagsGroup< DeviceConfig0_t, DeviceConfig1_t, Reset_t > |
|
|
enum | Register : uint8_t {
DeviceConfig0 = 0x00,
DeviceConfig1 = 0x01,
LedConfig0 = 0x02,
LedConfig1 = 0x03,
BankBrightness = 0x04,
BankAColor = 0x05,
BankBColor = 0x06,
BankCColor = 0x07,
Led0Brightness = 0x08,
Out0Color = 0x14,
Reset = 0x38
} |
|
enum | DeviceConfig0 : uint8_t { ChipEnable = (1 << 6)
} |
|
enum | DeviceConfig1 : uint8_t {
LedGlobalOff = (1 << 0),
HighCurrent = (1 << 1),
PwmDithering = (1 << 2),
AutoIncrement = (1 << 3),
PowerSave = (1 << 4),
LogScale = (1 << 5)
} |
|
enum | LedBankMode : uint16_t {
Led0 = (1 << 0),
Led1 = (1 << 1),
Led2 = (1 << 2),
Led3 = (1 << 3),
Led4 = (1 << 4),
Led5 = (1 << 5),
Led6 = (1 << 6),
Led7 = (1 << 7),
Led8 = (1 << 8),
Led9 = (1 << 9),
Led10 = (1 << 10),
Led11 = (1 << 11)
} |
|
enum | Reset : uint8_t { ResetDevice = 0xff
} |
|
|
| MODM_FLAGS8 (DeviceConfig0) |
|
| MODM_FLAGS8 (DeviceConfig1) |
|
| MODM_FLAGS16 (LedBankMode) |
|
| MODM_FLAGS8 (Reset) |
|
| Lp503x (uint8_t i2cAddress) |
|
bool | initialize () |
| Initialize device, call before using any other function.
|
|
bool | enable () |
| Enable device.
|
|
bool | disable () |
| Disable device.
|
|
bool | setConfiguration (DeviceConfig1_t configuration) |
|
bool | setChannelBrightness (uint8_t channel, uint8_t value) |
|
bool | setChannelBrightnessValues (uint8_t startChannel, const uint8_t *values, uint8_t numChannels) |
|
bool | setLedGroupBrightness (uint8_t index, uint8_t value) |
|
bool | setBankModeEnabled (LedBankMode_t bankMode) |
|
bool | setBankBrightness (uint8_t value) |
|
bool | setBankABrightness (uint8_t value) |
|
bool | setBankBBrightness (uint8_t value) |
|
bool | setBankCBrightness (uint8_t value) |
|
void | attachConfigurationHandler (I2c::ConfigurationHandler handler) |
|
bool | ping () |
|
bool | read (uint8_t *buffer, std::size_t size) |
| Starts a write transaction and waits until finished.
|
|
void | setAddress (uint8_t address) |
|
bool | write (const uint8_t *buffer, std::size_t size) |
| Starts a write transaction and waits until finished.
|
|
bool | writeRead (const uint8_t *writeBuffer, std::size_t writeSize, uint8_t *readBuffer, std::size_t readSize) |
| Starts a write-read transaction and waits until finished.
|
|
|
DeviceConfig1_t | DefaultConfiguration |
|
template<typename I2cMaster, size_t Channels>
class modm::lp503x< I2cMaster, Channels >
LP5030/LP5036 30/36-channel, 12-bit PWM LED controller
- Template Parameters
-
- Author
- Christopher Durand
Attaches a configuration handler, which is called before a transaction, whenever the configuration has to be changed.
- Returns
true
when transaction is busy.
- Return Values
-
true | device responds to address |
false | no device with address found |
Sets a new address of the slave device.
- Parameters
-
address | the slave address not yet shifted left (address < 128). |
template<typename I2cMaster , size_t Channels>
bool modm::lp503x< I2cMaster, Channels >::setBankABrightness |
( |
uint8_t |
value | ) |
|
Set brightness for all channels 3n configured in bank mode.
template<typename I2cMaster , size_t Channels>
bool modm::lp503x< I2cMaster, Channels >::setBankBBrightness |
( |
uint8_t |
value | ) |
|
Set brightness for all channels 3n+1 configured in bank mode.
template<typename I2cMaster , size_t Channels>
bool modm::lp503x< I2cMaster, Channels >::setBankBrightness |
( |
uint8_t |
value | ) |
|
Set bank brightness multiplicator. This controls all channels in bank mode.
template<typename I2cMaster , size_t Channels>
bool modm::lp503x< I2cMaster, Channels >::setBankCBrightness |
( |
uint8_t |
value | ) |
|
Set brightness for all channels 3n+2 configured in bank mode.
template<typename I2cMaster , size_t Channels>
bool modm::lp503x< I2cMaster, Channels >::setBankModeEnabled |
( |
LedBankMode_t |
bankMode | ) |
|
Enable bank mode for a led group. This allows to simultaniously dim multiple RGB leds by accessing the global bank registers.
If bank mode is enabled for a led group (3n, 3n+1, 3n+2) its brightnesses are controlled by the global BankAColor, BankBColor, BankCColor registers and the BankBrightness register. The inidividual channel settings are ignored then.
template<typename I2cMaster , size_t Channels>
bool modm::lp503x< I2cMaster, Channels >::setChannelBrightness |
( |
uint8_t |
channel, |
|
|
uint8_t |
value |
|
) |
| |
Set brightness value for individual output channel.
This writes to the OutXColor registers.
If the LogScale flag is set these values are scaled logithmically to 12 bit pwm duty-cycles (default).
- Parameters
-
channel | output channel index |
value | 8-bit brightness value |
template<typename I2cMaster , size_t Channels>
bool modm::lp503x< I2cMaster, Channels >::setChannelBrightnessValues |
( |
uint8_t |
startChannel, |
|
|
const uint8_t * |
values, |
|
|
uint8_t |
numChannels |
|
) |
| |
Set brightness values for multiple output channels in one transaction.
This writes the OutXColor registers.
- Parameters
-
channel | output channel start index |
numChannels | number of values to write |
value | 8-bit brightness value |
template<typename I2cMaster , size_t Channels>
bool modm::lp503x< I2cMaster, Channels >::setConfiguration |
( |
DeviceConfig1_t |
configuration | ) |
|
Set device configuration AutoIncrement is always set
template<typename I2cMaster , size_t Channels>
bool modm::lp503x< I2cMaster, Channels >::setLedGroupBrightness |
( |
uint8_t |
index, |
|
|
uint8_t |
value |
|
) |
| |
Set brightness multiplicator for output channel group (3n, 3n+1, 3n+2). Intended for dimming RGB Leds.
When this feature is not required, this function can be ignored. The default of 0xFF corresponds to full on. Then the resulting LED brightness only depends on the individual channel settings.
This setting has no effect when the LED group is configured in bank mode. Then the value from the BankBrightness register is used.
Default value is 0xFF.
- Parameters
-
value | 8-bit brightness value |
- Returns
true
when transaction did not return an error.
template<typename I2cMaster , size_t Channels>
DeviceConfig1_t modm::lp503x< I2cMaster, Channels >::DefaultConfiguration |
Initial value:DeviceConfig1::HighCurrent |
DeviceConfig1::PwmDithering |
DeviceConfig1::PowerSave |
DeviceConfig1::LogScale
The documentation for this class was generated from the following file: