npmx  1.0.0
 
Loading...
Searching...
No Matches
CHARGER

Battery charger peripheral driver. More...

Data Structures

struct  npmx_charger_t
 Data structure of the CHARGER driver instance. More...
 

Enumerations

enum  npmx_charger_task_t {
  NPMX_CHARGER_TASK_RELEASE ,
  NPMX_CHARGER_TASK_CLEAR_ERROR ,
  NPMX_CHARGER_TASK_CLEAR_TIMERS ,
  NPMX_CHARGER_TASK_COUNT
}
 Charger tasks. More...
 
enum  npmx_charger_module_mask_t {
  NPMX_CHARGER_MODULE_CHARGER_MASK = (1U << 0U) ,
  NPMX_CHARGER_MODULE_FULL_COOL_MASK = (1U << 1U) ,
  NPMX_CHARGER_MODULE_RECHARGE_MASK = (1U << 2U) ,
  NPMX_CHARGER_MODULE_NTC_LIMITS_MASK = (1U << 3U)
}
 Charger modules to be enabled and disabled. More...
 
enum  npmx_charger_voltage_t {
  NPMX_CHARGER_VOLTAGE_3V50 = BCHARGER_BCHGVTERMR_BCHGVTERMREDUCED_3V50 ,
  NPMX_CHARGER_VOLTAGE_3V55 = BCHARGER_BCHGVTERMR_BCHGVTERMREDUCED_3V55 ,
  NPMX_CHARGER_VOLTAGE_3V60 = BCHARGER_BCHGVTERMR_BCHGVTERMREDUCED_3V60 ,
  NPMX_CHARGER_VOLTAGE_3V65 = BCHARGER_BCHGVTERMR_BCHGVTERMREDUCED_3V65 ,
  NPMX_CHARGER_VOLTAGE_4V00 = BCHARGER_BCHGVTERMR_BCHGVTERMREDUCED_4V00 ,
  NPMX_CHARGER_VOLTAGE_4V05 = BCHARGER_BCHGVTERMR_BCHGVTERMREDUCED_4V05 ,
  NPMX_CHARGER_VOLTAGE_4V10 = BCHARGER_BCHGVTERMR_BCHGVTERMREDUCED_4V10 ,
  NPMX_CHARGER_VOLTAGE_4V15 = BCHARGER_BCHGVTERMR_BCHGVTERMREDUCED_4V15 ,
  NPMX_CHARGER_VOLTAGE_4V20 = BCHARGER_BCHGVTERMR_BCHGVTERMREDUCED_4V20 ,
  NPMX_CHARGER_VOLTAGE_4V25 = BCHARGER_BCHGVTERMR_BCHGVTERMREDUCED_4V25 ,
  NPMX_CHARGER_VOLTAGE_4V30 = BCHARGER_BCHGVTERMR_BCHGVTERMREDUCED_4V30 ,
  NPMX_CHARGER_VOLTAGE_4V35 = BCHARGER_BCHGVTERMR_BCHGVTERMREDUCED_4V35 ,
  NPMX_CHARGER_VOLTAGE_4V40 = BCHARGER_BCHGVTERMR_BCHGVTERMREDUCED_4V40 ,
  NPMX_CHARGER_VOLTAGE_4V45 = BCHARGER_BCHGVTERMR_BCHGVTERMREDUCED_4V45 ,
  NPMX_CHARGER_VOLTAGE_COUNT ,
  NPMX_CHARGER_VOLTAGE_DEFAULT = NPMX_CHARGER_VOLTAGE_3V60 ,
  NPMX_CHARGER_VOLTAGE_MAX = NPMX_CHARGER_VOLTAGE_4V45 ,
  NPMX_CHARGER_VOLTAGE_INVALID = NPMX_INVALID_ENUM_VALUE
}
 Battery charger termination voltage Normal and Warm. More...
 
enum  npmx_charger_status_mask_t {
  NPMX_CHARGER_STATUS_BATTERY_DETECTED_MASK = BCHARGER_BCHGCHARGESTATUS_BATTERYDETECTED_Msk ,
  NPMX_CHARGER_STATUS_COMPLETED_MASK = BCHARGER_BCHGCHARGESTATUS_COMPLETED_Msk ,
  NPMX_CHARGER_STATUS_TRICKLE_CHARGE_MASK = BCHARGER_BCHGCHARGESTATUS_TRICKLECHARGE_Msk ,
  NPMX_CHARGER_STATUS_CONSTANT_CURRENT_MASK = BCHARGER_BCHGCHARGESTATUS_CONSTANTCURRENT_Msk ,
  NPMX_CHARGER_STATUS_CONSTANT_VOLTAGE_MASK = BCHARGER_BCHGCHARGESTATUS_CONSTANTVOLTAGE_Msk ,
  NPMX_CHARGER_STATUS_RECHARGE_MASK = BCHARGER_BCHGCHARGESTATUS_RECHARGE_Msk ,
  NPMX_CHARGER_STATUS_DIE_TEMP_HIGH_MASK = BCHARGER_BCHGCHARGESTATUS_DIETEMPHIGHCHGPAUSED_Msk ,
  NPMX_CHARGER_STATUS_SUPPLEMENT_ACTIVE_MASK = BCHARGER_BCHGCHARGESTATUS_SUPPLEMENTACTIVE_Msk
}
 Battery charger status. More...
 
