SRD Standelone programmation box: PowerManager.h File Reference

| 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
Data Structures | Macros | Functions | Variables
PowerManager.h File Reference

Headerfile for Power manager. More...

`#include "BQ27510DRZRG2.h"`
`#include "LTC4160.h"`
`#include "display.h"`
`#include "UsbUart.h"`
`#include "StringTools.h"`
`#include "device.h"`
`#include "FM25V20.h"`
`#include "Button.h"`
`#include "Led.h"`
`#include "Watchdog.h"`
`#include "ButtonManager.h"`
Include dependency graph for PowerManager.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | tPowerManagerCtrl
| Define a structure used by the power manager to control power modes. More...

## Macros

#define | WAKEUP_INTERRUPT_PRIORITY (2)
| Define the wake up interrupt priority. More...

## Functions

void | PowerManagerInit (void)
| Variable used by the power manager. More...
void | PowerManager (void)
| power manager. More...
void | PowerManagerSendBatteryInfo (void)
| Function used to send battery informations. More...
void | PowerManagerLPMController (void)
| Low Power mode controller. More...
void | PowerManagerEnterLPM (void)
| Functions used to Enter and exit low power mode. More...
void | PowerManagerExitLPM (void)
| Functions used to Enter and exit low power mode. More...
void | PowerManagerEnableWakeUpInterrupt (void)
| Functions used to control the wake up interrupt functions. More...
void | PowerManagerDisableWakeUpInterrupt (void)
| Functions used to control the wake up interrupt functions. More...
void | PowerManagerClearWakeUpInterruptFlag (void)
| Functions used to control the wake up interrupt functions. More...

## Variables

tPowerManagerCtrl | PowerManagerCtrl
| Variable used by the power manager. More...

## Detailed Description

Headerfile for Power manager.

Author
  Thibaut LALUQUE 3D-Ouest

Date
  20/11/2014

Version
  1.0

All Right Reserved.

Definition in file PowerManager.h.

## Macro Definition Documentation

#define WAKEUP_INTERRUPT_PRIORITY (2)

Define the wake up interrupt priority.

Definition at line 44 of file PowerManager.h.

Referenced by PowerManagerInit().

## Function Documentation

void PowerManager | ( | void |  | ) |

power manager.

Definition at line 104 of file PowerManager.c.

References tPowerManagerCtrl::bits, BQ_getFullInfo(), tPowerManagerCtrl::flags, LTC4160DisableCharge, LTC4160EnableCharge, LTC4160GetChargerState, LTC4160GetFaultState, LTC4160GetVBusGood, LTC_CHARGER_isCharging, LTC_FAULT_FaultPending, LTC_VBUS_VBusGood, PowerManagerDisplayLoaded(), PowerManagerDisplayLoading(), and PowerManagerDisplayLoadingError().

Referenced by PowerManagerExitLPM(), and task1s().

