MT2523 API Reference  LinkIt SDK v4
Battery Management

This section introduces the battery management interface APIs including terms and acronyms, supported features, software architecture, details on how to use this module, battery management interface function groups, enums, structures and functions. More...

Overview

This section introduces the battery management interface APIs including terms and acronyms, supported features, software architecture, details on how to use this module, battery management interface function groups, enums, structures and functions.

The battery management interface APIs can be used to provide battery information such as voltage, temperature, charger type and more.

Terms and acronyms

Terms Details
BMT Battery Management Task.
GM Gauge Master, software fuel gauge algorithms.

Software Architecture of the battery management

Battery management creates a BMT task and provides software fuel gauge through the GM library.

battery_management_architecture.png

How to use the battery management interface

Functions

battery_management_status_t battery_management_init (void)
 This function initializes the battery management. More...
 
int32_t battery_management_get_battery_property (battery_property_t property)
 This function gets the current information about the battery. More...
 
battery_management_status_t battery_management_register_callback (battery_management_callback_t callback)
 This function registers a callback function to receive the battery management event. More...
 
battery_management_status_t battery_management_deinit (void)
 This function deinitializes the battery management. More...
 

Modules

 Define
 
 Enum
 
 Typedef
 

Function Documentation

battery_management_status_t battery_management_deinit ( void  )

This function deinitializes the battery management.

Returns
BATTERY_MANAGEMENT_STATUS_OK, if the battery management deinitialization was successful.
BATTERY_MANAGEMENT_STATUS_ERROR, if the battery management deinitialization failed.
int32_t battery_management_get_battery_property ( battery_property_t  property)

This function gets the current information about the battery.

Parameters
[in]propertyis one of the battery properties defined in battery_property_t.
Returns
Returns the value of the battery property. BATTERY_INVALID_VALUE, if the value is invalid.
Enum Return description
BATTERY_PROPERTY_CAPACITY Remaining battery capacity. The unit is percentage.
BATTERY_PROPERTY_CHARGING_CURRENT Average charging current. The unit is mA.
BATTERY_PROPERTY_CHARGER_EXIST Charger existence status 0:charger is not connected; 1:charger is connected.
BATTERY_PROPERTY_CHARGER_TYPE Charger type 0: unknown; 1: standard host; 2: non-standard AC charger; 3: standard AC charger; 4: charging host.
BATTERY_PROPERTY_TEMPERATURE Battery temperature. The unit is Celsius degrees.
BATTERY_PROPERTY_VOLTAGE Battery's average voltage. The unit is mV.
BATTERY_PROPERTY_CAPACITY_LEVEL Remaining battery capacity in level format. Level range is from 0 to 5,-1 means uninitialized.
battery_management_status_t battery_management_init ( void  )

This function initializes the battery management.

The battery management should be initialized after the hardware initialization and before creating any tasks.

Returns
BATTERY_MANAGEMENT_STATUS_OK, if the battery management initialization was successful.
BATTERY_MANAGEMENT_STATUS_ERROR, if the battery management initialization failed.
battery_management_status_t battery_management_register_callback ( battery_management_callback_t  callback)

This function registers a callback function to receive the battery management event.

Parameters
[in]callbackis the callback to be registered.
Returns
BATTERY_MANAGEMENT_STATUS_OK, if the callback function registration was successful.
BATTERY_MANAGEMENT_STATUS_ERROR, if the callback function registration failed.
BATTERY_MANAGEMENT_STATUS_INVALID_PARAMETER, if a given parameter was invalid.