LP55231 driver
LP55231.cpp
- Committer:
- duchonic
- Date:
- 2018-08-22
- Revision:
- 0:4ff4e0b7f25c
- Child:
- 1:4ab9f195e998
File content as of revision 0:4ff4e0b7f25c:
#include "LP55231.h" LP55231::LP55231(PinName sda, PinName scl, uint8_t addr) : m_i2c(sda, scl), m_addr(addr) {} uint8_t LP55231::LP55231_Init(void){ SetRegister(REG_ENGINE_CNTRL1, 0x40); SetRegister(REG_MISC, 0x53); return 0; } LP55231::~LP55231(void) { }; void LP55231::LP55231_SetLed(uint8_t led, uint8_t brightness) { SetRegister(REG_D7_PWM, brightness); /* RED1 */ SetRegister(REG_D1_PWM, brightness); /* GREEN1 */ SetRegister(REG_D2_PWM, brightness); /* BLUE1 */ } // --- Private Functions --- // void LP55231::SetRegister(uint8_t registerAddr, uint8_t data) { char data_write[2]; data_write[0] = registerAddr; data_write[1] = data; m_i2c.write(m_addr, data_write, 3); }