Initial rough start to the BQ76PL536A (or BQ76PL536A-Q1) code. Free to use as long as you make any changes/improvements publicly available. Please notify me of any improvements.
bq76pl536a.h@0:47a258755906, 2017-05-14 (annotated)
- Committer:
- dmwahl
- Date:
- Sun May 14 20:40:36 2017 +0000
- Revision:
- 0:47a258755906
- Child:
- 1:4ae1a58697d7
Basic class compiles
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dmwahl | 0:47a258755906 | 1 | #ifndef BQ76PL536A_H |
dmwahl | 0:47a258755906 | 2 | #define BQ76PL536A_H |
dmwahl | 0:47a258755906 | 3 | |
dmwahl | 0:47a258755906 | 4 | #include "mbed.h" |
dmwahl | 0:47a258755906 | 5 | #include "bq76pl536a_typedefs.h" |
dmwahl | 0:47a258755906 | 6 | |
dmwahl | 0:47a258755906 | 7 | class BQ76PL536A |
dmwahl | 0:47a258755906 | 8 | { |
dmwahl | 0:47a258755906 | 9 | protected: |
dmwahl | 0:47a258755906 | 10 | SPI spi; |
dmwahl | 0:47a258755906 | 11 | DigitalOut cs; |
dmwahl | 0:47a258755906 | 12 | |
dmwahl | 0:47a258755906 | 13 | bool *read(u8t deviceAddress, u8t regAddress, u8t count, u8t *pRegisterValue); |
dmwahl | 0:47a258755906 | 14 | void write(u8t deviceAddress, u8t regAddress, u8t regData); |
dmwahl | 0:47a258755906 | 15 | |
dmwahl | 0:47a258755906 | 16 | void adcConvert(); |
dmwahl | 0:47a258755906 | 17 | void setAddresses(); |
dmwahl | 0:47a258755906 | 18 | void softReset(); |
dmwahl | 0:47a258755906 | 19 | |
dmwahl | 0:47a258755906 | 20 | u8t pec(u8t crcBuffer[]); |
dmwahl | 0:47a258755906 | 21 | |
dmwahl | 0:47a258755906 | 22 | public: |
dmwahl | 0:47a258755906 | 23 | // (SPI object, PinName cs, u8t attachedCells[], u16t cov[mV], u16t cuv[mV], u8t balanceTimeout[sec], bool balanceEnabled) |
dmwahl | 0:47a258755906 | 24 | BQ76PL536A(SPI _spi, PinName _cs, u8t _numDev, u16t _cov, u16t _cuv, u8t _balanceTimeout, bool balanceEnabled); |
dmwahl | 0:47a258755906 | 25 | //BQ76PL536A(SPI _spi, PinName _cs); |
dmwahl | 0:47a258755906 | 26 | |
dmwahl | 0:47a258755906 | 27 | BQ76PL536A(); |
dmwahl | 0:47a258755906 | 28 | u8t error, balanceTimeout; |
dmwahl | 0:47a258755906 | 29 | u16t cov, cuv; |
dmwahl | 0:47a258755906 | 30 | bool balanceEnabled; |
dmwahl | 0:47a258755906 | 31 | u8t numDev, attachedCells[]; |
dmwahl | 0:47a258755906 | 32 | }; |
dmwahl | 0:47a258755906 | 33 | |
dmwahl | 0:47a258755906 | 34 | #endif |