Skip to content

class_tiny_gsm_battery

Sara Damiano edited this page Sep 11, 2026 · 2 revisions

title: TinyGsmBattery

TinyGsmBattery (class)

Module: TinyGsmBattery

The CRTP parent class for battery functions.

#include <src/TinyGsmBattery.tpp>

Battery functions

Public Functions

Name
int16_t getBattVoltage()
Get the current battery voltage.
int8_t getBattPercent()
Get the current battery percent.
int8_t getBattChargeState()
Get the battery charging state.
bool getBattStats(int8_t & chargeState, int8_t & percent, int16_t & milliVolts)
Get the all battery state.

Public Functions Documentation

Battery functions

functiongetBattVoltage

int16_t getBattVoltage()

Note

Unless you have a battery directly connected to your modem module, this will be the input voltage going to the module from your main processor board, not the battery voltage of your main processor.

  • Return: The battery voltage measured by the modem module.

functiongetBattPercent

int8_t getBattPercent()

Note

Unless you have a battery directly connected to your modem module, this will be the percent from the input voltage going to the module from your main processor board, not the battery percent of your main processor.

  • Return: The current battery percent.

functiongetBattChargeState

int8_t getBattChargeState()
  • Return: The battery charge state.

functiongetBattStats

bool getBattStats(int8_t & chargeState, int8_t & percent, int16_t & milliVolts)
  • Parameters:
    • chargeState A reference to an int to set to the battery charge state
    • percent A reference to an int to set to the battery percent
    • milliVolts A reference to an int to set to the battery voltage
  • Return: True if the battery stats were updated by the module, false otherwise.

Generated by Doxygen and m.css with templates from doxybook2 Updated on 2026-09-11

Clone this wiki locally