enum  npmx_charger_trickle_t {
  NPMX_CHARGER_TRICKLE_2V9 = BCHARGER_BCHGVTRICKLESEL_BCHGVTRICKLESEL_2V9 ,
  NPMX_CHARGER_TRICKLE_2V5 = BCHARGER_BCHGVTRICKLESEL_BCHGVTRICKLESEL_2V5 ,
  NPMX_CHARGER_TRICKLE_COUNT ,
  NPMX_CHARGER_TRICKLE_DEFAULT = NPMX_CHARGER_TRICKLE_2V9 ,
  NPMX_CHARGER_TRICKLE_MAX = NPMX_CHARGER_TRICKLE_2V9 ,
  NPMX_CHARGER_TRICKLE_INVALID = NPMX_INVALID_ENUM_VALUE
}
 Battery charger trickle level select. More...
 
enum  npmx_charger_iterm_t {
  NPMX_CHARGER_ITERM_10 = BCHARGER_BCHGITERMSEL_BCHGITERMSEL_SEL10 ,
  NPMX_CHARGER_ITERM_20 = BCHARGER_BCHGITERMSEL_BCHGITERMSEL_SEL20 ,
  NPMX_CHARGER_ITERM_COUNT ,
  NPMX_CHARGER_ITERM_DEFAULT = NPMX_CHARGER_ITERM_10 ,
  NPMX_CHARGER_ITERM_MAX = NPMX_CHARGER_ITERM_20 ,
  NPMX_CHARGER_ITERM_INVALID = NPMX_INVALID_ENUM_VALUE
}
 Battery charger termination current select. More...
 
enum  npmx_charger_ntc_status_mask_t {
  NPMX_CHARGER_NTC_STATUS_COLD_MASK = BCHARGER_NTCSTATUS_NTCCOLD_Msk ,
  NPMX_CHARGER_NTC_STATUS_COOL_MASK = BCHARGER_NTCSTATUS_NTCCOOL_Msk ,
  NPMX_CHARGER_NTC_STATUS_WARM_MASK = BCHARGER_NTCSTATUS_NTCWARM_Msk ,
  NPMX_CHARGER_NTC_STATUS_HOT_MASK = BCHARGER_NTCSTATUS_NTCHOT_Msk
}
 NTC comparator status fields. More...
 

Functions

npmx_charger_tnpmx_charger_get (npmx_instance_t *p_pmic, uint8_t idx)
 Function for returning CHARGER instance based on index.
 
npmx_charger_voltage_t npmx_charger_voltage_convert (uint32_t millivolts)
 Function for converting millivolts to npmx_charger_voltage_t enumeration.
 
bool npmx_charger_voltage_convert_to_mv (npmx_charger_voltage_t enum_value, uint32_t *p_val)
 Function for converting npmx_charger_voltage_t enumeration to millivolts.
 
npmx_charger_trickle_t npmx_charger_trickle_convert (uint32_t millivolts)
 Function for converting millivolts to npmx_charger_trickle_t enumeration.
 
bool npmx_charger_trickle_convert_to_mv (npmx_charger_trickle_t enum_value, uint32_t *p_val)
 Function for converting npmx_charger_trickle_t enumeration to millivolts.
 
npmx_charger_iterm_t npmx_charger_iterm_convert (uint32_t percent)
 Function for converting percentage value of charging current to npmx_charger_iterm_t enumeration.
 
bool npmx_charger_iterm_convert_to_pct (npmx_charger_iterm_t enum_value, uint32_t *p_val)
 Function for converting percentage value of charging current to npmx_charger_iterm_t enumeration.
 
npmx_error_t npmx_charger_task_trigger (npmx_charger_t const *p_instance, npmx_charger_task_t task)
 Function for activating the specified charger task.
 
npmx_error_t npmx_charger_module_enable_set (npmx_charger_t const *p_instance, uint32_t module_mask)
 Function for enabling specified charger modules.
 
npmx_error_t npmx_charger_module_disable_set (npmx_charger_t const *p_instance, uint32_t module_mask)
 Function for disabling specified charger modules.
 
npmx_error_t npmx_charger_module_get (npmx_charger_t const *p_instance, uint32_t *p_modules_mask)
 Function for checking which charger modules are enabled.
 
npmx_error_t npmx_charger_charging_current_set (npmx_charger_t *p_instance, uint16_t current)
 Function for setting charger current of nPM device. Default value after reset is 32 mA.
 
npmx_error_t npmx_charger_charging_current_get (npmx_charger_t *p_instance, uint16_t *p_current)
 Function for reading charger current from nPM device. Default value after reset is 32 mA.
 
