name=Battery Monitor
category=HAL

# Any string is allowable here.  Generally though it is Production Ready, Test Tool, Extension Needed
qualityString=Production Ready
# This is one of the following:  productionReady, testTool, extensionNeeded
quality=productionReady

description= This plugin will monitor the value of the battery during the middle of radio transmissions, and use that data to calculate the voltage level of the battery.  For an em35x chip, this requires the board.h to be modified so that the TX Active pin (PC5 for an em35x) is set as a wake on interrupt pin, and configured as an alternate output with a push/pull drive.  No port and pin need to be set in the board.h for this plugin, but an IRQ must be selected by defining the BATTERY_MONITOR_IRQ macro to something like HAL_GIC_IRQ_NUMD.  Also, the PHY_CONFIG token should be set to one of the external PA drive options.  For an EFR32 design, the HAL_BATTERY_MONITOR_TX_ACTIVE_PORT and HAL_BATTERY_MONITOR_TX_ACTIVE_PIN macros must be set in the board.h.

architecture=efr32,em341,em342,em346,em351,em355,em3555,em357,em3581,em3582,em3585,em3586,em3587,em3588,em3591,em3592,em3595,em3596,em3597,em3598,simulation

providedApis=battery-monitor
api.battery-monitor.header=$PLUGIN/plugin-common/battery-monitor/battery-monitor.h

#HAL API is required in order to get access to ADC functions
requiredApis=hal

$PLUGIN/plugin-common/battery-monitor/battery-monitor-em3xx.c (em341,em342,em346,em351,em355,em3555,em357,em3581,em3582,em3585,em3586,em3587,em3588,em3591,em3592,em3595,em3596,em3597,em3598)
$PLUGIN/plugin-common/battery-monitor/battery-monitor-efr32.c (efr32)
$PLUGIN/plugin-common/battery-monitor-stub/battery-monitor-stub.c (simulation)

setup(hwConfig) {
  dependentHwConfModules=BATTERYMON
}

callbacks=$PLUGIN/plugin-common/battery-monitor/callback.info
requiredPlugins=generic-interrupt-control

# Not included by default
includedByDefault=false

implementedCallbacks=emberAfPluginBatteryMonitorInitCallback

options=monitorTimeoutM,sampleFifoSize

monitorTimeoutM.name=Monitor Timeout (Minutes)
monitorTimeoutM.description=The length of time between battery reads.
monitorTimeoutM.type=NUMBER:0,1000
monitorTimeoutM.default=30

sampleFifoSize.name=Sample Collection FIFO Size
sampleFifoSize.description=The number of entries in the fifo used to collect ADC reads of the battery
sampleFifoSize.type=NUMBER:1,20
sampleFifoSize.default=16

events=ReadADC
