![]() |
OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
|
Everything related to the measurement of available battery charge. More...
Functions | |
| void | configure (ADC_GPIO battREADPin, OutputGPIO battENPin=UNSPECIFIED::VALUE) |
| Monitor battery charge using a battery monitor circuit or a voltage divider. | |
| void | configure (I2CBus bus=I2CBus::PRIMARY, uint8_t i2c_address=0xFF) |
| Monitor battery charge using a "fuel gauge". | |
| void | setPeriod (uint32_t seconds) |
| Set time interval between measurements. | |
| void | setWarningSoC (uint8_t percentage) |
| Set a battery level to warn to the user. | |
| void | setPowerOffSoC (uint8_t percentage) |
| Set a battery level to shutdown the system. | |
| void | setExternalPowerWitness (InputGPIO sensePin) |
| Set a GPIO pin to sense the power wire. | |
| void | setChargingWitness (InputGPIO sensePin, bool negativeLogic=true, bool enableInternalPullResistor=true) |
| Set a GPIO pin to sense if the battery is being charged. | |
Everything related to the measurement of available battery charge.
| void batteryMonitor::configure | ( | ADC_GPIO | battREADPin, |
| OutputGPIO | battENPin = UNSPECIFIED::VALUE ) |
Monitor battery charge using a battery monitor circuit or a voltage divider.
| battREADPin | ADC pin used to read battery voltage |
| battENPin | Output pin to enable/disable the battery monitor circuit. Set to UNSPECIFIED::VALUE if battREADPin is attached to a simple voltage divider. This is the case for most battery-enabled DevKits. |
| void batteryMonitor::configure | ( | I2CBus | bus = I2CBus::PRIMARY, |
| uint8_t | i2c_address = 0xFF ) |
Monitor battery charge using a "fuel gauge".
| bus | I2C bus to which the chip is connected. If the secondary bus is used, manual initialization is required using inputs::initializeI2C() |
| i2c_address | Full I2C address of the fuel gauge chip (7 bits). Set to 0xFF to use a default address. |
| void batteryMonitor::setChargingWitness | ( | InputGPIO | sensePin, |
| bool | negativeLogic = true, | ||
| bool | enableInternalPullResistor = true ) |
Set a GPIO pin to sense if the battery is being charged.
| sensePin | GPIO pin attached to the battery charger chip |
| negativeLogic | If true, LOW voltage means the battery is charging. If false, HIGH voltage means the battery is charging. |
| enableInternalPullResistor | If true, the corresponding internal pullup/pulldown resistor is enabled. Set to true if the witness signal works in open drain. |
| void batteryMonitor::setExternalPowerWitness | ( | InputGPIO | sensePin | ) |
| void batteryMonitor::setPeriod | ( | uint32_t | seconds | ) |
Set time interval between measurements.
| [in] | seconds | Time to wait from one measurement to the next (in seconds). Set to zero for a default interval. |
| void batteryMonitor::setPowerOffSoC | ( | uint8_t | percentage | ) |
Set a battery level to shutdown the system.
| [in] | percentage | Value in the range from 0% (disable) to 100%. Invalid values are ignored. |
| void batteryMonitor::setWarningSoC | ( | uint8_t | percentage | ) |
Set a battery level to warn to the user.
| [in] | percentage | Value in the range from 0% (disable) to 100%. Invalid values are ignored. |