104 {
105
106 signed short batteryDetected = BQ_getFullInfo(); //Read all info
107
108 /*=== Device is connected on USB -> charge mode ===*/
109 if(LTC4160GetVBusGood() == LTC_VBUS_VBusGood) {
110
111 PowerManagerCtrl.flags.bits.usbConnected = 1;
112
113 LTC4160EnableCharge();
114
115 if(batteryDetected == 0) {
116 if(LTC4160GetChargerState() == LTC_CHARGER_isCharging) { //Is charging
117 PowerManagerDisplayLoading();
118 PowerManagerCtrl.flags.bits.batteryCharging = 1;
119 PowerManagerCtrl.flags.bits.batteryError = 0;
120
121 } else if (LTC4160GetFaultState() == LTC_FAULT_FaultPending) { //Error
122 PowerManagerDisplayLoadingError();
123 PowerManagerCtrl.flags.bits.batteryCharging = 0;
124 PowerManagerCtrl.flags.bits.batteryError = 1;
125
126 } else { //Charged
127 PowerManagerDisplayLoaded();
128 PowerManagerCtrl.flags.bits.batteryCharging = 0;
129 PowerManagerCtrl.flags.bits.batteryError = 0;
130 }
131 } else {
132 PowerManagerDisplayLoadingError(); //No Battery -> errror
133 PowerManagerCtrl.flags.bits.batteryCharging = 0;
134 PowerManagerCtrl.flags.bits.batteryError = 1;
135 }
136
137 /*=== Device work on battery -> use LPM ===*/
138 } else {
139 PowerManagerCtrl.flags.bits.usbConnected = 0;
140 PowerManagerCtrl.flags.bits.batteryCharging = 0;
141 PowerManagerCtrl.flags.bits.batteryError = 0;
142
143 LTC4160DisableCharge();
144
145 }
146 }
LTC_VBUS_VBusGood
Definition: LTC4160.h:93
LTC4160DisableCharge
#define LTC4160DisableCharge()
Enable/Disable the charging mode.
Definition: LTC4160.h:153
PowerManagerDisplayLoaded
void PowerManagerDisplayLoaded(void)
Definition: PowerManager.c:187
LTC4160GetVBusGood
#define LTC4160GetVBusGood()
Functions used to get some informations on the LTC4160 device.
Definition: LTC4160.h:172
BQ_getFullInfo
signed short BQ_getFullInfo(void)
Function used to get all information about the cell monitoring.
Definition: BQ27510DRZRG2.c:434
LTC4160GetFaultState
#define LTC4160GetFaultState()
Functions used to get some informations on the LTC4160 device.
Definition: LTC4160.h:174
tPowerManagerCtrl::flags
union tPowerManagerCtrl::@4 flags
LTC4160EnableCharge
#define LTC4160EnableCharge()
Enable/Disable the charging mode.
Definition: LTC4160.h:152
LTC_FAULT_FaultPending
Definition: LTC4160.h:115
PowerManagerDisplayLoading
void PowerManagerDisplayLoading(void)
Definition: PowerManager.c:148
tPowerManagerCtrl::bits
struct tPowerManagerCtrl::@4::@5 bits
LTC_CHARGER_isCharging
Definition: LTC4160.h:104
LTC4160GetChargerState
#define LTC4160GetChargerState()
Functions used to get some informations on the LTC4160 device.
Definition: LTC4160.h:173
PowerManagerDisplayLoadingError
void PowerManagerDisplayLoadingError(void)
Definition: PowerManager.c:178
PowerManagerCtrl
tPowerManagerCtrl PowerManagerCtrl
Variable used by the power manager.
Definition: PowerManager.c:62

Here is the call graph for this function:

Here is the caller graph for this function:

void PowerManagerClearWakeUpInterruptFlag | ( | void |  | ) |

Functions used to control the wake up interrupt functions.

Definition at line 326 of file PowerManager.c.

References BUTTON_READ_SHIFT, BUTTON_WRITE_SHIFT, and LTC4160_VBUSGD_SHIFT.

Referenced by PORTA_IRQHandler(), PowerManagerEnableWakeUpInterrupt(), PowerManagerExitLPM(), and PowerManagerInit().

326 {
327 PORTA->PCR[BUTTON_READ_SHIFT] |= PORT_PCR_ISF_MASK;
328 PORTA->PCR[BUTTON_WRITE_SHIFT] |= PORT_PCR_ISF_MASK;
329 PORTA->PCR[LTC4160_VBUSGD_SHIFT] |= PORT_PCR_ISF_MASK;
330 }
LTC4160_VBUSGD_SHIFT
#define LTC4160_VBUSGD_SHIFT
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:38
BUTTON_WRITE_SHIFT
#define BUTTON_WRITE_SHIFT
Define the shift and mask of the IO used by the button interface.
Definition: button.h:35
BUTTON_READ_SHIFT
#define BUTTON_READ_SHIFT
Define the shift and mask of the IO used by the button interface.
Definition: button.h:37

Here is the caller graph for this function:

void PowerManagerDisableWakeUpInterrupt | ( | void |  | ) |

Functions used to control the wake up interrupt functions.

Definition at line 320 of file PowerManager.c.

References BUTTON_READ_SHIFT, BUTTON_WRITE_SHIFT, and LTC4160_VBUSGD_SHIFT.

Referenced by PowerManagerExitLPM().

