This class provides APIs to all of the registers of the TI BQ27441 battery gauge, as used on the u-blox C030 board. The caller should instantiate an I2C interface and pass this to init(), which will initialise the chip and place it into its lowest power state. When battery gauging is enabled, the getRemainingCapacity()/getRemainingPercentage() API calls may be used; otherwise the chip will be maintained in its lowest power state until a voltage/current/temperature reading is requested.

Dependents:   example-battery-gauge-bq27441

Committer:
breadboardbasics
Date:
Wed Dec 13 17:14:51 2017 +0000
Revision:
6:998cc334f8f2
Parent:
5:63b325f2c21a
Fixes current = 0 problem and adds power measurement capability

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rob.meades@u-blox.com 1:566163f17cde 1 /* mbed Microcontroller Library
rob.meades@u-blox.com 1:566163f17cde 2 * Copyright (c) 2017 u-blox
rob.meades@u-blox.com 1:566163f17cde 3 *
rob.meades@u-blox.com 1:566163f17cde 4 * Licensed under the Apache License, Version 2.0 (the "License");
rob.meades@u-blox.com 1:566163f17cde 5 * you may not use this file except in compliance with the License.
rob.meades@u-blox.com 1:566163f17cde 6 * You may obtain a copy of the License at
rob.meades@u-blox.com 1:566163f17cde 7 *
rob.meades@u-blox.com 1:566163f17cde 8 * http://www.apache.org/licenses/LICENSE-2.0
rob.meades@u-blox.com 1:566163f17cde 9 *
rob.meades@u-blox.com 1:566163f17cde 10 * Unless required by applicable law or agreed to in writing, software
rob.meades@u-blox.com 1:566163f17cde 11 * distributed under the License is distributed on an "AS IS" BASIS,
rob.meades@u-blox.com 1:566163f17cde 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rob.meades@u-blox.com 1:566163f17cde 13 * See the License for the specific language governing permissions and
rob.meades@u-blox.com 1:566163f17cde 14 * limitations under the License.
rob.meades@u-blox.com 1:566163f17cde 15 */
rob.meades@u-blox.com 1:566163f17cde 16
rob.meades@u-blox.com 1:566163f17cde 17 #ifndef BATTERY_GAUGE_BQ27441_H
rob.meades@u-blox.com 1:566163f17cde 18 #define BATTERY_GAUGE_BQ27441_H
rob.meades@u-blox.com 1:566163f17cde 19
rob.meades@u-blox.com 1:566163f17cde 20 /**
rob.meades@u-blox.com 1:566163f17cde 21 * @file battery_gauge_bq27441.h
rob.meades@u-blox.com 1:566163f17cde 22 * This file defines the API to the TI BQ27441 battery gauge chip.
rob.meades@u-blox.com 1:566163f17cde 23 */
rob.meades@u-blox.com 1:566163f17cde 24
RobMeades 2:93310a83401a 25 /* ----------------------------------------------------------------
RobMeades 2:93310a83401a 26 * COMPILE-TIME MACROS
RobMeades 2:93310a83401a 27 * -------------------------------------------------------------- */
rob.meades@u-blox.com 1:566163f17cde 28
RobMeades 2:93310a83401a 29 /** Device I2C address. */
rob.meades@u-blox.com 1:566163f17cde 30 #define BATTERY_GAUGE_BQ27441_ADDRESS 0x55
rob.meades@u-blox.com 1:566163f17cde 31
RobMeades 2:93310a83401a 32 /** The default seal code. */
rob.meades@u-blox.com 1:566163f17cde 33 #define SEAL_CODE_DEFAULT 0x8000
rob.meades@u-blox.com 1:566163f17cde 34
RobMeades 2:93310a83401a 35 /* ----------------------------------------------------------------
RobMeades 2:93310a83401a 36 * CLASSES
RobMeades 2:93310a83401a 37 * -------------------------------------------------------------- */
rob.meades@u-blox.com 1:566163f17cde 38
RobMeades 2:93310a83401a 39 /** BQ27441 battery gauge driver. */
rob.meades@u-blox.com 1:566163f17cde 40 class BatteryGaugeBq27441 {
rob.meades@u-blox.com 1:566163f17cde 41 public:
rob.meades@u-blox.com 1:566163f17cde 42
RobMeades 2:93310a83401a 43 /** Constructor. */
rob.meades@u-blox.com 1:566163f17cde 44 BatteryGaugeBq27441(void);
RobMeades 2:93310a83401a 45 /** Destructor. */
rob.meades@u-blox.com 1:566163f17cde 46 ~BatteryGaugeBq27441(void);
rob.meades@u-blox.com 1:566163f17cde 47
RobMeades 2:93310a83401a 48 /** Initialise the BQ27441 chip. Once initialised
RobMeades 2:93310a83401a 49 * the chip is put into its lowest power state. Any API call
RobMeades 2:93310a83401a 50 * will awaken the chip from this state and then return it once
RobMeades 2:93310a83401a 51 * more to the lowest possible power state.
RobMeades 2:93310a83401a 52 * @param pI2c a pointer to the I2C instance to use.
RobMeades 2:93310a83401a 53 * @param address 7-bit I2C address of the battery gauge chip.
RobMeades 2:93310a83401a 54 * @param sealCode the 16 bit seal code that will unseal the device if it is sealed.
RobMeades 2:93310a83401a 55 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 56 */
rob.meades@u-blox.com 1:566163f17cde 57 bool init (I2C * pI2c, uint8_t address = BATTERY_GAUGE_BQ27441_ADDRESS, uint16_t sealCode = SEAL_CODE_DEFAULT);
rob.meades@u-blox.com 1:566163f17cde 58
RobMeades 2:93310a83401a 59 /** Switch on the battery gauge. Battery gauging must be switched on
RobMeades 2:93310a83401a 60 * for the battery capacity and percentage readings to be valid. The
RobMeades 2:93310a83401a 61 * chip will consume more when battery gauging is switched on.
RobMeades 2:93310a83401a 62 * @param isSlow set this to true to save power if the battery current is not fluctuating very much.
RobMeades 2:93310a83401a 63 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 64 */
rob.meades@u-blox.com 1:566163f17cde 65 bool enableGauge (bool isSlow = false);
rob.meades@u-blox.com 1:566163f17cde 66
RobMeades 2:93310a83401a 67 /** Switch off the battery gauge.
RobMeades 2:93310a83401a 68 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 69 */
rob.meades@u-blox.com 1:566163f17cde 70 bool disableGauge (void);
rob.meades@u-blox.com 1:566163f17cde 71
rob.meades@u-blox.com 3:ebd56471d57c 72 /** Check whether battery gauging is enabled or not.
rob.meades@u-blox.com 3:ebd56471d57c 73 * @return true if battery gauging is enabled, otherwise false.
rob.meades@u-blox.com 3:ebd56471d57c 74 */
rob.meades@u-blox.com 3:ebd56471d57c 75 bool isGaugeEnabled(void);
rob.meades@u-blox.com 3:ebd56471d57c 76
rob.meades@u-blox.com 5:63b325f2c21a 77 /** Enable the battery detect pin of the chip.
rob.meades@u-blox.com 5:63b325f2c21a 78 * Default is enabled.
rob.meades@u-blox.com 5:63b325f2c21a 79 * @return true if successful, otherwise false.
rob.meades@u-blox.com 5:63b325f2c21a 80 */
rob.meades@u-blox.com 5:63b325f2c21a 81 bool enableBatteryDetect ();
rob.meades@u-blox.com 5:63b325f2c21a 82
rob.meades@u-blox.com 5:63b325f2c21a 83 /** Disable the battery detect pin of the chip and
rob.meades@u-blox.com 5:63b325f2c21a 84 * assume that the battery is ALWAYS connected.
rob.meades@u-blox.com 5:63b325f2c21a 85 * Default is that battery detect is enabled.
rob.meades@u-blox.com 5:63b325f2c21a 86 * @return true if successful, otherwise false.
rob.meades@u-blox.com 5:63b325f2c21a 87 */
rob.meades@u-blox.com 5:63b325f2c21a 88 bool disableBatteryDetect (void);
rob.meades@u-blox.com 5:63b325f2c21a 89
RobMeades 2:93310a83401a 90 /** Determine whether a battery has been detected or not.
rob.meades@u-blox.com 5:63b325f2c21a 91 * If battery detection is disabled, this function will always
rob.meades@u-blox.com 5:63b325f2c21a 92 * return true.
RobMeades 2:93310a83401a 93 * @return true if a battery has been detected, otherwise false.
RobMeades 2:93310a83401a 94 */
rob.meades@u-blox.com 1:566163f17cde 95 bool isBatteryDetected (void);
rob.meades@u-blox.com 1:566163f17cde 96
RobMeades 2:93310a83401a 97 /** Read the temperature of the BQ27441 chip.
RobMeades 2:93310a83401a 98 * If battery gauging is off this function will take ~1 second
RobMeades 2:93310a83401a 99 * to return while the ADCs are activated and the reading is taken.
RobMeades 2:93310a83401a 100 * If battery gauging is on, the last temperature reading taken
RobMeades 2:93310a83401a 101 * will be returned without delay.
RobMeades 2:93310a83401a 102 * @param pTemperatureC place to put the temperature reading.
RobMeades 2:93310a83401a 103 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 104 */
rob.meades@u-blox.com 1:566163f17cde 105 bool getTemperature (int32_t *pTemperatureC);
rob.meades@u-blox.com 1:566163f17cde 106
RobMeades 2:93310a83401a 107 /** Read the voltage of the battery.
RobMeades 2:93310a83401a 108 * If battery gauging is off this function will take ~1 second
RobMeades 2:93310a83401a 109 * to return while the ADCs are activated and the reading is taken.
RobMeades 2:93310a83401a 110 * If battery gauging is on, the last voltage reading taken
RobMeades 2:93310a83401a 111 * will be returned without delay.
RobMeades 2:93310a83401a 112 * @param pVoltageMV place to put the voltage reading.
RobMeades 2:93310a83401a 113 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 114 */
rob.meades@u-blox.com 1:566163f17cde 115 bool getVoltage (int32_t *pVoltageMV);
breadboardbasics 6:998cc334f8f2 116
breadboardbasics 6:998cc334f8f2 117 /** Read the power output the battery.
breadboardbasics 6:998cc334f8f2 118 * If battery gauging is off this function will take ~1 second
breadboardbasics 6:998cc334f8f2 119 * to return while the ADCs are activated and the reading is taken.
breadboardbasics 6:998cc334f8f2 120 * If battery gauging is on, the last voltage reading taken
breadboardbasics 6:998cc334f8f2 121 * will be returned without delay.
breadboardbasics 6:998cc334f8f2 122 * @param pPowerMW place to put the power reading.
breadboardbasics 6:998cc334f8f2 123 * @return true if successful, otherwise false.
breadboardbasics 6:998cc334f8f2 124 */
breadboardbasics 6:998cc334f8f2 125 bool getPower (int32_t *pPowerMW);
rob.meades@u-blox.com 1:566163f17cde 126
RobMeades 2:93310a83401a 127 /** Read the current flowing from the battery.
breadboardbasics 6:998cc334f8f2 128 * Negative value means battery is being drained
breadboardbasics 6:998cc334f8f2 129 * Positive value means battery is being charged
RobMeades 2:93310a83401a 130 * If battery gauging is off this function will take ~1 second
RobMeades 2:93310a83401a 131 * to return while the ADCs are activated and the reading is taken.
RobMeades 2:93310a83401a 132 * If battery gauging is on, the last current reading taken
RobMeades 2:93310a83401a 133 * will be returned without delay.
RobMeades 2:93310a83401a 134 * @param pCurrentMA place to put the current reading.
RobMeades 2:93310a83401a 135 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 136 */
rob.meades@u-blox.com 1:566163f17cde 137 bool getCurrent (int32_t *pCurrentMA);
rob.meades@u-blox.com 1:566163f17cde 138
RobMeades 2:93310a83401a 139 /** Read the remaining available battery energy.
RobMeades 2:93310a83401a 140 * The battery capacity reading will only be valid if
RobMeades 2:93310a83401a 141 * battery gauging is switched on.
RobMeades 2:93310a83401a 142 * @param pCapacityMAh place to put the capacity reading.
RobMeades 2:93310a83401a 143 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 144 */
rob.meades@u-blox.com 1:566163f17cde 145 bool getRemainingCapacity (int32_t *pCapacityMAh);
rob.meades@u-blox.com 1:566163f17cde 146
RobMeades 2:93310a83401a 147 /** Read the state of charge of the battery as a percentage.
RobMeades 2:93310a83401a 148 * The remaining percentage will only be valid if battery
RobMeades 2:93310a83401a 149 * gauging is switched on.
RobMeades 2:93310a83401a 150 * @param pBatteryPercent place to put the reading.
RobMeades 2:93310a83401a 151 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 152 */
rob.meades@u-blox.com 1:566163f17cde 153 bool getRemainingPercentage (int32_t *pBatteryPercent);
rob.meades@u-blox.com 1:566163f17cde 154
RobMeades 2:93310a83401a 155 /** An advanced function to read configuration data from the BQ27441 chip memory.
RobMeades 2:93310a83401a 156 * Please refer to the TI BQ27441 technical reference manual for details of classId,
RobMeades 2:93310a83401a 157 * offset, the meanings of the data structures and their lengths.
RobMeades 2:93310a83401a 158 * PLEASE READ THIS HEADER FILE DIRECTLY, DOXYGEN MANGLES THE NEXT BIT
RobMeades 2:93310a83401a 159 * Note: the chip handles the data for each sub-class in 32 byte blocks and the offset/
RobMeades 2:93310a83401a 160 * length combination used must respect this. For instance:
RobMeades 2:93310a83401a 161 *
RobMeades 2:93310a83401a 162 * Sub-class N (length 87 bytes)
RobMeades 2:93310a83401a 163 * bytes 0 to 31 bytes 32 to 63 bytes 64 to 86
RobMeades 2:93310a83401a 164 * -------------------------------- -------------------------------- -----------------------
RobMeades 2:93310a83401a 165 * | Data Block 0 || xx Data Block 1 yy ||zz Data Block 2 |
RobMeades 2:93310a83401a 166 * -------------------------------- -------------------------------- -----------------------
RobMeades 2:93310a83401a 167 *
RobMeades 2:93310a83401a 168 * To read item xx, 2 bytes long at offset 36, one would specify an offset of 36 and a length
RobMeades 2:93310a83401a 169 * of 2. To read both xx and yy at the same time (yy being 2 bytes long at offset 56),
RobMeades 2:93310a83401a 170 * one could specify an offset of 36 and a length of 21. However, one could not read xx, yy
RobMeades 2:93310a83401a 171 * and zz at the same time, or yy and zz at the same time, since they fall into different blocks;
RobMeades 2:93310a83401a 172 * two separate reads are required.
RobMeades 2:93310a83401a 173 * @param subClassId the sub-class ID of the block.
RobMeades 2:93310a83401a 174 * @param offset the offset of the data within the class.
RobMeades 2:93310a83401a 175 * @param length the amount of data to read.
RobMeades 2:93310a83401a 176 * @param pData a place to put the read data.
RobMeades 2:93310a83401a 177 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 178 */
rob.meades@u-blox.com 1:566163f17cde 179 bool advancedGetConfig(uint8_t subClassId, int32_t offset, int32_t length, char * pData);
rob.meades@u-blox.com 1:566163f17cde 180
RobMeades 2:93310a83401a 181 /** An advanced function to write configuration data to the BQ27441 chip memory.
RobMeades 2:93310a83401a 182 * Please refer to the TI BQ27441 technical reference manual for details of classId,
RobMeades 2:93310a83401a 183 * offset, the meanings of the data structures and their lengths. See also the note above
RobMeades 2:93310a83401a 184 * advancedGetConfig() about how to use offset and length. If this function is used to
RobMeades 2:93310a83401a 185 * change the seal code for the chip then init() should be called once more to
RobMeades 2:93310a83401a 186 * update the seal code used by this driver.
RobMeades 2:93310a83401a 187 * @param subClassId the sub-class ID of the block.
RobMeades 2:93310a83401a 188 * @param offset the offset of the data within the class.
RobMeades 2:93310a83401a 189 * @param length the length of the data to be written.
RobMeades 2:93310a83401a 190 * @param pData a pointer to the data to be written.
RobMeades 2:93310a83401a 191 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 192 */
rob.meades@u-blox.com 1:566163f17cde 193 bool advancedSetConfig(uint8_t subClassId, int32_t offset, int32_t length, const char * pData);
rob.meades@u-blox.com 1:566163f17cde 194
RobMeades 2:93310a83401a 195 /** Send a control word (see section 4.1 of the BQ27441 technical reference manual).
RobMeades 2:93310a83401a 196 * @param controlWord the control word to send.
RobMeades 2:93310a83401a 197 * @param pDataReturned a place to put the word of data that could be returned,
RobMeades 2:93310a83401a 198 * depending on which control word is used (may be NULL).
RobMeades 2:93310a83401a 199 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 200 */
rob.meades@u-blox.com 1:566163f17cde 201 bool advancedSendControlWord (uint16_t controlWord, uint16_t *pDataReturned);
rob.meades@u-blox.com 1:566163f17cde 202
RobMeades 2:93310a83401a 203 /** Read two bytes starting at a given address on the chip.
RobMeades 2:93310a83401a 204 * See sections 4.2 to 4.20 of the BQ27441 technical reference manual for the list
RobMeades 2:93310a83401a 205 * of addresses.
RobMeades 2:93310a83401a 206 * @param address the start address to read from. For instance, for temperature this is 0x02.
RobMeades 2:93310a83401a 207 * @param pDataReturned a place to put the word of data returned.
RobMeades 2:93310a83401a 208 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 209 */
rob.meades@u-blox.com 1:566163f17cde 210 bool advancedGet (uint8_t address, uint16_t *pDataReturned);
rob.meades@u-blox.com 1:566163f17cde 211
RobMeades 2:93310a83401a 212 /** Check if the chip is SEALED or UNSEALED.
RobMeades 2:93310a83401a 213 * @return true if it is SEALED, otherwise false.
RobMeades 2:93310a83401a 214 */
rob.meades@u-blox.com 1:566163f17cde 215 bool advancedIsSealed(void);
rob.meades@u-blox.com 1:566163f17cde 216
RobMeades 2:93310a83401a 217 /** Put the chip into SEALED mode. SEALED mode is
RobMeades 2:93310a83401a 218 * used to prevent accidental writes to the chip when it
RobMeades 2:93310a83401a 219 * is in a production device. All of the functions in this
RobMeades 2:93310a83401a 220 * class are able to work with a SEALED chip, provided the
RobMeades 2:93310a83401a 221 * correct seal code is provided to the init() function.
RobMeades 2:93310a83401a 222 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 223 */
rob.meades@u-blox.com 1:566163f17cde 224 bool advancedSeal(void);
rob.meades@u-blox.com 1:566163f17cde 225
RobMeades 2:93310a83401a 226 /** Send the seal code to the chip to unseal it.
RobMeades 2:93310a83401a 227 * @param sealCode the 16 bit seal code that will unseal the chip if it is sealed.
RobMeades 2:93310a83401a 228 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 229 */
rob.meades@u-blox.com 1:566163f17cde 230 bool advancedUnseal(uint16_t sealCode = SEAL_CODE_DEFAULT);
rob.meades@u-blox.com 1:566163f17cde 231
RobMeades 2:93310a83401a 232 /** Do a hard reset of the chip, reinitialising RAM data to defaults from ROM.
RobMeades 2:93310a83401a 233 * Note: the SEALED/UNSEALED status of the chip is unaffected.
RobMeades 2:93310a83401a 234 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 235 */
rob.meades@u-blox.com 1:566163f17cde 236 bool advancedReset(void);
rob.meades@u-blox.com 1:566163f17cde 237
rob.meades@u-blox.com 1:566163f17cde 238 protected:
RobMeades 2:93310a83401a 239 /** Pointer to the I2C interface. */
rob.meades@u-blox.com 1:566163f17cde 240 I2C * gpI2c;
RobMeades 2:93310a83401a 241 /** The address of the device. */
rob.meades@u-blox.com 1:566163f17cde 242 uint8_t gAddress;
RobMeades 2:93310a83401a 243 /** The seal code for the device. */
rob.meades@u-blox.com 1:566163f17cde 244 uint16_t gSealCode;
RobMeades 2:93310a83401a 245 /** Flag to indicate device is ready. */
rob.meades@u-blox.com 1:566163f17cde 246 bool gReady;
RobMeades 2:93310a83401a 247 /** Flag to indicate that monitor mode is active. */
rob.meades@u-blox.com 1:566163f17cde 248 bool gGaugeOn;
rob.meades@u-blox.com 1:566163f17cde 249
RobMeades 2:93310a83401a 250 /** Read two bytes starting at a given address.
RobMeades 2:93310a83401a 251 * Note: gpI2c should be locked before this is called.
RobMeades 2:93310a83401a 252 * @param registerAddress the register address to start reading from.
RobMeades 2:93310a83401a 253 * @param pBytes place to put the two bytes.
RobMeades 2:93310a83401a 254 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 255 */
rob.meades@u-blox.com 1:566163f17cde 256 bool getTwoBytes (uint8_t registerAddress, uint16_t *pBytes);
breadboardbasics 6:998cc334f8f2 257
breadboardbasics 6:998cc334f8f2 258 /** Read two bytes starting at a given address (signed int16).
breadboardbasics 6:998cc334f8f2 259 * Note: gpI2c should be locked before this is called.
breadboardbasics 6:998cc334f8f2 260 * @param registerAddress the register address to start reading from.
breadboardbasics 6:998cc334f8f2 261 * @param pBytes place to put the two bytes.
breadboardbasics 6:998cc334f8f2 262 * @return true if successful, otherwise false.
breadboardbasics 6:998cc334f8f2 263 */
breadboardbasics 6:998cc334f8f2 264 bool getTwoBytesSigned (uint8_t registerAddress, int16_t *pBytes);
rob.meades@u-blox.com 1:566163f17cde 265
RobMeades 2:93310a83401a 266 /** Compute the checksum of a block of memory in the chip.
RobMeades 2:93310a83401a 267 * @param pData a pointer to the 32 byte data block.
RobMeades 2:93310a83401a 268 * @return the checksum value.
RobMeades 2:93310a83401a 269 */
rob.meades@u-blox.com 1:566163f17cde 270 uint8_t computeChecksum(const char * pData);
rob.meades@u-blox.com 1:566163f17cde 271
RobMeades 2:93310a83401a 272 /** Read data of a given length and class ID.
RobMeades 2:93310a83401a 273 * Note: gpI2c should be locked before this is called.
RobMeades 2:93310a83401a 274 * @param subClassId the sub-class ID of the block.
RobMeades 2:93310a83401a 275 * @param offset the offset of the data within the class.
RobMeades 2:93310a83401a 276 * @param pData a place to put the read data.
RobMeades 2:93310a83401a 277 * @param length the size of the place to put the data block.
RobMeades 2:93310a83401a 278 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 279 */
rob.meades@u-blox.com 1:566163f17cde 280 bool readExtendedData(uint8_t subClassId, int32_t offset, int32_t length, char * pData);
rob.meades@u-blox.com 1:566163f17cde 281
RobMeades 2:93310a83401a 282 /** Write an extended data block.
RobMeades 2:93310a83401a 283 * Note: gpI2c should be locked before this is called.
RobMeades 2:93310a83401a 284 * @param subClassId the sub-class ID of the block.
RobMeades 2:93310a83401a 285 * @param offset the offset of the data within the class.
RobMeades 2:93310a83401a 286 * @param pData a pointer to the data to be written.
RobMeades 2:93310a83401a 287 * @param length the size of the data to be written.
RobMeades 2:93310a83401a 288 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 289 */
rob.meades@u-blox.com 1:566163f17cde 290 bool writeExtendedData(uint8_t subClassId, int32_t offset, int32_t length, const char * pData);
rob.meades@u-blox.com 1:566163f17cde 291
RobMeades 2:93310a83401a 292 /** Check if the chip is SEALED or UNSEALED.
RobMeades 2:93310a83401a 293 * Note: gpI2c should be locked before this is called.
RobMeades 2:93310a83401a 294 * @return true if it is SEALED, otherwise false.
RobMeades 2:93310a83401a 295 */
rob.meades@u-blox.com 1:566163f17cde 296 bool isSealed(void);
rob.meades@u-blox.com 1:566163f17cde 297
RobMeades 2:93310a83401a 298 /** Put the chip into SEALED mode.
RobMeades 2:93310a83401a 299 * Note: gpI2c should be locked before this is called.
RobMeades 2:93310a83401a 300 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 301 */
rob.meades@u-blox.com 1:566163f17cde 302 bool seal(void);
rob.meades@u-blox.com 1:566163f17cde 303
RobMeades 2:93310a83401a 304 /** Unseal the chip.
RobMeades 2:93310a83401a 305 * Note: gpI2c should be locked before this is called.
RobMeades 2:93310a83401a 306 * @param sealCode the 16 bit seal code that will unseal the chip if it is sealed.
RobMeades 2:93310a83401a 307 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 308 */
rob.meades@u-blox.com 1:566163f17cde 309 bool unseal(uint16_t sealCode);
rob.meades@u-blox.com 1:566163f17cde 310
RobMeades 2:93310a83401a 311 /** Make sure that the chip is awake and has taken a reading.
RobMeades 2:93310a83401a 312 * Note: the function does its own locking of gpI2C so that it isn't
RobMeades 2:93310a83401a 313 * held for the entire time we wait for ADC readings to complete.
RobMeades 2:93310a83401a 314 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 315 */
rob.meades@u-blox.com 1:566163f17cde 316 bool makeAdcReading(void);
rob.meades@u-blox.com 1:566163f17cde 317
RobMeades 2:93310a83401a 318 /** Set Hibernate mode.
RobMeades 2:93310a83401a 319 * Note: gpI2c should be locked before this is called.
RobMeades 2:93310a83401a 320 * @return true if successful, otherwise false.
RobMeades 2:93310a83401a 321 */
rob.meades@u-blox.com 1:566163f17cde 322 bool setHibernate(void);
rob.meades@u-blox.com 1:566163f17cde 323 };
rob.meades@u-blox.com 1:566163f17cde 324
rob.meades@u-blox.com 1:566163f17cde 325 #endif
rob.meades@u-blox.com 1:566163f17cde 326
RobMeades 2:93310a83401a 327 /* End Of File */