ESPHome 2025.5.0
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 {
14namespace at581x {
15
17 public:
18#ifdef USE_SWITCH
20 this->rf_power_switch_ = s;
21 s->turn_on();
22 }
23#endif
24
25 void setup() override;
26 void dump_config() override;
27 // float get_setup_priority() const override;
28
29 void set_sensing_distance(int distance) { this->delta_ = 1023 - distance; }
30
31 void set_rf_mode(bool enabled);
32 void set_frequency(int frequency) { this->freq_ = frequency; }
33 void set_poweron_selfcheck_time(int value) { this->self_check_time_ms_ = value; }
34 void set_protect_time(int value) { this->protect_time_ms_ = value; }
35 void set_trigger_base(int value) { this->trigger_base_time_ms_ = value; }
36 void set_trigger_keep(int value) { this->trigger_keep_time_ms_ = value; }
37 void set_stage_gain(int value) { this->gain_ = value; }
38 void set_power_consumption(int value) { this->power_ = value; }
39
40 bool i2c_write_config();
42 bool i2c_write_reg(uint8_t addr, uint8_t data);
43 bool i2c_write_reg(uint8_t addr, uint32_t data);
44 bool i2c_write_reg(uint8_t addr, uint16_t data);
45 bool i2c_read_reg(uint8_t addr, uint8_t &data);
46
47 protected:
48#ifdef USE_SWITCH
50#endif
51 int freq_;
56 int delta_;
57 int gain_;
58 int power_;
59};
60
61} // namespace at581x
62} // namespace esphome
uint16_le_t frequency
Definition bl0942.h:6
bool i2c_read_reg(uint8_t addr, uint8_t &data)
Definition at581x.cpp:70
switch_::Switch * rf_power_switch_
Definition at581x.h:49
void set_rf_mode(bool enabled)
Definition at581x.cpp:184
void set_power_consumption(int value)
Definition at581x.h:38
void set_stage_gain(int value)
Definition at581x.h:37
void set_protect_time(int value)
Definition at581x.h:34
void set_frequency(int frequency)
Definition at581x.h:32
void set_trigger_keep(int value)
Definition at581x.h:36
void set_poweron_selfcheck_time(int value)
Definition at581x.h:33
void set_sensing_distance(int distance)
Definition at581x.h:29
void set_trigger_base(int value)
Definition at581x.h:35
bool i2c_write_reg(uint8_t addr, uint8_t data)
Definition at581x.cpp:57
void set_rf_power_switch(switch_::Switch *s)
Definition at581x.h:19
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:133
Base class for all switches.
Definition switch.h:39
void turn_on()
Turn this switch on.
Definition switch.cpp:11
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7