320 {
321 PORTA->PCR[BUTTON_READ_SHIFT] = (PORTA->PCR[BUTTON_READ_SHIFT] & ~PORT_PCR_IRQC_MASK);
322 PORTA->PCR[BUTTON_WRITE_SHIFT] = (PORTA->PCR[BUTTON_WRITE_SHIFT] & ~PORT_PCR_IRQC_MASK);
323 PORTA->PCR[LTC4160_VBUSGD_SHIFT] = (PORTA->PCR[LTC4160_VBUSGD_SHIFT] & ~PORT_PCR_IRQC_MASK);
324 }
LTC4160_VBUSGD_SHIFT
#define LTC4160_VBUSGD_SHIFT
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:38
BUTTON_WRITE_SHIFT
#define BUTTON_WRITE_SHIFT
Define the shift and mask of the IO used by the button interface.
Definition: button.h:35
BUTTON_READ_SHIFT
#define BUTTON_READ_SHIFT
Define the shift and mask of the IO used by the button interface.
Definition: button.h:37

Here is the caller graph for this function:

void PowerManagerEnableWakeUpInterrupt | ( | void |  | ) |

Functions used to control the wake up interrupt functions.

Definition at line 313 of file PowerManager.c.

References BUTTON_READ_SHIFT, BUTTON_WRITE_SHIFT, LTC4160_VBUSGD_SHIFT, and PowerManagerClearWakeUpInterruptFlag().

Referenced by PowerManagerEnterLPM().

313 {
314 PowerManagerClearWakeUpInterruptFlag();
315 PORTA->PCR[BUTTON_READ_SHIFT] = (PORTA->PCR[BUTTON_READ_SHIFT] & ~PORT_PCR_IRQC_MASK) | PORT_PCR_IRQC(0b1001); //Rising front
316 PORTA->PCR[BUTTON_WRITE_SHIFT] = (PORTA->PCR[BUTTON_WRITE_SHIFT] & ~PORT_PCR_IRQC_MASK) | PORT_PCR_IRQC(0b1001); //Rising front
317 PORTA->PCR[LTC4160_VBUSGD_SHIFT] = (PORTA->PCR[LTC4160_VBUSGD_SHIFT] & ~PORT_PCR_IRQC_MASK) | PORT_PCR_IRQC(0b1010); //Falling front
318 }
LTC4160_VBUSGD_SHIFT
#define LTC4160_VBUSGD_SHIFT
Define the shift and mask of the IO used to controlled the LTC4160.
Definition: LTC4160.h:38
PowerManagerClearWakeUpInterruptFlag
void PowerManagerClearWakeUpInterruptFlag(void)
Definition: PowerManager.c:326
BUTTON_WRITE_SHIFT
#define BUTTON_WRITE_SHIFT
Define the shift and mask of the IO used by the button interface.
Definition: button.h:35
BUTTON_READ_SHIFT
#define BUTTON_READ_SHIFT
Define the shift and mask of the IO used by the button interface.
Definition: button.h:37

Here is the call graph for this function:

Here is the caller graph for this function:

void PowerManagerEnterLPM | ( | void |  | ) |

Functions used to Enter and exit low power mode.

Definition at line 250 of file PowerManager.c.

References DISPLAY_CMD_ON, DISPLAY_POWER_OFF, DisplaySetCmd, DisplaySetPower(), FM25V20LPM(), LED_GREEN, LED_RED, LedClear, LPM_VLPS(), LTC4160DisableCharge, PowerManagerEnableWakeUpInterrupt(), UART0ClockGate(), UART1ClockGate(), UART2ClockGate(), and WatchdogKick().

Referenced by PowerManagerLPMController().