npmx_error_t npmx_charger_discharging_current_set (npmx_charger_t *p_instance, uint16_t current)
 Function for setting maximum discharging current of nPM device. Default value after reset is 1000 mA.
 
npmx_error_t npmx_charger_discharging_current_get (npmx_charger_t *p_instance, uint16_t *p_current)
 Function for reading maximum discharging current of nPM device. Default value after reset is 1000 mA.
 
npmx_error_t npmx_charger_termination_normal_voltage_set (npmx_charger_t const *p_instance, npmx_charger_voltage_t voltage)
 Function for setting the normal termination battery voltage.
 
npmx_error_t npmx_charger_termination_normal_voltage_get (npmx_charger_t const *p_instance, npmx_charger_voltage_t *p_voltage)
 Function for reading the normal termination battery voltage.
 
npmx_error_t npmx_charger_termination_warm_voltage_set (npmx_charger_t const *p_instance, npmx_charger_voltage_t voltage)
 Function for setting the warm termination battery voltage.
 
npmx_error_t npmx_charger_termination_warm_voltage_get (npmx_charger_t const *p_instance, npmx_charger_voltage_t *p_voltage)
 Function for reading the warm termination battery voltage.
 
npmx_error_t npmx_charger_trickle_voltage_set (npmx_charger_t const *p_instance, npmx_charger_trickle_t trickle)
 Function for setting the trickle voltage. Trickle charging is performed when VBAT < V_TRICKLE_FAST.
 
npmx_error_t npmx_charger_trickle_voltage_get (npmx_charger_t const *p_instance, npmx_charger_trickle_t *p_trickle)
 Function for reading the trickle voltage.
 
npmx_error_t npmx_charger_termination_current_set (npmx_charger_t const *p_instance, npmx_charger_iterm_t iterm)
 Function for setting the termination current ITERM. Trickle charging current I_TRICKLE is 10% or 20% of I_CHG (charging current).
 
npmx_error_t npmx_charger_termination_current_get (npmx_charger_t const *p_instance, npmx_charger_iterm_t *p_iterm)
 Function for reading the termination current ITERM.
 
npmx_error_t npmx_charger_cold_resistance_set (npmx_charger_t const *p_instance, uint32_t resistance)
 Function for setting the NTC cold resistance threshold.
 
npmx_error_t npmx_charger_cold_resistance_get (npmx_charger_t const *p_instance, uint32_t *p_resistance)
 Function for reading the NTC cold resistance threshold.
 
npmx_error_t npmx_charger_cool_resistance_set (npmx_charger_t const *p_instance, uint32_t resistance)
 Function for setting the NTC cool resistance threshold.
 
npmx_error_t npmx_charger_cool_resistance_get (npmx_charger_t const *p_instance, uint32_t *p_resistance)
 Function for reading the NTC cool resistance threshold.
 
npmx_error_t npmx_charger_warm_resistance_set (npmx_charger_t const *p_instance, uint32_t resistance)
 Function for setting the NTC warm resistance threshold.
 
npmx_error_t npmx_charger_warm_resistance_get (npmx_charger_t const *p_instance, uint32_t *p_resistance)
 Function for reading the NTC warm resistance threshold.
 
npmx_error_t npmx_charger_hot_resistance_set (npmx_charger_t const *p_instance, uint32_t resistance)
 Function for setting the NTC hot resistance threshold.
 
npmx_error_t npmx_charger_hot_resistance_get (npmx_charger_t const *p_instance, uint32_t *p_resistance)
 Function for reading the NTC hot resistance threshold.
 
npmx_error_t npmx_charger_cold_temperature_set (npmx_charger_t const *p_instance, int16_t temperature)
 Function for setting the NTC cold temperature threshold.
 
npmx_error_t npmx_charger_cold_temperature_get (npmx_charger_t const *p_instance, int16_t *p_temperature)
 Function for reading the NTC cold temperature threshold.
 
npmx_error_t npmx_charger_cool_temperature_set (npmx_charger_t const *p_instance, int16_t temperature)
 Function for setting the NTC cool temperature threshold.
 
npmx_error_t npmx_charger_cool_temperature_get (npmx_charger_t const *p_instance, int16_t *p_temperature)
 Function for reading the NTC cool temperature threshold.
 
npmx_error_t npmx_charger_warm_temperature_set (npmx_charger_t const *p_instance, int16_t temperature)
 Function for setting the NTC warm temperature threshold.
 
npmx_error_t npmx_charger_warm_temperature_get (npmx_charger_t const *p_instance, int16_t *p_temperature)
 Function for reading the NTC warm temperature threshold.
 
npmx_error_t npmx_charger_hot_temperature_set (npmx_charger_t const *p_instance, int16_t temperature)
 Function for setting the NTC hot temperature threshold.
 
npmx_error_t npmx_charger_hot_temperature_get (npmx_charger_t const *p_instance, int16_t *p_temperature)
 Function for reading the NTC hot temperature threshold.
 
