CHARGER

group npmx_charger

Battery charger peripheral driver.

Enums

enum npmx_charger_task_t

Charger tasks.

Values:

enumerator NPMX_CHARGER_TASK_RELEASE

SW release from charger error state.

enumerator NPMX_CHARGER_TASK_CLEAR_ERROR

Clear registers of BCHGERRREASON and BCHGERRSENSOR.

enumerator NPMX_CHARGER_TASK_CLEAR_TIMERS

Clear TRICKLE and CHARGE safety timers.

enumerator NPMX_CHARGER_TASK_COUNT

Charger tasks count.

enum npmx_charger_module_mask_t

Charger modules to be enabled and disabled.

Values:

enumerator NPMX_CHARGER_MODULE_CHARGER_MASK

Battery charger module.

enumerator NPMX_CHARGER_MODULE_FULL_COOL_MASK

Battery charger module full charge in Cool temperature.

enumerator NPMX_CHARGER_MODULE_RECHARGE_MASK

Battery charger module recharge.

enumerator NPMX_CHARGER_MODULE_NTC_LIMITS_MASK

Battery charger module NTC temperature limits.

enum npmx_charger_voltage_t

Battery charger termination voltage Normal and Warm.

Values:

enumerator NPMX_CHARGER_VOLTAGE_3V50

3.50 V

enumerator NPMX_CHARGER_VOLTAGE_3V55

3.55 V

enumerator NPMX_CHARGER_VOLTAGE_3V60

3.60 V

enumerator NPMX_CHARGER_VOLTAGE_3V65

3.65 V

enumerator NPMX_CHARGER_VOLTAGE_4V00

4.00 V

enumerator NPMX_CHARGER_VOLTAGE_4V05

4.05 V

enumerator NPMX_CHARGER_VOLTAGE_4V10

4.10 V

enumerator NPMX_CHARGER_VOLTAGE_4V15

4.15 V

enumerator NPMX_CHARGER_VOLTAGE_4V20

4.20 V

enumerator NPMX_CHARGER_VOLTAGE_4V25

4.25 V

enumerator NPMX_CHARGER_VOLTAGE_4V30

4.30 V

enumerator NPMX_CHARGER_VOLTAGE_4V35

4.35 V

enumerator NPMX_CHARGER_VOLTAGE_4V40

4.40 V

enumerator NPMX_CHARGER_VOLTAGE_4V45

4.45 V

enumerator NPMX_CHARGER_VOLTAGE_COUNT

Possible voltages count.

enumerator NPMX_CHARGER_VOLTAGE_DEFAULT

Default 3.60 V.

enumerator NPMX_CHARGER_VOLTAGE_MAX

Maximum voltage.

enumerator NPMX_CHARGER_VOLTAGE_INVALID

Invalid voltage.

enum npmx_charger_status_mask_t

Battery charger status.

Values:

enumerator NPMX_CHARGER_STATUS_BATTERY_DETECTED_MASK

Battery is connected.

enumerator NPMX_CHARGER_STATUS_COMPLETED_MASK

Charging completed (Battery Full).

enumerator NPMX_CHARGER_STATUS_TRICKLE_CHARGE_MASK

Trickle charge.

enumerator NPMX_CHARGER_STATUS_CONSTANT_CURRENT_MASK

Constant current charging.

enumerator NPMX_CHARGER_STATUS_CONSTANT_VOLTAGE_MASK

Constant voltage charging.

enumerator NPMX_CHARGER_STATUS_RECHARGE_MASK

Battery recharge is needed.

enumerator NPMX_CHARGER_STATUS_DIE_TEMP_HIGH_MASK

Charging stopped due to the high die temperature.

enumerator NPMX_CHARGER_STATUS_SUPPLEMENT_ACTIVE_MASK

Supplement mode Active.

enum npmx_charger_trickle_t

Battery charger trickle level select.

Values:

enumerator NPMX_CHARGER_TRICKLE_2V9

Trickle voltage level 2.9 V.

enumerator NPMX_CHARGER_TRICKLE_2V5

Trickle voltage level 2.5 V.

enumerator NPMX_CHARGER_TRICKLE_COUNT

Trickle voltage levels count.

enumerator NPMX_CHARGER_TRICKLE_DEFAULT

Default trickle voltage level 2.9 V.

enumerator NPMX_CHARGER_TRICKLE_MAX

Maximum trickle voltage.

enumerator NPMX_CHARGER_TRICKLE_INVALID

Invalid trickle voltage.

enum npmx_charger_iterm_t

Battery charger termination current select.

Values:

enumerator NPMX_CHARGER_ITERM_10

ITERM current set to 10 percent of charging current.

enumerator NPMX_CHARGER_ITERM_20

ITERM current set to 20 percent of charging current.

enumerator NPMX_CHARGER_ITERM_COUNT

ITERM current max count.

enumerator NPMX_CHARGER_ITERM_DEFAULT

Default ITERM current set to 10 percent of charging current.

enumerator NPMX_CHARGER_ITERM_MAX

Maximum ITERM current set to 20 percent of charging current.

enumerator NPMX_CHARGER_ITERM_INVALID

Invalid ITERM current.

enum npmx_charger_ntc_status_mask_t

NTC comparator status fields.

Values:

enumerator NPMX_CHARGER_NTC_STATUS_COLD_MASK

NTC temperature is cold.

enumerator NPMX_CHARGER_NTC_STATUS_COOL_MASK

NTC temperature is cool.

enumerator NPMX_CHARGER_NTC_STATUS_WARM_MASK

NTC temperature is warm.

enumerator NPMX_CHARGER_NTC_STATUS_HOT_MASK