250 {
251
252 /*=== Make sure that cherger is off ===*/
253 LTC4160DisableCharge();
254
255 /*=== Turn off all device ===*/
256 LedClear(LED_GREEN | LED_RED); //Turn off led before LPM
257 FM25V20LPM(); //Put FRAM in low power mode
258 DisplaySetPower(DISPLAY_POWER_OFF); //Display off
259 WatchdogKick();
260
261 UART0ClockGate(0); //Turn off uart0
262 UART1ClockGate(0); //Turn off uart1
263 UART2ClockGate(0); //Turn off uart2
264
265
266 //PORTD->PCR[5] |= PORT_PCR_MUX(1);
267 //PTD->PDDR &= ~(1UL<<5);
268 //PORTB->PCR[17] |= PORT_PCR_MUX(1);
269 //PTB->PDDR &= ~(1UL<<17);
270 //PORTB->PCR[16] |= PORT_PCR_MUX(1);
271 //PTB->PDDR &= ~(1UL<<16);
272
273 PORTE->PCR[17] &= ~PORT_PCR_MUX_MASK;
274 PORTE->PCR[17] |= PORT_PCR_MUX(1);
275 PTE->PCOR |= (1UL<<17);
276 PTE->PDDR |= (1UL<<17);
277 PORTE->PCR[18] &= ~PORT_PCR_MUX_MASK;
278 PORTE->PCR[18] |= PORT_PCR_MUX(1);
279 PTE->PCOR |= (1UL<<18);
280 PTE->PDDR |= (1UL<<18);
281 DisplaySetCmd(DISPLAY_CMD_ON);
282
283
284 /*=== Configure wake up ===*/
285 PowerManagerEnableWakeUpInterrupt();
286
287 /*=== Enter LPM ===*/
288 WatchdogKick();
289 LPM_VLPS();
290 }
LTC4160DisableCharge
#define LTC4160DisableCharge()
Enable/Disable the charging mode.
Definition: LTC4160.h:153
DisplaySetCmd
#define DisplaySetCmd(cmd)
Macro used to set the command line.
Definition: display.h:152
DISPLAY_POWER_OFF
Definition: display.h:117
LED_RED
Definition: led.h:56
WatchdogKick
void WatchdogKick(void)
Kick the watchdog to avoid reset after the watchdog have started.
Definition: watchdog.c:86
LPM_VLPS
void LPM_VLPS(void)
Function to switch the device in very low power mode.
Definition: device.c:256
FM25V20LPM
void FM25V20LPM(void)
Put the memory in a low power mode.
Definition: FM25V20.c:178
LedClear
#define LedClear(ledId)
Macro used to set/clear/togglet/read the led state.
Definition: led.h:103
UART2ClockGate
void UART2ClockGate(unsigned char bool)
Definition: DSP_mkl16z256vlh4.c:106
UART0ClockGate
void UART0ClockGate(unsigned char bool)
Functions to enable/disable the main clock of the specified uart.
Definition: DSP_mkl16z256vlh4.c:73
DISPLAY_CMD_ON
Definition: display.h:105
PowerManagerEnableWakeUpInterrupt
void PowerManagerEnableWakeUpInterrupt(void)
Functions used to control the wake up interrupt functions.
Definition: PowerManager.c:313
DisplaySetPower
void DisplaySetPower(tDisplayPowerState power)
Function used to enable/disable the display power.
Definition: display.c:204
UART1ClockGate
void UART1ClockGate(unsigned char bool)
Definition: DSP_mkl16z256vlh4.c:98
LED_GREEN
Definition: led.h:55

Here is the call graph for this function:

Here is the caller graph for this function:

void PowerManagerExitLPM | ( | void |  | ) |

Functions used to Enter and exit low power mode.

Definition at line 292 of file PowerManager.c.

References DeviceClockSwitchHighPower(), DISPLAY_CMD_OFF, DisplaySetCmd, PowerManager(), PowerManagerClearWakeUpInterruptFlag(), PowerManagerDisableWakeUpInterrupt(), SPI0PinMappingPeripheral(), UART0ClockGate(), UART1ClockGate(), UART2ClockGate(), and WatchdogKick().

Referenced by PowerManagerLPMController().