npmx_error_t npmx_charger_die_temp_stop_set (npmx_charger_t const *p_instance, int16_t temperature)
 Function for setting die temperature value when charging needs to be stopped.
 
npmx_error_t npmx_charger_die_temp_stop_get (npmx_charger_t const *p_instance, int16_t *p_temperature)
 Function for reading die temperature value when charging needs to be stopped.
 
npmx_error_t npmx_charger_die_temp_resume_set (npmx_charger_t const *p_instance, int16_t temperature)
 Function for setting die temperature value when charging needs to be resumed.
 
npmx_error_t npmx_charger_die_temp_resume_get (npmx_charger_t const *p_instance, int16_t *p_temperature)
 Function for reading die temperature value when charging needs to be resumed.
 
npmx_error_t npmx_charger_ntc_status_get (npmx_charger_t const *p_instance, uint8_t *p_ntc_status)
 Function for reading the status of a NTC comparator.
 
npmx_error_t npmx_charger_die_temp_status_get (npmx_charger_t const *p_instance, bool *p_die_temp_status)
 Function for reading the status of a die temp comparator.
 
npmx_error_t npmx_charger_current_limiter_get (npmx_charger_t const *p_instance, bool *p_current_lim_status)
 Function for reading the status of a current charger limiter.
 
npmx_error_t npmx_charger_status_get (npmx_charger_t const *p_instance, uint8_t *p_status_mask)
 Function for reading the charger status register.
 
npmx_error_t npmx_charger_errors_check (npmx_charger_t const *p_instance)
 Function for checking charger errors and running registered callbacks.
 
npmx_error_t npmx_charger_warm_disable_set (npmx_charger_t const *p_instance, bool disable)
 Function for setting a specific charger configuration: disable charging if battery is warm.
 
npmx_error_t npmx_charger_warm_disable_get (npmx_charger_t const *p_instance, bool *p_disable)
 Function for reading a specific charger configuration: disable charging if battery is warm.
 

Detailed Description

Battery charger peripheral driver.

Enumeration Type Documentation

◆ npmx_charger_iterm_t

Battery charger termination current select.

Enumerator
NPMX_CHARGER_ITERM_10 

ITERM current set to 10 percent of charging current.

NPMX_CHARGER_ITERM_20 

ITERM current set to 20 percent of charging current.

NPMX_CHARGER_ITERM_COUNT 

ITERM current max count.

NPMX_CHARGER_ITERM_DEFAULT 

Default ITERM current set to 10 percent of charging current.

NPMX_CHARGER_ITERM_MAX 

Maximum ITERM current set to 20 percent of charging current.

NPMX_CHARGER_ITERM_INVALID 

Invalid ITERM current.

◆ npmx_charger_module_mask_t

Charger modules to be enabled and disabled.

Enumerator
NPMX_CHARGER_MODULE_CHARGER_MASK 

Battery charger module.

NPMX_CHARGER_MODULE_FULL_COOL_MASK 

Battery charger module full charge in Cool temperature.

NPMX_CHARGER_MODULE_RECHARGE_MASK 

Battery charger module recharge.

NPMX_CHARGER_MODULE_NTC_LIMITS_MASK 

Battery charger module NTC temperature limits.

◆ npmx_charger_ntc_status_mask_t

NTC comparator status fields.

Enumerator
NPMX_CHARGER_NTC_STATUS_COLD_MASK 

NTC temperature is cold.

NPMX_CHARGER_NTC_STATUS_COOL_MASK 

NTC temperature is cool.

NPMX_CHARGER_NTC_STATUS_WARM_MASK 

NTC temperature is warm.

NPMX_CHARGER_NTC_STATUS_HOT_MASK 

NTC temperature is hot.

◆ npmx_charger_status_mask_t

Battery charger status.

Enumerator
NPMX_CHARGER_STATUS_BATTERY_DETECTED_MASK 

Battery is connected.

NPMX_CHARGER_STATUS_COMPLETED_MASK 

Charging completed (Battery Full).

NPMX_CHARGER_STATUS_TRICKLE_CHARGE_MASK 

Trickle charge.

NPMX_CHARGER_STATUS_CONSTANT_CURRENT_MASK 

Constant current charging.

NPMX_CHARGER_STATUS_CONSTANT_VOLTAGE_MASK 

Constant voltage charging.

NPMX_CHARGER_STATUS_RECHARGE_MASK 

Battery recharge is needed.

NPMX_CHARGER_STATUS_DIE_TEMP_HIGH_MASK 

Charging stopped due to the high die temperature.

NPMX_CHARGER_STATUS_SUPPLEMENT_ACTIVE_MASK 

Supplement mode Active.

◆ npmx_charger_task_t

Charger tasks.

Enumerator
NPMX_CHARGER_TASK_RELEASE 

SW release from charger error state.

NPMX_CHARGER_TASK_CLEAR_ERROR 

Clear registers of BCHGERRREASON and BCHGERRSENSOR.

NPMX_CHARGER_TASK_CLEAR_TIMERS 