NTC temperature is hot.

Functions

npmx_charger_t *npmx_charger_get(npmx_instance_t *p_pmic, uint8_t idx)

Function for returning CHARGER instance based on index.

Parameters:
  • p_pmic[in] Pointer to the PMIC instance.

  • idx[in] Index of the CHARGER instance.

Returns:

Pointer to the CHARGER instance.

npmx_charger_voltage_t npmx_charger_voltage_convert(uint32_t millivolts)

Function for converting millivolts to npmx_charger_voltage_t enumeration.

Parameters:
Returns:

Result of conversion. NPMX_CHARGER_VOLTAGE_INVALID if given voltage is not represented in 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.

Parameters:
  • enum_value[in] Voltage defined as npmx_charger_voltage_t enumeration to be converted into millivolts.

  • p_val[out] Pointer to the variable that stores the conversion result.

Return values:
  • true – Conversion is valid.

  • false – Conversion is invalid - an invalid argument was passed to the function.

npmx_charger_trickle_t npmx_charger_trickle_convert(uint32_t millivolts)

Function for converting millivolts to npmx_charger_trickle_t enumeration.

Parameters:
Returns:

Result of conversion. NPMX_CHARGER_TRICKLE_INVALID if given voltage is not represented in 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.

Parameters:
  • enum_value[in] Voltage defined as npmx_charger_trickle_t enumeration to be converted into millivolts.

  • p_val[out] Pointer to the variable that stores the conversion result.

Return values:
  • true – Conversion is valid.

  • false – Conversion is invalid - an invalid argument was passed to the function.

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:
  • percent[in] Termination 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.

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:
  • enum_value[in] Termination current defined as npmx_charger_iterm_t enumeration to be converted into a percent of charging current.

  • p_val[out] Pointer to the variable that stores the conversion result.

Return values:
  • true – Conversion is valid.

  • false – Conversion is invalid - an invalid argument was passed to the function.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • task[in] Task to be activated.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • module_mask[in] Mask of modules to be enabled, variable composed of values from npmx_charger_module_mask_t.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • module_mask[in] Mask of modules to be disabled, variable composed of values from npmx_charger_module_mask_t.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_modules_mask[out] Pointer to modules status variable composed of values from npmx_charger_module_mask_t.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • current[in] Charger current in milliamperes in a range from 32 to 800 with a step of 2.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_INVALID_PARAM – Current out of range.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_current[out] Pointer to the current variable. Charger current in milliamperes in a range from 32 to 800 with a step of 2.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • current[in] Maximum discharging current in milliamperes in a range from 270 to 1340 with a step of 2.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_INVALID_PARAM – Current out of range.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_current[out] Pointer 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_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • voltage[in] Voltage, in ranges 3.5-3.65 V or 4.0-4.45 V in 50 mV steps.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_voltage[out] Pointer to the charger voltage variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • voltage[in] Voltage, in ranges 3.5-3.65 V or 4.0-4.45 V in 50 mV steps.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_voltage[out] Pointer to the voltage variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • trickle[in] Trickle voltage value.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_trickle[out] Pointer to the trickle variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • iterm[in] Trickle charging percent value: 10% or 20%.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_iterm[out] Pointer to the iterm variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • resistance[in] Resistance threshold in Ohms, value should be greater than 0.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_resistance[out] Pointer to the resistance variable in Ohms.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • resistance[in] Resistance threshold in Ohms, value should be greater than 0.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_resistance[out] Pointer to the resistance variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • resistance[in] Resistance threshold in Ohms, value should be greater than 0.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_resistance[out] Pointer to the resistance variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • resistance[in] Resistance threshold in Ohms, value should be greater than 0.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_resistance[out] Pointer to the resistance variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • temperature[in] Temperature threshold in degrees Celsius. The value should be in the range between -20 and 60 degrees.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_temperature[out] Pointer to the temperature variable in degrees Celsius.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • temperature[in] Temperature threshold in degrees Celsius. The value should be in the range between -20 and 60 degrees.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_temperature[out] Pointer to the temperature variable in degrees Celsius.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • temperature[in] Temperature threshold in degrees Celsius. The value should be in the range between -20 and 60 degrees.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_temperature[out] Pointer to the temperature variable in degrees Celsius.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • temperature[in] Temperature threshold in degrees Celsius. The value should be in the range between -20 and 60 degrees.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_temperature[out] Pointer to the temperature variable in degrees Celsius.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • temperature[in] Temperature in *C at which die stop threshold event happens.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_temperature[out] Pointer to the temperature variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • temperature[in] Temperature in *C at which die resume threshold event happens.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_temperature[out] Pointer to the temperature variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_ntc_status[out] Pointer to the NTC comparator status mask composed of values from npmx_charger_ntc_status_mask_t.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_die_temp_status[out] Pointer to the die temperature status variable. True for high die temperature.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_current_lim_status[out] Pointer to the current charger limiter status indicator. True if limiter is active.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_status_mask[out] Pointer to the charger status mask composed of values from npmx_charger_status_mask_t.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • disable[in] True for disabling the charging when battery is warm.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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:
  • p_instance[in] Pointer to the CHARGER instance.

  • p_disable[out] Pointer to the temperature variable. True when charger disables charging if battery is warm.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

struct npmx_charger_t
#include <npmx_charger.h>

Data structure of the CHARGER driver instance.

Public Members

npmx_instance_t *p_pmic

Pointer to the PMIC instance.

uint16_t charging_current_ma

Charging current in milliamperes.

uint16_t discharging_current_ma

Discharging current in milliamperes.