SRD Standelone programmation box: BQ27510DRZRG2.h Source File

| SRD Standelone programmation box 2.0 (16/11/15 10:00:00) Documentation of the SRD standelone programmation box

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Enumerations Enumerator Macros Pages
BQ27510DRZRG2.h
Go to the documentation of this file.
1 /*############################################################################################*/
2 /*############################################################################################*/
3 /**
4 * \file BQ27510DRZRG2.h
5 * \author Thibaut LALUQUE 3D-Ouest
6 * \date 12/11/2014
7 * \version 1.0
8 * \brief Headerfile for Battery Management BQ27510DRZR-G2 driver.
9 * \details All Right Reserved.
10 */
11 /*############################################################################################*/
12 /*############################################################################################*/
13 #ifndef __BQ27510DRZRG2_H__
14 #define __BQ27510DRZRG2_H__
15
16 /*############################################################################################*/
17 /*## INCLUDES ################################################################################*/
18 /*############################################################################################*/
19 #include "i2c0.h"
20 /*############################################################################################*/
21 /*## END INCLUDES ############################################################################*/
22 /*############################################################################################*/
23
24
25 /*############################################################################################*/
26 /*## DEFINES #################################################################################*/
27 /*############################################################################################*/
28 /*----------------------------------------------------------------------------*/
29 /**
30 * \def BQ_I2C_BAUDRATE
31 * \brief Define the I2C baudrate use tocommunicate with the BQ device.
32 */
33 /*----------------------------------------------------------------------------*/
34 #define BQ_I2C_BAUDRATE (100000UL)
35
36 /*----------------------------------------------------------------------------*/
37 /**
38 * \def BQ_DEVICE_ADDRESS
39 * \brief Define the I2C BQ address.
40 */
41 /*----------------------------------------------------------------------------*/
42 #define BQ_DEVICE_ADDRESS (0x55)
43
44 /*----------------------------------------------------------------------------*/
45 /**
46 * \brief Define the command of the BQ device.
47 */
48 ///@{
49 /*----------------------------------------------------------------------------*/
50 #define BQ_AT_RATE_CMD (0x02)
51 #define BQ_AT_RATE_TIME_TO_EMPTY_CMD (0x04)
52 #define BQ_TEMPERATURE_CMD (0x06)
53 #define BQ_VOLTAGE_CMD (0x08)
54 #define BQ_FLAGS_CMD (0x0A)
55 #define BQ_NOMI_AVAILABLE_CAPACITY_CMD (0x0C)
56 #define BQ_FULL_AVAILABLE_CAPACITY_CMD (0x0E)
57 #define BQ_REMAINING_CAPACITY_CMD (0x10)
58 #define BQ_FULL_CHARGE_CAPACITY_CMD (0x12)
59 #define BQ_AVERAGE_CURRENT_CMD (0x14)
60 #define BQ_TIME_TO_EMPTY_CMD (0x16)
61 #define BQ_TIME_TO_FULL_CMD (0x18)
62 #define BQ_STANDBY_CURRENT_CMD (0x1A)
63 #define BQ_STANDBY_TIME_TO_EMPTY_CMD (0x1C)
64 #define BQ_MAX_LOAD_CURRENT_CMD (0x1E)
65 #define BQ_MAX_LOAD_TIME_TO_EMPTY_CMD (0x20)
66 #define BQ_AVAILABLE_ENERGY_CMD (0x22)
67 #define BQ_AVERAGE_POWER_CMD (0x24)
68 #define BQ_TTEAT_CONSTANT_POWER_CMD (0x26)
69 #define BQ_CYCLE_COUNTE_CMD (0x2A)
70 #define BQ_STATE_OF_CHARGE_CMD (0x2C)
71 ///@}
72
73
74 /*############################################################################################*/
75 /*## END DEFINES #############################################################################*/
76 /*############################################################################################*/
77
78
79
80 /*############################################################################################*/
81 /*## TYPEDEF/STRUCT/ENUM/UNION ###############################################################*/
82 /*############################################################################################*/
83 /*----------------------------------------------------------------------------*/
84 /**
85 * \struct tBQBatteryStatus
86 * \brief Struct used to store informations about the cell monitoring.
87 */
88 /*----------------------------------------------------------------------------*/
89 typedef struct {
90 signed short cellTemperature; /*!< cell temperature in °C */
91 unsigned short cellVoltage; /*!< cell voltage in mV */
92 unsigned short noLoadNominalCapacity; /*!< No load nominal capacity in mAh */
93 unsigned short noLoadFullCapacity; /*!< No load full capacity in mAh */
94 unsigned short remainingCapacity; /*!< remaining compensated capacity in mAh */
95 unsigned short fullCapacity; /*!< full compensated capacity in mAh */
96 signed short averageCurrent; /*!< average current in mA */
97 unsigned short timeToEmpty; /*!< time left before cell becomes empty in min (time to empty cell) */
98 unsigned short timeToFull; /*!< time left before cell becomes complety charged in min (time to full) */
99 signed short standbyCurrent; /*!< standby current in mA */
100 unsigned short standbyTimeToEmpty; /*!< time left before celle becomes empty at standby current in min (standby time to empty) */
101 signed short maxLoadCurrent; /*!< Maximum load current in mA */
102 unsigned short maxLoadTimeToEmpty; /*!< time left before cell becomes emty at the maximum load in min (max load time to empty) */
103 unsigned long availableEnergy; /*!< available energy in mWh */
104 signed short averagePower; /*!< average power in mW */
105 unsigned short timeToEmptyAtConstantPower; /*!< time left before cell becomes empty at a constant power in min (constant power time to empty) */
106 unsigned short cycleCount; /*!< load cycle count */
107 unsigned short stateOfCharge; /*!< state of charge in % */
108 }tBQBatteryStatus;
109
110 /*############################################################################################*/
111 /*## END TYPEDEF/STRUCT/ENUM/UNION ###########################################################*/
112 /*############################################################################################*/
113
114
115
116 /*############################################################################################*/
117 /*## VARIABLES ###############################################################################*/
118 /*############################################################################################*/
119 /*----------------------------------------------------------------------------*/
120 /**
121 * \var BQBatteryStatus
122 * \brief Variable used to store informations about the cell monitoring.
123 */
124 /*----------------------------------------------------------------------------*/
125 extern tBQBatteryStatus BQBatteryStatus;
126 /*############################################################################################*/
127 /*## END VARIABLES ###########################################################################*/
128 /*############################################################################################*/
129
130
131
132 /*############################################################################################*/
133 /*## DECLARATION FONCTIONS ###################################################################*/
134 /*############################################################################################*/
135 /*----------------------------------------------------------------------------*/
136 /**
137 * \fn void BQ27510DRZRG2_Init (void)
138 * \brief Function used to initialize the BQ device and it's DSP peripheral.
139 */
140 /*----------------------------------------------------------------------------*/
141 extern void BQ27510DRZRG2_Init (void);
142
143 /*----------------------------------------------------------------------------*/
144 /**
145 * \fn signed short BQ_batteryIsConnected (void)
146 * \brief Function used to know if a battery is connected or not.
147 */
148 /*----------------------------------------------------------------------------*/
149 extern signed short BQ_batteryIsConnected (void);
150
151 /*----------------------------------------------------------------------------*/
152 /**
153 * \brief Function used to get some information about the cell monitoring
154 */
155 ///@{
156 /*----------------------------------------------------------------------------*/
157 extern signed short BQ_getCellTemperature(void);
158 extern unsigned short BQ_getCellVoltage(void);
159 extern unsigned short BQ_getNominalAvailableCapacity(void);
160 extern unsigned short BQ_getFullAvailableCapacity (void);
161 extern unsigned short BQ_getRemainingCapacity (void);
162 extern unsigned short BQ_getFullChargeCapacity (void);
163 extern signed short BQ_getAverageCurrent (void);
164 extern unsigned short BQ_getTimeToEmpty (void);
165 extern unsigned short BQ_getTimeToFull (void);
166 extern signed short BQ_getStandbyCurrent (void);
167 extern unsigned short BQ_getStandbyTimeToEmpty (void);
168 extern signed short BQ_getMaxLoadCurrent (void);
169 extern unsigned short BQ_getMaxLoadTimeToEmpty (void);
170 extern unsigned long BQ_getAvailableEnergy (void);
171 extern signed short BQ_getAveragePower (void);
172 extern unsigned short BQ_getTTEAtConstantPower (void);
173 extern unsigned short BQ_getCycleCount (void);
174 extern unsigned short BQ_getStateOfCharge (void);
175 ///@}
176
177 /*----------------------------------------------------------------------------*/
178 /**
179 * \fn signed short BQ_getFullInfo (void)
180 * \brief Function used to get all information about the cell monitoring.
181 * \return (signed short) : 0 if all data are correctly read, else return -1.
182 * \details the result are stored in the BQBatteryStatus variable.
183 * an error can be returned if the battery is not connected.
184 */
185 /*----------------------------------------------------------------------------*/
186 extern signed short BQ_getFullInfo (void);
187 /*############################################################################################*/
188 /*## END DECLARATION FONCTIONS ###############################################################*/
189 /*############################################################################################*/
190 #endif
tBQBatteryStatus::remainingCapacity
unsigned short remainingCapacity
Definition: BQ27510DRZRG2.h:94
tBQBatteryStatus::cycleCount
unsigned short cycleCount
Definition: BQ27510DRZRG2.h:106
BQ_getStandbyCurrent
signed short BQ_getStandbyCurrent(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:265
BQ_getNominalAvailableCapacity
unsigned short BQ_getNominalAvailableCapacity(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:130
i2c0.h
Headerfile for I2C0 peripheral driver.
BQ_getAverageCurrent
signed short BQ_getAverageCurrent(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:208
tBQBatteryStatus::maxLoadTimeToEmpty
unsigned short maxLoadTimeToEmpty
Definition: BQ27510DRZRG2.h:102
BQ_getCellVoltage
unsigned short BQ_getCellVoltage(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:110
tBQBatteryStatus::timeToEmptyAtConstantPower
unsigned short timeToEmptyAtConstantPower
Definition: BQ27510DRZRG2.h:105
tBQBatteryStatus
Struct used to store informations about the cell monitoring.
Definition: BQ27510DRZRG2.h:89
tBQBatteryStatus::averagePower
signed short averagePower
Definition: BQ27510DRZRG2.h:104
BQ_getTimeToFull
unsigned short BQ_getTimeToFull(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:246
BQ_getMaxLoadTimeToEmpty
unsigned short BQ_getMaxLoadTimeToEmpty(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:322
tBQBatteryStatus::averageCurrent
signed short averageCurrent
Definition: BQ27510DRZRG2.h:96
tBQBatteryStatus::timeToFull
unsigned short timeToFull
Definition: BQ27510DRZRG2.h:98
BQ_getTimeToEmpty
unsigned short BQ_getTimeToEmpty(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:227
tBQBatteryStatus::noLoadFullCapacity
unsigned short noLoadFullCapacity
Definition: BQ27510DRZRG2.h:93
tBQBatteryStatus::fullCapacity
unsigned short fullCapacity
Definition: BQ27510DRZRG2.h:95
BQ_getCellTemperature
signed short BQ_getCellTemperature(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:92
BQ_getTTEAtConstantPower
unsigned short BQ_getTTEAtConstantPower(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:379
tBQBatteryStatus::cellTemperature
signed short cellTemperature
Definition: BQ27510DRZRG2.h:90
tBQBatteryStatus::availableEnergy
unsigned long availableEnergy
Definition: BQ27510DRZRG2.h:103
tBQBatteryStatus::maxLoadCurrent
signed short maxLoadCurrent
Definition: BQ27510DRZRG2.h:101
BQ_batteryIsConnected
signed short BQ_batteryIsConnected(void)
Function used to know if a battery is connected or not.
Definition: BQ27510DRZRG2.c:85
tBQBatteryStatus::stateOfCharge
unsigned short stateOfCharge
Definition: BQ27510DRZRG2.h:107
BQ_getFullInfo
signed short BQ_getFullInfo(void)
Function used to get all information about the cell monitoring.
Definition: BQ27510DRZRG2.c:434
tBQBatteryStatus::standbyTimeToEmpty
unsigned short standbyTimeToEmpty
Definition: BQ27510DRZRG2.h:100
BQ_getCycleCount
unsigned short BQ_getCycleCount(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:398
BQBatteryStatus
tBQBatteryStatus BQBatteryStatus
Variable used to store informations about the cell monitoring.
Definition: BQ27510DRZRG2.c:61
tBQBatteryStatus::standbyCurrent
signed short standbyCurrent
Definition: BQ27510DRZRG2.h:99
tBQBatteryStatus::noLoadNominalCapacity
unsigned short noLoadNominalCapacity
Definition: BQ27510DRZRG2.h:92
BQ_getRemainingCapacity
unsigned short BQ_getRemainingCapacity(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:170
tBQBatteryStatus::timeToEmpty
unsigned short timeToEmpty
Definition: BQ27510DRZRG2.h:97
tBQBatteryStatus::cellVoltage
unsigned short cellVoltage
Definition: BQ27510DRZRG2.h:91
BQ_getStateOfCharge
unsigned short BQ_getStateOfCharge(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:417
BQ_getStandbyTimeToEmpty
unsigned short BQ_getStandbyTimeToEmpty(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:284
BQ_getMaxLoadCurrent
signed short BQ_getMaxLoadCurrent(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:303
BQ27510DRZRG2_Init
void BQ27510DRZRG2_Init(void)
Function used to initialize the BQ device and it's DSP peripheral.
Definition: BQ27510DRZRG2.c:79
BQ_getAvailableEnergy
unsigned long BQ_getAvailableEnergy(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:341
BQ_getFullChargeCapacity
unsigned short BQ_getFullChargeCapacity(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:189
BQ_getAveragePower
signed short BQ_getAveragePower(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:360
BQ_getFullAvailableCapacity
unsigned short BQ_getFullAvailableCapacity(void)
Function used to get some information about the cell monitoring.
Definition: BQ27510DRZRG2.c:150