292 {
293
294 WatchdogKick();
295 PowerManagerDisableWakeUpInterrupt();
296 PowerManagerClearWakeUpInterruptFlag();
297 WatchdogKick();
298 DeviceClockSwitchHighPower();
299 WatchdogKick();
300
301 //SPI1PinMappingPeripheral();
302 DisplaySetCmd(DISPLAY_CMD_OFF);
303 SPI0PinMappingPeripheral();
304
305 /*=== Restore clock on peripheral ===*/
306 UART0ClockGate(1); //Turn off uart0
307 UART1ClockGate(1); //Turn off uart1
308 UART2ClockGate(1); //Turn off uart2
309
310 PowerManager(); // Force PowerManager for update power status in no connected mode
311 }
DisplaySetCmd
#define DisplaySetCmd(cmd)
Macro used to set the command line.
Definition: display.h:152
PowerManager
void PowerManager(void)
power manager.
Definition: PowerManager.c:104
PowerManagerClearWakeUpInterruptFlag
void PowerManagerClearWakeUpInterruptFlag(void)
Definition: PowerManager.c:326
PowerManagerDisableWakeUpInterrupt
void PowerManagerDisableWakeUpInterrupt(void)
Definition: PowerManager.c:320
WatchdogKick
void WatchdogKick(void)
Kick the watchdog to avoid reset after the watchdog have started.
Definition: watchdog.c:86
DeviceClockSwitchHighPower
void DeviceClockSwitchHighPower(void)
Function to switch the processor on the highest clock speed allowed.
Definition: device.c:148
UART2ClockGate
void UART2ClockGate(unsigned char bool)
Definition: DSP_mkl16z256vlh4.c:106
UART0ClockGate
void UART0ClockGate(unsigned char bool)
Functions to enable/disable the main clock of the specified uart.
Definition: DSP_mkl16z256vlh4.c:73
DISPLAY_CMD_OFF
Definition: display.h:106
UART1ClockGate
void UART1ClockGate(unsigned char bool)
Definition: DSP_mkl16z256vlh4.c:98
SPI0PinMappingPeripheral
void SPI0PinMappingPeripheral(void)
Functions to MAP the defined IO of the SPI module x in the rigth pin.
Definition: DSP_mkl16z256vlh4.c:278

Here is the call graph for this function:

Here is the caller graph for this function:

void PowerManagerInit | ( | void |  | ) |

Variable used by the power manager.

Definition at line 88 of file PowerManager.c.

References tPowerManagerCtrl::all, BQ27510DRZRG2_Init(), tPowerManagerCtrl::flags, IPR_NVIC_PORTA_MASK, IPR_NVIC_PORTA_REG, IPR_NVIC_PORTA_SHIFT, LTC4160Init(), LTC4160SetILimit(), LTCUSBCurrent5xMode, NVIC_PORTA_MASK, NVIC_PORTA_REG, PowerManagerClearWakeUpInterruptFlag(), and WAKEUP_INTERRUPT_PRIORITY.

Referenced by Setup().

88 {
89 LTC4160Init();
90 BQ27510DRZRG2_Init();
91
92 LTC4160SetILimit(LTCUSBCurrent5xMode);
93
94 PowerManagerCtrl.flags.all = 0;
95
96 /*=== Configure external wake-up interrupt ===*/
97 SIM->SCGC5 |= SIM_SCGC5_PORTA_MASK;
98 PowerManagerClearWakeUpInterruptFlag();
99 NVIC->IP[IPR_NVIC_PORTA_REG] = (NVIC->IP[IPR_NVIC_PORTA_REG] & ~IPR_NVIC_PORTA_MASK) | ( (WAKEUP_INTERRUPT_PRIORITY & 0x03) << IPR_NVIC_PORTA_SHIFT);
100 NVIC->ISER[NVIC_PORTA_REG] |= NVIC_PORTA_MASK;
101
102 }
IPR_NVIC_PORTA_MASK
#define IPR_NVIC_PORTA_MASK
Define NVIC PIT register used by specific peripherals.
Definition: DSP_mkl16z256vlh4.h:130
IPR_NVIC_PORTA_REG
#define IPR_NVIC_PORTA_REG
Define NVIC PIT register used by specific peripherals.
Definition: DSP_mkl16z256vlh4.h:102
PowerManagerClearWakeUpInterruptFlag
void PowerManagerClearWakeUpInterruptFlag(void)
Definition: PowerManager.c:326
NVIC_PORTA_REG
#define NVIC_PORTA_REG
Define NVIC register used by specific peripherals.
Definition: DSP_mkl16z256vlh4.h:49
BQ27510DRZRG2_Init
void BQ27510DRZRG2_Init(void)
Function used to initialize the BQ device and it's DSP peripheral.
Definition: BQ27510DRZRG2.c:79
LTC4160Init
void LTC4160Init(void)
Initialize the LTC4160 device.
Definition: LTC4160.c:78
tPowerManagerCtrl::flags
union tPowerManagerCtrl::@4 flags
IPR_NVIC_PORTA_SHIFT
#define IPR_NVIC_PORTA_SHIFT
Define NVIC PIT register used by specific peripherals.
Definition: DSP_mkl16z256vlh4.h:129
LTCUSBCurrent5xMode
Definition: LTC4160.h:83
LTC4160SetILimit
void LTC4160SetILimit(tLtcUSBCurrentLimit iLimit)
Define the current limit drawn by the charger.
Definition: LTC4160.c:105
WAKEUP_INTERRUPT_PRIORITY
#define WAKEUP_INTERRUPT_PRIORITY
Define the wake up interrupt priority.
Definition: PowerManager.h:44
tPowerManagerCtrl::all
unsigned short all
Definition: PowerManager.h:68
NVIC_PORTA_MASK
#define NVIC_PORTA_MASK
Define NVIC mask and shift values used by specific peripherals.
Definition: DSP_mkl16z256vlh4.h:77
PowerManagerCtrl
tPowerManagerCtrl PowerManagerCtrl
Variable used by the power manager.
Definition: PowerManager.c:62

