ESPHome 2026.5.0b1
Loading...
Searching...
No Matches
at581x.h
Go to the documentation of this file.
1#pragma once
2
3#include <utility>
4
6#include "esphome/core/hal.h"
8#ifdef USE_SWITCH
10#endif
12
13namespace esphome::at581x {
14
16 public:
17#ifdef USE_SWITCH
19 this->rf_power_switch_ = s;
20 s->turn_on();
21 }
22#endif
23
24 void setup() override;
25 void dump_config() override;
26 // float get_setup_priority() const override;
27
28 void set_sensing_distance(int distance) { this->delta_ = 1023 - distance; }
29
30 void set_rf_mode(bool enabled);
31 void set_frequency(int frequency) { this->freq_ = frequency; }
32 void set_poweron_selfcheck_time(int value) { this->self_check_time_ms_ = value; }
33 void set_protect_time(int value) { this->protect_time_ms_ = value; }
34 void set_trigger_base(int value) { this->trigger_base_time_ms_ = value; }
35 void set_trigger_keep(int value) { this->trigger_keep_time_ms_ = value; }
36 void set_stage_gain(int value) { this->gain_ = value; }
37 void set_power_consumption(int value) { this->power_ = value; }
38
39 bool i2c_write_config();
41 bool i2c_write_reg(uint8_t addr, uint8_t data);
42 bool i2c_write_reg(uint8_t addr, uint32_t data);
43 bool i2c_write_reg(uint8_t addr, uint16_t data);
44 bool i2c_read_reg(uint8_t addr, uint8_t &data);
45
46 protected:
47#ifdef USE_SWITCH
49#endif
50 int freq_;
55 int delta_;
56 int gain_;
57 int power_;
58};
59
60} // namespace esphome::at581x
uint16_le_t frequency
Definition bl0942.h:6
bool i2c_read_reg(uint8_t addr, uint8_t &data)
Definition at581x.cpp:69
switch_::Switch * rf_power_switch_
Definition at581x.h:48
void set_rf_mode(bool enabled)
Definition at581x.cpp:191
void set_power_consumption(int value)
Definition at581x.h:37
void set_stage_gain(int value)
Definition at581x.h:36
void set_protect_time(int value)
Definition at581x.h:33
void set_frequency(int frequency)
Definition at581x.h:31
void set_trigger_keep(int value)
Definition at581x.h:35
void set_poweron_selfcheck_time(int value)
Definition at581x.h:32
void set_sensing_distance(int distance)
Definition at581x.h:28
void set_trigger_base(int value)
Definition at581x.h:34
bool i2c_write_reg(uint8_t addr, uint8_t data)
Definition at581x.cpp:56
void set_rf_power_switch(switch_::Switch *s)
Definition at581x.h:18
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
Base class for all switches.
Definition switch.h:38
void turn_on()
Turn this switch on.
Definition switch.cpp:20
static void uint32_t