Clear TRICKLE and CHARGE safety timers.

NPMX_CHARGER_TASK_COUNT 

Charger tasks count.

◆ npmx_charger_trickle_t

Battery charger trickle level select.

Enumerator
NPMX_CHARGER_TRICKLE_2V9 

Trickle voltage level 2.9 V.

NPMX_CHARGER_TRICKLE_2V5 

Trickle voltage level 2.5 V.

NPMX_CHARGER_TRICKLE_COUNT 

Trickle voltage levels count.

NPMX_CHARGER_TRICKLE_DEFAULT 

Default trickle voltage level 2.9 V.

NPMX_CHARGER_TRICKLE_MAX 

Maximum trickle voltage.

NPMX_CHARGER_TRICKLE_INVALID 

Invalid trickle voltage.

◆ npmx_charger_voltage_t

Battery charger termination voltage Normal and Warm.

Enumerator
NPMX_CHARGER_VOLTAGE_3V50 

3.50 V

NPMX_CHARGER_VOLTAGE_3V55 

3.55 V

NPMX_CHARGER_VOLTAGE_3V60 

3.60 V

NPMX_CHARGER_VOLTAGE_3V65 

3.65 V

NPMX_CHARGER_VOLTAGE_4V00 

4.00 V

NPMX_CHARGER_VOLTAGE_4V05 

4.05 V

NPMX_CHARGER_VOLTAGE_4V10 

4.10 V

NPMX_CHARGER_VOLTAGE_4V15 

4.15 V

NPMX_CHARGER_VOLTAGE_4V20 

4.20 V

NPMX_CHARGER_VOLTAGE_4V25 

4.25 V

NPMX_CHARGER_VOLTAGE_4V30 

4.30 V

NPMX_CHARGER_VOLTAGE_4V35 

4.35 V

NPMX_CHARGER_VOLTAGE_4V40 

4.40 V

NPMX_CHARGER_VOLTAGE_4V45 

4.45 V

NPMX_CHARGER_VOLTAGE_COUNT 

Possible voltages count.

NPMX_CHARGER_VOLTAGE_DEFAULT 

Default 3.60 V.

NPMX_CHARGER_VOLTAGE_MAX 

Maximum voltage.

NPMX_CHARGER_VOLTAGE_INVALID 

Invalid voltage.

Function Documentation

◆ npmx_charger_charging_current_get()

npmx_error_t npmx_charger_charging_current_get ( npmx_charger_t * p_instance,
uint16_t * p_current )

Function for reading charger current from nPM device. Default value after reset is 32 mA.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_currentPointer to the current variable. Charger current in milliamperes in a range from 32 to 800 with a step of 2.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_charging_current_set()

npmx_error_t npmx_charger_charging_current_set ( npmx_charger_t * p_instance,
uint16_t current )

Function for setting charger current of nPM device. Default value after reset is 32 mA.

Note
Charger has to be disabled before changing the current setting. The setting takes effect when charging is enabled or re-enabled.
Parameters
[in]p_instancePointer to the CHARGER instance.
[in]currentCharger current in milliamperes in a range from 32 to 800 with a step of 2.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_INVALID_PARAMCurrent out of range.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_cold_resistance_get()

npmx_error_t npmx_charger_cold_resistance_get ( npmx_charger_t const * p_instance,
uint32_t * p_resistance )

Function for reading the NTC cold resistance threshold.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_resistancePointer to the resistance variable in Ohms.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_cold_resistance_set()

npmx_error_t npmx_charger_cold_resistance_set ( npmx_charger_t const * p_instance,
uint32_t resistance )

Function for setting the NTC cold resistance threshold.

Note
Resistance value should be read from NTC characteristic for selected temperature.
Parameters
[in]p_instancePointer to the CHARGER instance.
[in]resistanceResistance threshold in Ohms, value should be greater than 0.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_cold_temperature_get()

npmx_error_t npmx_charger_cold_temperature_get ( npmx_charger_t const * p_instance,
int16_t * p_temperature )

Function for reading the NTC cold temperature threshold.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_temperaturePointer to the temperature variable in degrees Celsius.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_cold_temperature_set()

npmx_error_t npmx_charger_cold_temperature_set ( npmx_charger_t const * p_instance,
int16_t temperature )

Function for setting the NTC cold temperature threshold.

Parameters
[in]p_instancePointer to the CHARGER instance.
[in]temperatureTemperature threshold in degrees Celsius. The value should be in the range between -20 and 60 degrees.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_cool_resistance_get()

npmx_error_t npmx_charger_cool_resistance_get ( npmx_charger_t const * p_instance,
uint32_t * p_resistance )

Function for reading the NTC cool resistance threshold.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_resistancePointer to the resistance variable.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_cool_resistance_set()

npmx_error_t npmx_charger_cool_resistance_set ( npmx_charger_t const * p_instance,
uint32_t resistance )

Function for setting the NTC cool resistance threshold.