Here is the call graph for this function:

Here is the caller graph for this function:

void PowerManagerLPMController | ( | void |  | ) |

Low Power mode controller.

Definition at line 332 of file PowerManager.c.

References tPowerManagerCtrl::bits, BUTTON_RELEASED, BUTTONMANAGER_READY_FOR_LPM, ButtonManagerCtrl, ButtonReadGetState, ButtonWriteGetState, tPowerManagerCtrl::flags, tButtonManagerCtrl::lpm, tRFIDCtrl::lpm, LTC4160GetVBusGood, LTC_VBUS_VBusError, PowerManagerEnterLPM(), PowerManagerExitLPM(), RFID_READY_FOR_LPM, and RFIDCtrl.

Referenced by taskBackground().

332 {
333
334 if(PowerManagerCtrl.flags.bits.usbConnected == 0 && LTC4160GetVBusGood() == LTC_VBUS_VBusError) {
335
336 if(ButtonManagerCtrl.lpm == BUTTONMANAGER_READY_FOR_LPM && RFIDCtrl.lpm == RFID_READY_FOR_LPM) { //No operation pending
337
338 if(ButtonReadGetState() == BUTTON_RELEASED && ButtonWriteGetState() == BUTTON_RELEASED) { //No operation requested
339
340 /*-- All condition validate for LPM --*/
341 PowerManagerEnterLPM();
342 PowerManagerExitLPM();
343 }
344 }
345 }
346 }
tRFIDCtrl::lpm
tRFIDLpm lpm
Definition: RFIDManager.h:223
LTC4160GetVBusGood
#define LTC4160GetVBusGood()
Functions used to get some informations on the LTC4160 device.
Definition: LTC4160.h:172
ButtonManagerCtrl
tButtonManagerCtrl ButtonManagerCtrl
Structure used by the button controller to control button operation.
Definition: ButtonManager.c:73
tButtonManagerCtrl::lpm
tButtonManagerLpm lpm
Definition: ButtonManager.h:109
tPowerManagerCtrl::flags
union tPowerManagerCtrl::@4 flags
PowerManagerExitLPM
void PowerManagerExitLPM(void)
Definition: PowerManager.c:292
BUTTON_RELEASED
Definition: button.h:68
RFID_READY_FOR_LPM
Definition: RFIDManager.h:54
tPowerManagerCtrl::bits
struct tPowerManagerCtrl::@4::@5 bits
LTC_VBUS_VBusError
Definition: LTC4160.h:94
BUTTONMANAGER_READY_FOR_LPM
Definition: ButtonManager.h:87
RFIDCtrl
tRFIDCtrl RFIDCtrl
Variable used to control the RFID manager.
Definition: RFIDManager.c:59
ButtonWriteGetState
#define ButtonWriteGetState()
Macro used to get the button status.
Definition: button.h:104
ButtonReadGetState
#define ButtonReadGetState()
Macro used to get the button status.
Definition: button.h:103
PowerManagerEnterLPM
void PowerManagerEnterLPM(void)
Functions used to Enter and exit low power mode.
Definition: PowerManager.c:250
PowerManagerCtrl
tPowerManagerCtrl PowerManagerCtrl
Variable used by the power manager.
Definition: PowerManager.c:62

Here is the call graph for this function:

Here is the caller graph for this function:

void PowerManagerSendBatteryInfo | ( | void |  | ) |

Function used to send battery informations.

Definition at line 203 of file PowerManager.c.

References BQBatteryStatus, tBQBatteryStatus::cellTemperature, tBQBatteryStatus::cellVoltage, tBQBatteryStatus::fullCapacity, tBQBatteryStatus::remainingCapacity, tBQBatteryStatus::stateOfCharge, StrTool_ClearString(), StrTool_SignedLongToString(), tBQBatteryStatus::timeToEmpty, tBQBatteryStatus::timeToFull, and UsbUartSendString.

203 {
204 char data[10];
205
206 UsbUartSendString("T=");
207 StrTool_ClearString(data,10);
208 StrTool_SignedLongToString(BQBatteryStatus.cellTemperature,data);
209 UsbUartSendString(data);
210 UsbUartSendString("°C\n\r");
211
212 UsbUartSendString("V=");
213 StrTool_ClearString(data,10);
214 StrTool_SignedLongToString(BQBatteryStatus.cellVoltage,data);
215 UsbUartSendString(data);
216 UsbUartSendString("mV\n\r");
217
218 UsbUartSendString("Total Load=");
219 StrTool_ClearString(data,10);
220 StrTool_SignedLongToString(BQBatteryStatus.fullCapacity,data);
221 UsbUartSendString(data);
222 UsbUartSendString("mAh\n\r");
223
224 UsbUartSendString("Current Load=");
225 StrTool_ClearString(data,10);
226 StrTool_SignedLongToString(BQBatteryStatus.remainingCapacity,data);
227 UsbUartSendString(data);
228 UsbUartSendString("mAh\n\r");
229
230 UsbUartSendString("Tempty=");
231 StrTool_ClearString(data,10);
232 StrTool_SignedLongToString(BQBatteryStatus.timeToEmpty,data);
233 UsbUartSendString(data);
234 UsbUartSendString("min\n\r");
235
236 UsbUartSendString("Tloaded=");
237 StrTool_ClearString(data,10);
238 StrTool_SignedLongToString(BQBatteryStatus.timeToFull,data);
239 UsbUartSendString(data);
240 UsbUartSendString("min\n\r");
241
242 UsbUartSendString("Charge=");
243 StrTool_ClearString(data,10);
244 StrTool_SignedLongToString(BQBatteryStatus.stateOfCharge,data);
245 UsbUartSendString(data);
246 UsbUartSendString("%\n\r");
247
248 }
tBQBatteryStatus::remainingCapacity
unsigned short remainingCapacity
Definition: BQ27510DRZRG2.h:94
StrTool_SignedLongToString
unsigned short StrTool_SignedLongToString(signed long data, char *str)
Convert an signed long in string coded as decimal char.
Definition: StringTools.c:143
UsbUartSendString
#define UsbUartSendString(string)
Map the USB/UART functions on the rigth uart module functions.
Definition: UsbUart.h:87
tBQBatteryStatus::timeToFull
unsigned short timeToFull
Definition: BQ27510DRZRG2.h:98
tBQBatteryStatus::fullCapacity
unsigned short fullCapacity
Definition: BQ27510DRZRG2.h:95
tBQBatteryStatus::cellTemperature
signed short cellTemperature
Definition: BQ27510DRZRG2.h:90
BQBatteryStatus
tBQBatteryStatus BQBatteryStatus
Variable used to store informations about the cell monitoring.
Definition: BQ27510DRZRG2.c:61
StrTool_ClearString
void StrTool_ClearString(char *str, unsigned short strLength)
Clear a string (reset all char to '\0').
Definition: StringTools.c:66
tBQBatteryStatus::stateOfCharge
unsigned short stateOfCharge
Definition: BQ27510DRZRG2.h:107
tBQBatteryStatus::timeToEmpty
unsigned short timeToEmpty
Definition: BQ27510DRZRG2.h:97
tBQBatteryStatus::cellVoltage
unsigned short cellVoltage
Definition: BQ27510DRZRG2.h:91

Here is the call graph for this function:

## Variable Documentation

tPowerManagerCtrl PowerManagerCtrl

Variable used by the power manager.

Definition at line 62 of file PowerManager.c.

Referenced by ButtonManager().