Driver for Texas Instruments' battery state-of-charge estimator.

Dependents:   BQ34Z100G1-Utils BQ34Z100G1-ChemIDMeasurer

BQ34Z100G1 Driver

By USC Rocket Propulsion Lab / Arpad Kovesdy, Kyle Marino, Jamie Smith

After lots of development, testing, debugging, dead ends, backtracking, and retracing our steps, we at RPL are proud to present a complete driver for Texas Instruments' BQ34Z100G1 state-of-charge estimator. This handy chip handles all the complexities of monitoring a battery's charging and discharging cycle, and is one of the only real ways to have a real estimate of how much usable energy is left in a standard lithium-ion battery.

However, in order to perform this function, the IC needs a lot of information, including both the on-paper specifications of your battery system and the results of several different calibration runs of your real battery system. With one exception*, this driver can handle all the needed configuration, taking you from unconfigured to calibrated in as little time as possible.

Note: To initially program the Chem ID information into each chip to configure it for your battery, you will need an EV2300 or EV2400 programmer box from TI, as well as a header to plug it in on your board.

Calibrating the Chip

See here.

Credits

The initial version of this driver was taken from Ralim on GitHub here.

However, we have made a huge number of changes and additions since then, including porting the Arduino library to Mbed, cleaning up the code to use enums, breaking out the configuration to external constants, and fixing looots of bugs.