Note
Resistance value should be read from NTC characteristic for selected temperature.
Parameters
[in]p_instancePointer to the CHARGER instance.
[in]resistanceResistance threshold in Ohms, value should be greater than 0.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_cool_temperature_get()

npmx_error_t npmx_charger_cool_temperature_get ( npmx_charger_t const * p_instance,
int16_t * p_temperature )

Function for reading the NTC cool temperature threshold.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_temperaturePointer to the temperature variable in degrees Celsius.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_cool_temperature_set()

npmx_error_t npmx_charger_cool_temperature_set ( npmx_charger_t const * p_instance,
int16_t temperature )

Function for setting the NTC cool temperature threshold.

Parameters
[in]p_instancePointer to the CHARGER instance.
[in]temperatureTemperature threshold in degrees Celsius. The value should be in the range between -20 and 60 degrees.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_current_limiter_get()

npmx_error_t npmx_charger_current_limiter_get ( npmx_charger_t const * p_instance,
bool * p_current_lim_status )

Function for reading the status of a current charger limiter.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_current_lim_statusPointer to the current charger limiter status indicator. True if limiter is active.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_die_temp_resume_get()

npmx_error_t npmx_charger_die_temp_resume_get ( npmx_charger_t const * p_instance,
int16_t * p_temperature )

Function for reading die temperature value when charging needs to be resumed.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_temperaturePointer to the temperature variable.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_die_temp_resume_set()

npmx_error_t npmx_charger_die_temp_resume_set ( npmx_charger_t const * p_instance,
int16_t temperature )

Function for setting die temperature value when charging needs to be resumed.

Parameters
[in]p_instancePointer to the CHARGER instance.
[in]temperatureTemperature in *C at which die resume threshold event happens.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_die_temp_status_get()

npmx_error_t npmx_charger_die_temp_status_get ( npmx_charger_t const * p_instance,
bool * p_die_temp_status )

Function for reading the status of a die temp comparator.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_die_temp_statusPointer to the die temperature status variable. True for high die temperature.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_die_temp_stop_get()

npmx_error_t npmx_charger_die_temp_stop_get ( npmx_charger_t const * p_instance,
int16_t * p_temperature )

Function for reading die temperature value when charging needs to be stopped.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_temperaturePointer to the temperature variable.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_die_temp_stop_set()

npmx_error_t npmx_charger_die_temp_stop_set ( npmx_charger_t const * p_instance,
int16_t temperature )

Function for setting die temperature value when charging needs to be stopped.

Parameters
[in]p_instancePointer to the CHARGER instance.
[in]temperatureTemperature in *C at which die stop threshold event happens.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_discharging_current_get()

npmx_error_t npmx_charger_discharging_current_get ( npmx_charger_t * p_instance,
uint16_t * p_current )

Function for reading maximum discharging current of nPM device. Default value after reset is 1000 mA.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_currentPointer to the current variable. Maximum discharging current in milliamperes from in a range from 270 to 1340 with a step of 2.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_discharging_current_set()

npmx_error_t npmx_charger_discharging_current_set ( npmx_charger_t * p_instance,
uint16_t current )

Function for setting maximum discharging current of nPM device. Default value after reset is 1000 mA.

Parameters
[in]p_instancePointer to the CHARGER instance.
[in]currentMaximum discharging current in milliamperes in a range from 270 to 1340 with a step of 2.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_INVALID_PARAMCurrent out of range.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_errors_check()

npmx_error_t npmx_charger_errors_check ( npmx_charger_t const * p_instance)

Function for checking charger errors and running registered callbacks.

Note
Function should be called when event charging error occurs.
Parameters
[in]p_instancePointer to the CHARGER instance.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_get()

npmx_charger_t * npmx_charger_get ( npmx_instance_t * p_pmic,
uint8_t idx )

Function for returning CHARGER instance based on index.

Parameters
[in]p_pmicPointer to the PMIC instance.
[in]idxIndex of the CHARGER instance.
Returns
Pointer to the CHARGER instance.

◆ npmx_charger_hot_resistance_get()

npmx_error_t npmx_charger_hot_resistance_get ( npmx_charger_t const * p_instance,
uint32_t * p_resistance )

Function for reading the NTC hot resistance threshold.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_resistancePointer to the resistance variable.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_hot_resistance_set()

npmx_error_t npmx_charger_hot_resistance_set ( npmx_charger_t const * p_instance,
uint32_t resistance )

Function for setting the NTC hot resistance threshold.

Note
resistance value should be read from NTC characteristic for selected temperature.
Parameters
[in]p_instancePointer to the CHARGER instance.
[in]resistanceResistance threshold in Ohms, value should be greater than 0.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_hot_temperature_get()

npmx_error_t npmx_charger_hot_temperature_get ( npmx_charger_t const * p_instance,
int16_t * p_temperature )

Function for reading the NTC hot temperature threshold.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_temperaturePointer to the temperature variable in degrees Celsius.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_hot_temperature_set()

npmx_error_t npmx_charger_hot_temperature_set ( npmx_charger_t const * p_instance,
int16_t temperature )

