ESPHome 2026.12.0-dev
Loading...
Searching...
No Matches
esphome::npm1300 Namespace Reference

Data Structures

struct  NPM1300ChargerConfig
 Register codes for the battery charger. More...
 
class  NPM1300Component
 
struct  NPM1300Config
 The settings applied in setup(), built by code generation into a PROGMEM table. More...
 
struct  NPM1300OutputConfig
 Register codes for one regulator, NPM1300_UNSET where the YAML leaves the field out. More...
 
struct  NPM1300Status
 The status registers read on every update. More...
 

Enumerations

enum class  NPM1300Output : uint8_t { NPM1300_OUTPUT_BUCK1 = 0 , NPM1300_OUTPUT_BUCK2 = 1 , NPM1300_OUTPUT_LDO1 = 2 , NPM1300_OUTPUT_LDO2 = 3 }
 The regulators, in the order of their enable task registers. More...
 

Functions

 ESPHOME_LOG_TAG (TAG, "npm1300")
 
float ntc_temperature (uint16_t code, float inv_beta)
 Battery temperature in degrees Celsius from the NTC code and 1 / B constant of the thermistor.
 
 PROGMEM_STRING_TABLE (ChargerStatusStrings, "Discharging", "Error", "Disabled", "Paused, PMIC Too Hot", "Charge Complete", "Trickle Charge", "Constant Current", "Constant Voltage", "Paused, Battery Too Cold", "Paused, Battery Too Hot", "Not Charging")
 
void publish_charger_status (text_sensor::TextSensor *sensor, uint8_t &last, const NPM1300Status &status)
 Publish the charger status text, only when it differs from last
 
 PROGMEM_STRING_TABLE (OutputNameStrings, "BUCK1", "BUCK2", "LDO1", "LDO2")
 
uint16_t adc_code (const uint8_t *adc, uint8_t msb, uint8_t lsbs, uint8_t shift)
 The 10-bit ADC result whose high 8 bits are adc[msb] and low 2 bits are at shift in adc[lsbs].
 

Enumeration Type Documentation

◆ NPM1300Output

enum class esphome::npm1300::NPM1300Output : uint8_t
strong

The regulators, in the order of their enable task registers.

Enumerator
NPM1300_OUTPUT_BUCK1 
NPM1300_OUTPUT_BUCK2 
NPM1300_OUTPUT_LDO1 
NPM1300_OUTPUT_LDO2 

Definition at line 22 of file npm1300.h.

Function Documentation

◆ adc_code()

uint16_t esphome::npm1300::adc_code ( const uint8_t * adc,
uint8_t msb,
uint8_t lsbs,
uint8_t shift )
inline

The 10-bit ADC result whose high 8 bits are adc[msb] and low 2 bits are at shift in adc[lsbs].

Definition at line 72 of file npm1300.h.

◆ ESPHOME_LOG_TAG()

esphome::npm1300::ESPHOME_LOG_TAG ( TAG ,
"npm1300"  )

◆ ntc_temperature()

float esphome::npm1300::ntc_temperature ( uint16_t code,
float inv_beta )

Battery temperature in degrees Celsius from the NTC code and 1 / B constant of the thermistor.

Definition at line 103 of file npm1300.cpp.

◆ PROGMEM_STRING_TABLE() [1/2]

esphome::npm1300::PROGMEM_STRING_TABLE ( ChargerStatusStrings ,
"Discharging" ,
"Error" ,
"Disabled" ,
" Paused,
PMIC Too Hot" ,
"Charge Complete" ,
"Trickle Charge" ,
"Constant Current" ,
"Constant Voltage" ,
" Paused,
Battery Too Cold" ,
" Paused,
Battery Too Hot" ,
"Not Charging"  )

◆ PROGMEM_STRING_TABLE() [2/2]

esphome::npm1300::PROGMEM_STRING_TABLE ( OutputNameStrings ,
"BUCK1" ,
"BUCK2" ,
"LDO1" ,
"LDO2"  )

◆ publish_charger_status()

void esphome::npm1300::publish_charger_status ( text_sensor::TextSensor * sensor,
uint8_t & last,
const NPM1300Status & status )

Publish the charger status text, only when it differs from last

Definition at line 140 of file npm1300.cpp.