Class module for NCP5623B I2C LED driver
Dependents: mDotEVBM2X MTDOT-EVB-LinkCheck-AL MTDOT-EVBDemo-DRH MTDOT_BOX_EVB_Blinky ... more
Revision 5:c8b00cf49c70, committed 2018-01-31
- Comitter:
- Evan Hosseini
- Date:
- Wed Jan 31 10:15:23 2018 -0600
- Parent:
- 4:ae3ff403404a
- Commit message:
- Remove explicit i2c frequency configuration, should be done by object owner
Changed in this revision
NCP5623B.cpp | Show annotated file Show diff for this revision Revisions of this file |
NCP5623B.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r ae3ff403404a -r c8b00cf49c70 NCP5623B.cpp --- a/NCP5623B.cpp Mon Oct 17 08:42:14 2016 -0500 +++ b/NCP5623B.cpp Wed Jan 31 10:15:23 2018 -0600 @@ -26,7 +26,7 @@ NCP5623B::NCP5623B(I2C &i2c) { - _i2c = &i2c; + _i2c = &i2c; NCP5623B::init(); @@ -37,8 +37,6 @@ { uint8_t result = 0; - _i2c->frequency(400000); - // Turn off all LEDs and initialize all registers result |= NCP5623B::writeRegister(NCP5623B::DIMDWNSET, 0x00); result |= NCP5623B::writeRegister(NCP5623B::DIMTIME, 0x01); @@ -130,5 +128,8 @@ result |= _i2c->write(_i2c_addr, buf, 1); + if (result != 0) + debug("NCP5623B::writeRegister error code: %d\r\n", result); + return result; }
diff -r ae3ff403404a -r c8b00cf49c70 NCP5623B.h --- a/NCP5623B.h Mon Oct 17 08:42:14 2016 -0500 +++ b/NCP5623B.h Wed Jan 31 10:15:23 2018 -0600 @@ -126,10 +126,9 @@ */ uint8_t setDimming(DIMDIRECTION dimdir, uint8_t endstep, uint8_t time) const; -private: - - I2C *_i2c; - uint8_t static const _i2c_addr = (0x38 << 1); +private: + I2C* _i2c; + uint8_t static const _i2c_addr = (0x38 << 1); uint8_t init(void);