Function for setting the NTC hot temperature threshold.

Parameters
[in]p_instancePointer to the CHARGER instance.
[in]temperatureTemperature threshold in degrees Celsius. The value should be in the range between -20 and 60 degrees.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_iterm_convert()

npmx_charger_iterm_t npmx_charger_iterm_convert ( uint32_t percent)

Function for converting percentage value of charging current to npmx_charger_iterm_t enumeration.

Parameters
[in]percentTermination current, as a percent of charging current, to be converted into npmx_charger_iterm_t enumeration.
Returns
Result of conversion. NPMX_CHARGER_ITERM_INVALID if given termination current is not represented in enumeration.

◆ npmx_charger_iterm_convert_to_pct()

bool npmx_charger_iterm_convert_to_pct ( npmx_charger_iterm_t enum_value,
uint32_t * p_val )

Function for converting percentage value of charging current to npmx_charger_iterm_t enumeration.

Parameters
[in]enum_valueTermination current defined as npmx_charger_iterm_t enumeration to be converted into a percent of charging current.
[out]p_valPointer to the variable that stores the conversion result.
Return values
trueConversion is valid.
falseConversion is invalid - an invalid argument was passed to the function.

◆ npmx_charger_module_disable_set()

npmx_error_t npmx_charger_module_disable_set ( npmx_charger_t const * p_instance,
uint32_t module_mask )

Function for disabling specified charger modules.

Parameters
[in]p_instancePointer to the CHARGER instance.
[in]module_maskMask of modules to be disabled, variable composed of values from npmx_charger_module_mask_t.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_module_enable_set()

npmx_error_t npmx_charger_module_enable_set ( npmx_charger_t const * p_instance,
uint32_t module_mask )

Function for enabling specified charger modules.

Parameters
[in]p_instancePointer to the CHARGER instance.
[in]module_maskMask of modules to be enabled, variable composed of values from npmx_charger_module_mask_t.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_module_get()

npmx_error_t npmx_charger_module_get ( npmx_charger_t const * p_instance,
uint32_t * p_modules_mask )

Function for checking which charger modules are enabled.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_modules_maskPointer to modules status variable composed of values from npmx_charger_module_mask_t.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_ntc_status_get()

npmx_error_t npmx_charger_ntc_status_get ( npmx_charger_t const * p_instance,
uint8_t * p_ntc_status )

Function for reading the status of a NTC comparator.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_ntc_statusPointer to the NTC comparator status mask composed of values from npmx_charger_ntc_status_mask_t.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_status_get()

npmx_error_t npmx_charger_status_get ( npmx_charger_t const * p_instance,
uint8_t * p_status_mask )

Function for reading the charger status register.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_status_maskPointer to the charger status mask composed of values from npmx_charger_status_mask_t.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_task_trigger()

npmx_error_t npmx_charger_task_trigger ( npmx_charger_t const * p_instance,
npmx_charger_task_t task )

Function for activating the specified charger task.

Parameters
[in]p_instancePointer to the CHARGER instance.
[in]taskTask to be activated.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_termination_current_get()

npmx_error_t npmx_charger_termination_current_get ( npmx_charger_t const * p_instance,
npmx_charger_iterm_t * p_iterm )

Function for reading the termination current ITERM.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_itermPointer to the iterm variable.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_termination_current_set()

npmx_error_t npmx_charger_termination_current_set ( npmx_charger_t const * p_instance,
npmx_charger_iterm_t iterm )

Function for setting the termination current ITERM. Trickle charging current I_TRICKLE is 10% or 20% of I_CHG (charging current).

Parameters
[in]p_instancePointer to the CHARGER instance.
[in]itermTrickle charging percent value: 10% or 20%.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_termination_normal_voltage_get()

npmx_error_t npmx_charger_termination_normal_voltage_get ( npmx_charger_t const * p_instance,
npmx_charger_voltage_t * p_voltage )

Function for reading the normal termination battery voltage.

Note
This termination voltage is used when battery is in cool or normal temperature region.
Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_voltagePointer to the charger voltage variable.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_termination_normal_voltage_set()

npmx_error_t npmx_charger_termination_normal_voltage_set ( npmx_charger_t const * p_instance,
npmx_charger_voltage_t voltage )

Function for setting the normal termination battery voltage.

Note
This termination voltage is used when battery is in cool or normal temperature region.
Parameters
[in]p_instancePointer to the CHARGER instance.
[in]voltageVoltage, in ranges 3.5-3.65 V or 4.0-4.45 V in 50 mV steps.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_termination_warm_voltage_get()

npmx_error_t npmx_charger_termination_warm_voltage_get ( npmx_charger_t const * p_instance,
npmx_charger_voltage_t * p_voltage )

Function for reading the warm termination battery voltage.

Note
This termination voltage is used when battery is in warm temperature region.
Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_voltagePointer to the voltage variable.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_termination_warm_voltage_set()