Committer:
Jamie Smith
Date:
Sun Feb 07 20:36:23 2021 -0800
Revision:
1:6483d36150c3
Parent:
0:6d09d3ad58aa
Fix some inaccurate comments

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jamie Smith 0:6d09d3ad58aa 1 /*
Jamie Smith 0:6d09d3ad58aa 2 USCRPL
Jamie Smith 0:6d09d3ad58aa 3 BQ34Z100-G1 Sensor Driver
Jamie Smith 0:6d09d3ad58aa 4
Jamie Smith 0:6d09d3ad58aa 5 Reads the current state of the main battery, can determine charge remaining inside
Jamie Smith 0:6d09d3ad58aa 6 as well as read instantaneous voltage, current, or temperature.
Jamie Smith 0:6d09d3ad58aa 7
Jamie Smith 0:6d09d3ad58aa 8 Datasheet: http://www.ti.com/lit/ds/symlink/bq34z100-g1.pdf
Jamie Smith 0:6d09d3ad58aa 9 Existing arduino code to reference from unknown author: https://github.com/Ralim/BQ34Z100
Jamie Smith 0:6d09d3ad58aa 10 Partial library from TI that may be useful: http://www.ti.com/lit/an/slua801/slua801.pdf
Jamie Smith 0:6d09d3ad58aa 11 */
Jamie Smith 0:6d09d3ad58aa 12
Jamie Smith 0:6d09d3ad58aa 13 #ifndef BQ34Z100_H
Jamie Smith 0:6d09d3ad58aa 14 #define BQ34Z100_H
Jamie Smith 0:6d09d3ad58aa 15
Jamie Smith 0:6d09d3ad58aa 16 #include <cstdint>
Jamie Smith 0:6d09d3ad58aa 17
Jamie Smith 0:6d09d3ad58aa 18 //Definitions
Jamie Smith 0:6d09d3ad58aa 19 #define GAUGE_ADDRESS 0xAA
Jamie Smith 0:6d09d3ad58aa 20
Jamie Smith 0:6d09d3ad58aa 21 //Battery configuration settings
Jamie Smith 0:6d09d3ad58aa 22 //Stored in flash: run flashSettings() then reset sensor to save
Jamie Smith 0:6d09d3ad58aa 23 #define DESIGNCAP 1400 //mAh, per cell (Page 48, offset 11)
Jamie Smith 0:6d09d3ad58aa 24 #define DESIGNENERGY 5180 //mWh, per cell (Page 48, offset 14)
Jamie Smith 0:6d09d3ad58aa 25 #define CELLCOUNT 0x04 //number of series cells (Page 65, offset 7)
Jamie Smith 1:6483d36150c3 26 #define LEDCONFIG 0x4b //5-LED Expander with I2C host comm (Page 64, offset 4)
Jamie Smith 0:6d09d3ad58aa 27 #define VOLTSEL true //Switches to an external battery voltage divider
Jamie Smith 0:6d09d3ad58aa 28 #define ZEROCHARGEVOLT 3375 //mV, charge cut-off voltage/Cell terminate voltages
Jamie Smith 0:6d09d3ad58aa 29 #define FLASH_UPDATE_OK_VOLT 2800 // mV, below this voltage per cell flash writes will not go through
Jamie Smith 0:6d09d3ad58aa 30
Jamie Smith 1:6483d36150c3 31 #define QMAX0 1400 //mAh, datasheet says to use c-rate current
Jamie Smith 1:6483d36150c3 32
Jamie Smith 0:6d09d3ad58aa 33 //The voltage divider works by this formula: Gain = (TOP LEG R/BOTTOM LEG R)*1000
Jamie Smith 0:6d09d3ad58aa 34 //Top leg: 294Kohm and bottom leg: 16.5Kohm
Jamie Smith 0:6d09d3ad58aa 35 //This only works if you enable the external voltage divider (VOLTSEL) option for the sensor
Jamie Smith 0:6d09d3ad58aa 36 //Note: requires calibration after setting in flash
Jamie Smith 0:6d09d3ad58aa 37 #define VOLTAGEGAIN 17818
Jamie Smith 0:6d09d3ad58aa 38 #define LOADSELECT 0x01 // "Load Select defines the type of power or current model to be used to compute load-compensated capacity in the Impedance Track algorithm"
Jamie Smith 0:6d09d3ad58aa 39 #define LOADMODE 0x00 // "Load Mode is used to select either the constant current or constant power model for the Impedance Track algorithm"
Jamie Smith 0:6d09d3ad58aa 40 #define RESETVOLTAGE 22200 //mV, voltage to reset to after unsuccessful voltage calibration
Jamie Smith 0:6d09d3ad58aa 41
Jamie Smith 0:6d09d3ad58aa 42 //Sense resistor value
Jamie Smith 0:6d09d3ad58aa 43 #define SENSE_RES 5.0f //mOhms, value of guage sense resistor
Jamie Smith 0:6d09d3ad58aa 44
Jamie Smith 0:6d09d3ad58aa 45 #define USE_EXTERNAL_THERMISTOR 0 // If 1, use an external thermistor connected to the IT pin. If 0, use the internal temp sensor.
Jamie Smith 0:6d09d3ad58aa 46
Jamie Smith 0:6d09d3ad58aa 47 #include "mbed.h"
Jamie Smith 0:6d09d3ad58aa 48
Jamie Smith 0:6d09d3ad58aa 49 class BQ34Z100
Jamie Smith 0:6d09d3ad58aa 50 {
Jamie Smith 0:6d09d3ad58aa 51 // Top-level commands - the first byte that you can send on an I2C transaction
Jamie Smith 0:6d09d3ad58aa 52 enum class Command : uint8_t
Jamie Smith 0:6d09d3ad58aa 53 {
Jamie Smith 0:6d09d3ad58aa 54 Control = 0x0,
Jamie Smith 0:6d09d3ad58aa 55 StateOfCharge = 0x2,
Jamie Smith 0:6d09d3ad58aa 56 MaxError = 0x3,
Jamie Smith 0:6d09d3ad58aa 57 RemainingCapacity = 0x4,
Jamie Smith 0:6d09d3ad58aa 58 FullChargeCapacity = 0x6,
Jamie Smith 0:6d09d3ad58aa 59 Voltage = 0x8,
Jamie Smith 0:6d09d3ad58aa 60 AverageCurrent = 0xA,
Jamie Smith 0:6d09d3ad58aa 61 Temperature = 0xC,
Jamie Smith 0:6d09d3ad58aa 62 Flags = 0xE,
Jamie Smith 0:6d09d3ad58aa 63 Current = 0x10,
Jamie Smith 0:6d09d3ad58aa 64 FlagsB = 0x12,
Jamie Smith 0:6d09d3ad58aa 65 // ...
Jamie Smith 0:6d09d3ad58aa 66 SerialNumber = 0x28,
Jamie Smith 0:6d09d3ad58aa 67 InternalTemperature = 0x2A,
Jamie Smith 0:6d09d3ad58aa 68 CycleCount = 0x2C,
Jamie Smith 0:6d09d3ad58aa 69 StateOfHealth = 0x2E,
Jamie Smith 0:6d09d3ad58aa 70 // ...
Jamie Smith 0:6d09d3ad58aa 71 DataFlashClass = 0x3E,
Jamie Smith 0:6d09d3ad58aa 72 DataFlashBlock = 0x3F,
Jamie Smith 0:6d09d3ad58aa 73 BlockData = 0x40,
Jamie Smith 0:6d09d3ad58aa 74 // ...
Jamie Smith 0:6d09d3ad58aa 75 BlockDataCheckSum = 0x60,
Jamie Smith 0:6d09d3ad58aa 76 BlockDataControl = 0x61
Jamie Smith 0:6d09d3ad58aa 77 };
Jamie Smith 0:6d09d3ad58aa 78
Jamie Smith 0:6d09d3ad58aa 79 // subcommands for Control command
Jamie Smith 0:6d09d3ad58aa 80 enum class Control : uint16_t
Jamie Smith 0:6d09d3ad58aa 81 {
Jamie Smith 0:6d09d3ad58aa 82 CONTROL_STATUS = 0x0,
Jamie Smith 0:6d09d3ad58aa 83 DEVICE_TYPE = 0x1,
Jamie Smith 0:6d09d3ad58aa 84 FW_VERSION = 0x02,
Jamie Smith 0:6d09d3ad58aa 85 HW_VERSION = 0x03,
Jamie Smith 0:6d09d3ad58aa 86 RESET_DATA = 0x5,
Jamie Smith 0:6d09d3ad58aa 87 PREV_MACWRITE = 0x7,
Jamie Smith 0:6d09d3ad58aa 88 CHEM_ID = 0x8,
Jamie Smith 0:6d09d3ad58aa 89 BOARD_OFFSET = 0x9,
Jamie Smith 0:6d09d3ad58aa 90 CC_OFFSET = 0xA,
Jamie Smith 0:6d09d3ad58aa 91 CC_OFFSET_SAVE = 0xB,
Jamie Smith 0:6d09d3ad58aa 92 DF_VERSION = 0xC,
Jamie Smith 0:6d09d3ad58aa 93 SET_FULLSLEEP = 0x10,
Jamie Smith 0:6d09d3ad58aa 94 STATIC_CHEM_CHECKSUM = 0x17,
Jamie Smith 0:6d09d3ad58aa 95 SEALED = 0x20,
Jamie Smith 0:6d09d3ad58aa 96 IT_ENABLE = 0x21,
Jamie Smith 0:6d09d3ad58aa 97 CAL_ENABLE = 0x2D,
Jamie Smith 0:6d09d3ad58aa 98 RESET = 0x41,
Jamie Smith 0:6d09d3ad58aa 99 EXIT_CAL = 0x80,
Jamie Smith 0:6d09d3ad58aa 100 ENTER_CAL = 0x81,
Jamie Smith 0:6d09d3ad58aa 101 OFFSET_CAL = 0x82,
Jamie Smith 0:6d09d3ad58aa 102
Jamie Smith 0:6d09d3ad58aa 103 // unseal key, from datasheet p.21
Jamie Smith 0:6d09d3ad58aa 104 UNSEAL_KEY1 = 0x0414,
Jamie Smith 0:6d09d3ad58aa 105 UNSEAL_KEY2 = 0x3672
Jamie Smith 0:6d09d3ad58aa 106 };
Jamie Smith 0:6d09d3ad58aa 107
Jamie Smith 0:6d09d3ad58aa 108 public:
Jamie Smith 0:6d09d3ad58aa 109 /** Create an GQ34Z100-G1 object connected to the specified I2C pins
Jamie Smith 0:6d09d3ad58aa 110 *
Jamie Smith 0:6d09d3ad58aa 111 * @param sda The I2C data pin.
Jamie Smith 0:6d09d3ad58aa 112 * @param scl The I2C clock pin.
Jamie Smith 0:6d09d3ad58aa 113 * @param hz The I2C bus frequency (400kHz acc. to datasheet).
Jamie Smith 0:6d09d3ad58aa 114 */
Jamie Smith 0:6d09d3ad58aa 115 BQ34Z100(PinName sda, PinName scl, int hz = 400000);
Jamie Smith 0:6d09d3ad58aa 116
Jamie Smith 0:6d09d3ad58aa 117 //returs status of key features
Jamie Smith 0:6d09d3ad58aa 118 uint16_t getStatus();
Jamie Smith 0:6d09d3ad58aa 119
Jamie Smith 0:6d09d3ad58aa 120 //Allows use of the entry and exit functions to the CALIBRATION mode
Jamie Smith 0:6d09d3ad58aa 121 //Use before enterCal or exitCal()
Jamie Smith 0:6d09d3ad58aa 122 void enableCal();
Jamie Smith 0:6d09d3ad58aa 123
Jamie Smith 0:6d09d3ad58aa 124 //Enables CALIBRATION mode
Jamie Smith 0:6d09d3ad58aa 125 void enterCal();
Jamie Smith 0:6d09d3ad58aa 126
Jamie Smith 0:6d09d3ad58aa 127 //Exits CALIBRATION mode
Jamie Smith 0:6d09d3ad58aa 128 void exitCal();
Jamie Smith 0:6d09d3ad58aa 129
Jamie Smith 0:6d09d3ad58aa 130 //Allows the sensor to begin the Impednance Track algorithm (learns about
Jamie Smith 0:6d09d3ad58aa 131 //the battery and begins to find the SOC)
Jamie Smith 0:6d09d3ad58aa 132 void ITEnable();
Jamie Smith 0:6d09d3ad58aa 133
Jamie Smith 0:6d09d3ad58aa 134 //Returns the predicted remaining battery capacity expressed as a percentage
Jamie Smith 0:6d09d3ad58aa 135 //From 0% to 100%
Jamie Smith 0:6d09d3ad58aa 136 uint8_t getSOC();
Jamie Smith 0:6d09d3ad58aa 137
Jamie Smith 0:6d09d3ad58aa 138 //Returns the expected margin of error in the SOC calculation ranging from
Jamie Smith 0:6d09d3ad58aa 139 //1% to 100%. The value is updated continuously internally in increments
Jamie Smith 0:6d09d3ad58aa 140 //of 0.05%
Jamie Smith 0:6d09d3ad58aa 141 uint16_t getError();
Jamie Smith 0:6d09d3ad58aa 142
Jamie Smith 0:6d09d3ad58aa 143 //Estimated remaining battery capacity (1 mAH per bit)
Jamie Smith 0:6d09d3ad58aa 144 uint16_t getRemaining();
Jamie Smith 0:6d09d3ad58aa 145
Jamie Smith 0:6d09d3ad58aa 146 //Returns the measured battery voltage in mV (0 to 65535 mV)
Jamie Smith 0:6d09d3ad58aa 147 uint16_t getVoltage();
Jamie Smith 0:6d09d3ad58aa 148
Jamie Smith 0:6d09d3ad58aa 149 //Returns measured current flow through the sense resistor (mA)
Jamie Smith 0:6d09d3ad58aa 150 int16_t getCurrent();
Jamie Smith 0:6d09d3ad58aa 151
Jamie Smith 0:6d09d3ad58aa 152 //Returns internal sensor temperature in units of celsius
Jamie Smith 0:6d09d3ad58aa 153 double getTemperature();
Jamie Smith 0:6d09d3ad58aa 154
Jamie Smith 0:6d09d3ad58aa 155 //Returns the current ChemID configured inside the chip.
Jamie Smith 0:6d09d3ad58aa 156 // Returns as a hex number, e.g. programming ID 2109 would cause
Jamie Smith 0:6d09d3ad58aa 157 // this function to return 8457 = 0x2109
Jamie Smith 0:6d09d3ad58aa 158 uint16_t getChemID();
Jamie Smith 0:6d09d3ad58aa 159
Jamie Smith 0:6d09d3ad58aa 160 //Returns a percent from 0 to 100 that is the ratio of the predicted FCC over the design capacity
Jamie Smith 0:6d09d3ad58aa 161 //FCC = the full charge capacity
Jamie Smith 0:6d09d3ad58aa 162 //For example, an old battery will not be able to charge fully to its design capacity
Jamie Smith 0:6d09d3ad58aa 163 //This sensor can tell us if we should throw the battery away because its worn out! Cool!
Jamie Smith 0:6d09d3ad58aa 164 uint16_t getStateOfHealth();
Jamie Smith 0:6d09d3ad58aa 165
Jamie Smith 0:6d09d3ad58aa 166 //Returns the pack serial number programmed in the data flash
Jamie Smith 0:6d09d3ad58aa 167 int getSerial();
Jamie Smith 0:6d09d3ad58aa 168
Jamie Smith 0:6d09d3ad58aa 169 //Instructs the fuel gauge to perform a full reset. This command is only
Jamie Smith 0:6d09d3ad58aa 170 //available when the fuel gauge is UNSEALED
Jamie Smith 0:6d09d3ad58aa 171 void reset();
Jamie Smith 0:6d09d3ad58aa 172
Jamie Smith 0:6d09d3ad58aa 173 //Unseal some registers, allowing writing (recommended before writing to flash)
Jamie Smith 0:6d09d3ad58aa 174 void unseal();
Jamie Smith 0:6d09d3ad58aa 175
Jamie Smith 0:6d09d3ad58aa 176 //Reverse unseal command, do not recommend ever using this
Jamie Smith 0:6d09d3ad58aa 177 void seal();
Jamie Smith 0:6d09d3ad58aa 178
Jamie Smith 0:6d09d3ad58aa 179 //Data flash functions
Jamie Smith 0:6d09d3ad58aa 180
Jamie Smith 0:6d09d3ad58aa 181 //Changes to a different register in BlockData()
Jamie Smith 0:6d09d3ad58aa 182 void changePage(char subclass, uint16_t offset);
Jamie Smith 0:6d09d3ad58aa 183
Jamie Smith 0:6d09d3ad58aa 184 //Reads the checksum and updates it using the flashbytes array
Jamie Smith 0:6d09d3ad58aa 185 //Required by the sensor to save changes to the flash
Jamie Smith 0:6d09d3ad58aa 186 void updateChecksum();
Jamie Smith 0:6d09d3ad58aa 187
Jamie Smith 0:6d09d3ad58aa 188 //Reads the blockData in the current page and saves it to
Jamie Smith 0:6d09d3ad58aa 189 //flashbytes array
Jamie Smith 0:6d09d3ad58aa 190 void readFlash();
Jamie Smith 0:6d09d3ad58aa 191
Jamie Smith 0:6d09d3ad58aa 192 //Writes a specific index in the page to a given value
Jamie Smith 0:6d09d3ad58aa 193 //given the length of the property
Jamie Smith 0:6d09d3ad58aa 194 void writeFlash(uint8_t index, uint32_t value, int len);
Jamie Smith 0:6d09d3ad58aa 195
Jamie Smith 0:6d09d3ad58aa 196 //Returns array (pointer) to flashbytes internal array
Jamie Smith 0:6d09d3ad58aa 197 //which stores the last updated page in flash
Jamie Smith 0:6d09d3ad58aa 198 uint8_t* getFlashBytes();
Jamie Smith 0:6d09d3ad58aa 199
Jamie Smith 0:6d09d3ad58aa 200 //The following functions change different pages
Jamie Smith 0:6d09d3ad58aa 201 //The number is the subClass ID that is being changed
Jamie Smith 0:6d09d3ad58aa 202 //Each page has different properties that are in those registers
Jamie Smith 0:6d09d3ad58aa 203 void changePage48();
Jamie Smith 0:6d09d3ad58aa 204 void changePage64();
Jamie Smith 0:6d09d3ad58aa 205 void changePage80();
Jamie Smith 0:6d09d3ad58aa 206 void changePage82();
Jamie Smith 0:6d09d3ad58aa 207
Jamie Smith 0:6d09d3ad58aa 208 //Calibrates the Voltage Divider register (run at least 3 times sequentially)
Jamie Smith 0:6d09d3ad58aa 209 // NOTE: Voltage divider changes seem to require a chip reset to take effect.
Jamie Smith 0:6d09d3ad58aa 210 // So you must reset the chip between each calibration.
Jamie Smith 0:6d09d3ad58aa 211 uint16_t calibrateVoltage(uint16_t currentVoltage);
Jamie Smith 0:6d09d3ad58aa 212
Jamie Smith 0:6d09d3ad58aa 213 //If a problem arises with the voltage divider calibration,
Jamie Smith 0:6d09d3ad58aa 214 //reset the register with this function
Jamie Smith 0:6d09d3ad58aa 215 void setVoltageDivider(uint16_t newVoltage = RESETVOLTAGE);
Jamie Smith 0:6d09d3ad58aa 216
Jamie Smith 0:6d09d3ad58aa 217 //Calibrate CCGain and CCOffset registers, which control current shunt
Jamie Smith 0:6d09d3ad58aa 218 //and therefore affect the current and voltage readouts
Jamie Smith 0:6d09d3ad58aa 219 void calibrateShunt(int16_t calCurrent);
Jamie Smith 0:6d09d3ad58aa 220
Jamie Smith 0:6d09d3ad58aa 221 //Set the Chem ID in the flash
Jamie Smith 0:6d09d3ad58aa 222 void setChemID();
Jamie Smith 0:6d09d3ad58aa 223
Jamie Smith 0:6d09d3ad58aa 224 //Set sense resistor - Calibrate shunt also works, but that requires and external
Jamie Smith 0:6d09d3ad58aa 225 //current measurement.
Jamie Smith 0:6d09d3ad58aa 226 void setSenseResistor();
Jamie Smith 0:6d09d3ad58aa 227
Jamie Smith 0:6d09d3ad58aa 228 // Read the device type. Should be 0x100 for the BQ34Z100.
Jamie Smith 0:6d09d3ad58aa 229 uint16_t readDeviceType();
Jamie Smith 0:6d09d3ad58aa 230
Jamie Smith 0:6d09d3ad58aa 231 // reads the contents of the SW and HW version registers.
Jamie Smith 0:6d09d3ad58aa 232 uint16_t readFWVersion();
Jamie Smith 0:6d09d3ad58aa 233 uint16_t readHWVersion();
Jamie Smith 0:6d09d3ad58aa 234
Jamie Smith 0:6d09d3ad58aa 235 // Convert float value to Xemics floating point used on the BQZ.
Jamie Smith 0:6d09d3ad58aa 236 // Documented in this app note: http://www.ti.com/lit/pdf/slva148
Jamie Smith 0:6d09d3ad58aa 237 static uint32_t floatToXemics(float value);
Jamie Smith 0:6d09d3ad58aa 238 static float xemicsToFloat(uint32_t xemics);
Jamie Smith 0:6d09d3ad58aa 239
Jamie Smith 0:6d09d3ad58aa 240 // Read the update status register from flash.
Jamie Smith 0:6d09d3ad58aa 241 // This gives the status of the Impedance Track algorithm and learning process.
Jamie Smith 0:6d09d3ad58aa 242 uint8_t getUpdateStatus();
Jamie Smith 0:6d09d3ad58aa 243
Jamie Smith 0:6d09d3ad58aa 244 /**
Jamie Smith 0:6d09d3ad58aa 245 * Use the Flags and FlagsB commands to get the contents of the Gas Gauge Status Register.
Jamie Smith 0:6d09d3ad58aa 246 * @return
Jamie Smith 0:6d09d3ad58aa 247 */
Jamie Smith 0:6d09d3ad58aa 248 std::pair<uint16_t, uint16_t> getFlags();
Jamie Smith 0:6d09d3ad58aa 249
Jamie Smith 0:6d09d3ad58aa 250 private:
Jamie Smith 0:6d09d3ad58aa 251 I2C _i2c;
Jamie Smith 0:6d09d3ad58aa 252 uint8_t currFlashPage = 0; // current flash page that we have read
Jamie Smith 0:6d09d3ad58aa 253 uint8_t currFlashBlockIndex = 0; // 32 bit block index into current flash page
Jamie Smith 0:6d09d3ad58aa 254 uint8_t flashbytes[32]; //Stores page in flash memory on Hamster
Jamie Smith 0:6d09d3ad58aa 255
Jamie Smith 0:6d09d3ad58aa 256 //Internal commands for writing/reading i2c
Jamie Smith 0:6d09d3ad58aa 257
Jamie Smith 0:6d09d3ad58aa 258 // Send a control command and return the result
Jamie Smith 0:6d09d3ad58aa 259 void sendControlCommand(Control control);
Jamie Smith 0:6d09d3ad58aa 260
Jamie Smith 0:6d09d3ad58aa 261 uint16_t readControlCommand(Control control);
Jamie Smith 0:6d09d3ad58aa 262
Jamie Smith 0:6d09d3ad58aa 263 void write(Command command, const uint8_t cmd); //1 byte only
Jamie Smith 0:6d09d3ad58aa 264 void write(Command command, const uint8_t cmd1, const uint8_t cmd2); //2 bytes
Jamie Smith 0:6d09d3ad58aa 265 uint32_t read(Command command, const uint8_t length);
Jamie Smith 0:6d09d3ad58aa 266
Jamie Smith 0:6d09d3ad58aa 267 // Calculate the checksum of the current flashbytes
Jamie Smith 0:6d09d3ad58aa 268 uint8_t calcChecksum();
Jamie Smith 0:6d09d3ad58aa 269 };
Jamie Smith 0:6d09d3ad58aa 270 #endif