10 public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
11 spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_200KHZ> {
15 SUB_SENSOR(reactive_power)
16 SUB_SENSOR(forward_active_energy)
17 SUB_SENSOR(reverse_active_energy)
18 SUB_SENSOR(power_factor)
22 void setup()
override;
23 void dump_config()
override;
24 void update()
override;
26 void set_line_freq(
int freq) {
line_freq_ = freq; }
36 uint16_t
read16_(uint8_t a_register);
37 int read32_(uint8_t addr_h, uint8_t addr_l);
virtual void setup()
Where the component's initialization should happen.
This class simplifies creating components that periodically check a state.
float get_forward_active_energy_()
float get_reactive_power_()
float get_power_factor_()
uint32_t cumulative_forward_active_energy_
uint16_t read16_(uint8_t a_register)
void write16_(uint8_t a_register, uint16_t val)
uint32_t cumulative_reverse_active_energy_
float get_line_voltage_()
float get_active_power_()
float get_chip_temperature_()
int read32_(uint8_t addr_h, uint8_t addr_l)
float get_reverse_active_energy_()
float get_line_current_()
The SPIDevice is what components using the SPI will create.