LP55231 driver
LP55231.h@0:4ff4e0b7f25c, 2018-08-22 (annotated)
- Committer:
- duchonic
- Date:
- Wed Aug 22 06:32:51 2018 +0000
- Revision:
- 0:4ff4e0b7f25c
- Child:
- 1:4ab9f195e998
LP55231 library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
duchonic | 0:4ff4e0b7f25c | 1 | #include "mbed.h" |
duchonic | 0:4ff4e0b7f25c | 2 | |
duchonic | 0:4ff4e0b7f25c | 3 | #ifndef LP55231_h |
duchonic | 0:4ff4e0b7f25c | 4 | #define LP55231_h |
duchonic | 0:4ff4e0b7f25c | 5 | |
duchonic | 0:4ff4e0b7f25c | 6 | |
duchonic | 0:4ff4e0b7f25c | 7 | |
duchonic | 0:4ff4e0b7f25c | 8 | #define REG_ENGINE_CNTRL1 (0x00) |
duchonic | 0:4ff4e0b7f25c | 9 | #define REG_MISC (0x36) |
duchonic | 0:4ff4e0b7f25c | 10 | #define REG_D1_PWM (0x16) /* GREEN1 */ |
duchonic | 0:4ff4e0b7f25c | 11 | #define REG_D2_PWM (0x17) /* BLUE1 */ |
duchonic | 0:4ff4e0b7f25c | 12 | #define REG_D7_PWM (0x1C) /* RED1 */ |
duchonic | 0:4ff4e0b7f25c | 13 | |
duchonic | 0:4ff4e0b7f25c | 14 | class LP55231 |
duchonic | 0:4ff4e0b7f25c | 15 | { |
duchonic | 0:4ff4e0b7f25c | 16 | public: |
duchonic | 0:4ff4e0b7f25c | 17 | |
duchonic | 0:4ff4e0b7f25c | 18 | /** |
duchonic | 0:4ff4e0b7f25c | 19 | * @brief LP55231 constructor |
duchonic | 0:4ff4e0b7f25c | 20 | */ |
duchonic | 0:4ff4e0b7f25c | 21 | LP55231(PinName sda, PinName scl, uint8_t addr); |
duchonic | 0:4ff4e0b7f25c | 22 | |
duchonic | 0:4ff4e0b7f25c | 23 | /** |
duchonic | 0:4ff4e0b7f25c | 24 | * @brief LP55231 destructor |
duchonic | 0:4ff4e0b7f25c | 25 | */ |
duchonic | 0:4ff4e0b7f25c | 26 | ~LP55231(); |
duchonic | 0:4ff4e0b7f25c | 27 | |
duchonic | 0:4ff4e0b7f25c | 28 | /** |
duchonic | 0:4ff4e0b7f25c | 29 | * |
duchonic | 0:4ff4e0b7f25c | 30 | */ |
duchonic | 0:4ff4e0b7f25c | 31 | uint8_t LP55231_Init(void); |
duchonic | 0:4ff4e0b7f25c | 32 | |
duchonic | 0:4ff4e0b7f25c | 33 | /** |
duchonic | 0:4ff4e0b7f25c | 34 | * |
duchonic | 0:4ff4e0b7f25c | 35 | */ |
duchonic | 0:4ff4e0b7f25c | 36 | void LP55231_SetLed(uint8_t led, uint8_t brightness); |
duchonic | 0:4ff4e0b7f25c | 37 | |
duchonic | 0:4ff4e0b7f25c | 38 | private: |
duchonic | 0:4ff4e0b7f25c | 39 | I2C m_i2c; |
duchonic | 0:4ff4e0b7f25c | 40 | int m_addr; |
duchonic | 0:4ff4e0b7f25c | 41 | /** |
duchonic | 0:4ff4e0b7f25c | 42 | * |
duchonic | 0:4ff4e0b7f25c | 43 | */ |
duchonic | 0:4ff4e0b7f25c | 44 | void SetRegister(uint8_t registerAddr, uint8_t data); |
duchonic | 0:4ff4e0b7f25c | 45 | |
duchonic | 0:4ff4e0b7f25c | 46 | }; |
duchonic | 0:4ff4e0b7f25c | 47 | |
duchonic | 0:4ff4e0b7f25c | 48 | |
duchonic | 0:4ff4e0b7f25c | 49 | #endif |