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.
Diff: bq76pl536a.h
- Revision:
- 3:a0e12d12f780
- Parent:
- 1:4ae1a58697d7
--- a/bq76pl536a.h Thu Jul 30 01:55:05 2020 +0000 +++ b/bq76pl536a.h Sun Jul 25 18:15:36 2021 +0000 @@ -1,3 +1,13 @@ +///----------------------------------------------------------------- +/// Description: BQ76PL536A Driver +/// Author: David Wahl +/// Date: 13-JUL-2021 +/// Notes: Initial release +/// +/// Revision History: +/// Name: Date: Description: +///----------------------------------------------------------------- + #ifndef BQ76PL536A_H #define BQ76PL536A_H @@ -9,14 +19,12 @@ protected: SPI spi; DigitalOut cs; - - bool *read(u8t deviceAddress, u8t regAddress, u8t count, u8t *pRegisterValue); - void write(u8t deviceAddress, u8t regAddress, u8t regData); - - void adcConvert(); + + + void setAddresses(); void softReset(); - + u8t pec(u8t crcBuffer[], u8t crcLength); public: @@ -25,12 +33,21 @@ //BQ76PL536A(SPI _spi, PinName _cs); BQ76PL536A(); + + bool read(u8t deviceAddress, u8t regAddress, u8t count, u8t *pRegisterValue); + void write(u8t deviceAddress, u8t regAddress, u8t regData); + + void adcConvert(); + bool readAll(u8t deviceAddress); + u8t error, balanceTimeout; u16t cov, cuv; bool balanceEnabled; u8t numDev, attachedCells[]; - - u8t devStatus(); + + u8t bqPackData[65]; + + float cellVolts(u8t lobyte, u8t hibyte); }; #endif \ No newline at end of file