software:firmware
MakAir Firmware
|
Battery related functions. More...
#include "../includes/battery.h"
#include "Arduino.h"
#include "../includes/alarm_controller.h"
#include "../includes/debug.h"
#include "../includes/parameters.h"
Go to the source code of this file.
Functions | |
void | initBattery () |
Initialize battery abstraction. More... | |
void | updateBatterySample () |
Handle battery voltage calculation. More... | |
void | updateBatteryState (uint32_t p_cycleNumber) |
Updates battery states. More... | |
void | batteryLoop (uint32_t p_cycleNumber) |
Handle battery events. More... | |
uint32_t | getBatteryLevel () |
Returns battery level. More... | |
uint32_t | getBatteryLevelX10 () |
Returns battery level x10 for better accuracy. More... | |
uint32_t | getBatteryLevelX100 () |
Returns battery level x100 for better accuracy. More... | |
bool | isBatteryVeryLow () |
Check if battery level is very low. More... | |
bool | isBatteryDeepDischarged () |
Check if battery is deeply discharged. More... | |
bool | isMainsConnected () |
Check if mains are connected. More... | |
bool | isMainsAvailable () |
Check if the cable between power supply and expander input is connected. More... | |
Variables | |
static uint32_t | rawBatterySample [BATTERY_MAX_SAMPLES] |
static uint32_t | batteryCurrentSample = 0 |
static uint32_t | batteryTotalSamples = 0 |
static uint32_t | rawBatteryMeanVoltage = RAW_VOLTAGE_MAINS |
static bool | isRunningOnBattery = false |
static bool | mainsConnected = false |
static bool | mainsConnectedAvailable = false |
Battery related functions.
Definition in file battery.cpp.
void batteryLoop | ( | uint32_t | p_cycleNumber | ) |
Handle battery events.
p_cycleNumber | Number of cycles since boot |
Definition at line 117 of file battery.cpp.
uint32_t getBatteryLevel | ( | ) |
Returns battery level.
Definition at line 123 of file battery.cpp.
uint32_t getBatteryLevelX10 | ( | ) |
Returns battery level x10 for better accuracy.
Definition at line 126 of file battery.cpp.
uint32_t getBatteryLevelX100 | ( | ) |
Returns battery level x100 for better accuracy.
Definition at line 129 of file battery.cpp.
void initBattery | ( | ) |
Initialize battery abstraction.
Definition at line 33 of file battery.cpp.
bool isBatteryDeepDischarged | ( | ) |
Check if battery is deeply discharged.
Definition at line 136 of file battery.cpp.
bool isBatteryVeryLow | ( | ) |
Check if battery level is very low.
Definition at line 132 of file battery.cpp.
bool isMainsAvailable | ( | ) |
Check if the cable between power supply and expander input is connected.
Definition at line 144 of file battery.cpp.
bool isMainsConnected | ( | ) |
void updateBatterySample | ( | ) |
void updateBatteryState | ( | uint32_t | p_cycleNumber | ) |
Updates battery states.
p_cycleNumber | Number of cycle since start |
Definition at line 71 of file battery.cpp.
|
static |
Definition at line 26 of file battery.cpp.
|
static |
Definition at line 27 of file battery.cpp.
|
static |
Definition at line 29 of file battery.cpp.
|
static |
Definition at line 30 of file battery.cpp.
|
static |
Definition at line 31 of file battery.cpp.
|
static |
Definition at line 28 of file battery.cpp.
|
static |
Definition at line 25 of file battery.cpp.