10static const uint8_t SY6970_REG_INPUT_CURRENT_LIMIT = 0x00;
11static const uint8_t SY6970_REG_VINDPM = 0x01;
12static const uint8_t SY6970_REG_ADC_CONTROL = 0x02;
13static const uint8_t SY6970_REG_SYS_CONTROL = 0x03;
14static const uint8_t SY6970_REG_CHARGE_CURRENT = 0x04;
15static const uint8_t SY6970_REG_PRECHARGE_CURRENT = 0x05;
16static const uint8_t SY6970_REG_CHARGE_VOLTAGE = 0x06;
17static const uint8_t SY6970_REG_TIMER_CONTROL = 0x07;
18static const uint8_t SY6970_REG_IR_COMP = 0x08;
19static const uint8_t SY6970_REG_FORCE_DPDM = 0x09;
20static const uint8_t SY6970_REG_BOOST_CONTROL = 0x0A;
21static const uint8_t SY6970_REG_STATUS = 0x0B;
22static const uint8_t SY6970_REG_FAULT = 0x0C;
23static const uint8_t SY6970_REG_VINDPM_STATUS = 0x0D;
24static const uint8_t SY6970_REG_BATV = 0x0E;
25static const uint8_t SY6970_REG_VBUS_VOLTAGE = 0x11;
26static const uint8_t SY6970_REG_CHARGE_CURRENT_MONITOR = 0x12;
27static const uint8_t SY6970_REG_INPUT_VOLTAGE_LIMIT = 0x13;
28static const uint8_t SY6970_REG_DEVICE_ID = 0x14;
31static const uint16_t VBUS_BASE_MV = 2600;
32static const uint16_t VBUS_STEP_MV = 100;
33static const uint16_t VBAT_BASE_MV = 2304;
34static const uint16_t VBAT_STEP_MV = 20;
35static const uint16_t VSYS_BASE_MV = 2304;
36static const uint16_t VSYS_STEP_MV = 20;
37static const uint16_t CHG_CURRENT_STEP_MA = 50;
38static const uint16_t PRE_CHG_BASE_MA = 64;
39static const uint16_t PRE_CHG_STEP_MA = 64;
40static const uint16_t CHG_VOLTAGE_BASE = 3840;
41static const uint16_t CHG_VOLTAGE_STEP = 16;
42static const uint16_t INPUT_CURRENT_MIN = 100;
43static const uint16_t INPUT_CURRENT_STEP = 50;
78 SY6970Component(
bool led_enabled, uint16_t input_current_limit, uint16_t charge_voltage, uint16_t charge_current,
79 uint16_t precharge_current,
bool charge_enabled,
bool enable_adc)
87 void setup()
override;
This class simplifies creating components that periodically check a state.
This Class provides the methods to read/write bytes from/to an i2c device.
I2CRegister reg(uint8_t a_register)
calls the I2CRegister constructor
void set_charge_target_voltage(uint16_t millivolts)
void set_enable_adc_measure(bool enabled=true)
void set_input_current_limit(uint16_t milliamps)
void set_charge_enabled(bool enabled)
uint16_t input_current_limit_
void set_precharge_current(uint16_t milliamps)
bool write_register_(uint8_t reg, uint8_t value)
uint16_t precharge_current_
void add_listener(SY6970Listener *listener)
void set_led_enabled(bool enabled)
void set_charge_current(uint16_t milliamps)
bool read_all_registers_()
std::vector< SY6970Listener * > listeners_
bool update_register_(uint8_t reg, uint8_t mask, uint8_t value)
void dump_config() override
SY6970Component(bool led_enabled, uint16_t input_current_limit, uint16_t charge_voltage, uint16_t charge_current, uint16_t precharge_current, bool charge_enabled, bool enable_adc)
virtual void on_data(const SY6970Data &data)=0
@ CHARGE_STATUS_CHARGE_DONE
@ CHARGE_STATUS_PRE_CHARGE
@ CHARGE_STATUS_NOT_CHARGING
@ CHARGE_STATUS_FAST_CHARGE
@ BUS_STATUS_NO_STD_ADAPTER