npmx_error_t npmx_charger_termination_warm_voltage_set ( npmx_charger_t const * p_instance,
npmx_charger_voltage_t voltage )

Function for setting the warm termination battery voltage.

Note
This termination voltage is used when battery is in warm temperature region.
Parameters
[in]p_instancePointer to the CHARGER instance.
[in]voltageVoltage, in ranges 3.5-3.65 V or 4.0-4.45 V in 50 mV steps.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_trickle_convert()

npmx_charger_trickle_t npmx_charger_trickle_convert ( uint32_t millivolts)

Function for converting millivolts to npmx_charger_trickle_t enumeration.

Parameters
[in]millivoltsVoltage in millivolts to be converted into npmx_charger_trickle_t enumeration.
Returns
Result of conversion. NPMX_CHARGER_TRICKLE_INVALID if given voltage is not represented in enumeration.

◆ npmx_charger_trickle_convert_to_mv()

bool npmx_charger_trickle_convert_to_mv ( npmx_charger_trickle_t enum_value,
uint32_t * p_val )

Function for converting npmx_charger_trickle_t enumeration to millivolts.

Parameters
[in]enum_valueVoltage defined as npmx_charger_trickle_t enumeration to be converted into millivolts.
[out]p_valPointer to the variable that stores the conversion result.
Return values
trueConversion is valid.
falseConversion is invalid - an invalid argument was passed to the function.

◆ npmx_charger_trickle_voltage_get()

npmx_error_t npmx_charger_trickle_voltage_get ( npmx_charger_t const * p_instance,
npmx_charger_trickle_t * p_trickle )

Function for reading the trickle voltage.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_tricklePointer to the trickle variable.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_trickle_voltage_set()

npmx_error_t npmx_charger_trickle_voltage_set ( npmx_charger_t const * p_instance,
npmx_charger_trickle_t trickle )

Function for setting the trickle voltage. Trickle charging is performed when VBAT < V_TRICKLE_FAST.

Parameters
[in]p_instancePointer to the CHARGER instance.
[in]trickleTrickle voltage value.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_voltage_convert()

npmx_charger_voltage_t npmx_charger_voltage_convert ( uint32_t millivolts)

Function for converting millivolts to npmx_charger_voltage_t enumeration.

Parameters
[in]millivoltsVoltage in millivolts to be converted into npmx_charger_voltage_t enumeration.
Returns
Result of conversion. NPMX_CHARGER_VOLTAGE_INVALID if given voltage is not represented in enumeration.

◆ npmx_charger_voltage_convert_to_mv()

bool npmx_charger_voltage_convert_to_mv ( npmx_charger_voltage_t enum_value,
uint32_t * p_val )

Function for converting npmx_charger_voltage_t enumeration to millivolts.

Parameters
[in]enum_valueVoltage defined as npmx_charger_voltage_t enumeration to be converted into millivolts.
[out]p_valPointer to the variable that stores the conversion result.
Return values
trueConversion is valid.
falseConversion is invalid - an invalid argument was passed to the function.

◆ npmx_charger_warm_disable_get()

npmx_error_t npmx_charger_warm_disable_get ( npmx_charger_t const * p_instance,
bool * p_disable )

Function for reading a specific charger configuration: disable charging if battery is warm.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_disablePointer to the temperature variable. True when charger disables charging if battery is warm.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_warm_disable_set()

npmx_error_t npmx_charger_warm_disable_set ( npmx_charger_t const * p_instance,
bool disable )

Function for setting a specific charger configuration: disable charging if battery is warm.

Parameters
[in]p_instancePointer to the CHARGER instance.
[in]disableTrue for disabling the charging when battery is warm.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_warm_resistance_get()

npmx_error_t npmx_charger_warm_resistance_get ( npmx_charger_t const * p_instance,
uint32_t * p_resistance )

Function for reading the NTC warm resistance threshold.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_resistancePointer to the resistance variable.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_warm_resistance_set()

npmx_error_t npmx_charger_warm_resistance_set ( npmx_charger_t const * p_instance,
uint32_t resistance )

Function for setting the NTC warm resistance threshold.

Note
Resistance value should be read from NTC characteristic for selected temperature.
Parameters
[in]p_instancePointer to the CHARGER instance.
[in]resistanceResistance threshold in Ohms, value should be greater than 0.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_warm_temperature_get()

npmx_error_t npmx_charger_warm_temperature_get ( npmx_charger_t const * p_instance,
int16_t * p_temperature )

Function for reading the NTC warm temperature threshold.

Parameters
[in]p_instancePointer to the CHARGER instance.
[out]p_temperaturePointer to the temperature variable in degrees Celsius.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_charger_warm_temperature_set()

npmx_error_t npmx_charger_warm_temperature_set ( npmx_charger_t const * p_instance,
int16_t temperature )

Function for setting the NTC warm temperature threshold.

Parameters
[in]p_instancePointer to the CHARGER instance.
[in]temperatureTemperature threshold in degrees Celsius. The value should be in the range between -20 and 60 degrees.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.