6 const uint8_t
GAIN5C_TABLE[] = {0x08, 0x18, 0x28, 0x38, 0x48, 0x58, 0x68, 0x78, 0x88, 0x98, 0xa8, 0xb8, 0xc8};
7 const uint8_t
GAIN63_TABLE[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
11 const uint8_t
POWER_TABLE[] = {48, 56, 63, 70, 77, 91, 105, 115, 40, 44, 47, 51, 54, 61, 68, 78};
12 const uint8_t
POWER67_TABLE[] = {0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7};
13 const uint8_t
POWER68_TABLE[] = {0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8,
14 24, 24, 24, 24, 24, 24, 24, 24};
18 const uint16_t
FREQ_TABLE[] = {5696, 5715, 5730, 5748, 5765, 5784, 5800, 5819, 5836, 5851, 5869, 5888};
19 const uint8_t
FREQ5F_TABLE[] = {0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x40, 0x41, 0x42, 0x43};
20 const uint8_t
FREQ60_TABLE[] = {0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9e, 0x9e, 0x9e, 0x9e};
55 static const char *
const TAG =
"at581x";
63 this->
i2c_write_reg(addr + 2, uint8_t((data >> 16) & 0xFF)) &&
76 #define ARRAY_SIZE(X) (sizeof(X) / sizeof((X)[0])) 78 ESP_LOGCONFIG(TAG,
"Writing new config for AT581X...");
79 ESP_LOGCONFIG(TAG,
"Frequency: %dMHz", this->
freq_);
80 ESP_LOGCONFIG(TAG,
"Sensing distance: %d", this->
delta_);
81 ESP_LOGCONFIG(TAG,
"Power: %dµA", this->
power_);
82 ESP_LOGCONFIG(TAG,
"Gain: %d", this->
gain_);
90 ESP_LOGE(TAG,
"Failed to write AT581X Freq mode");
94 for (
size_t i = 0; i < ARRAY_SIZE(
FREQ_TABLE) + 1; i++) {
96 ESP_LOGE(TAG,
"Set frequency not found");
101 ESP_LOGE(TAG,
"Failed to write AT581X Freq value");
111 ESP_LOGE(TAG,
"Failed to write AT581X sensing distance low");
117 for (
size_t i = 0; i < ARRAY_SIZE(
POWER_TABLE) + 1; i++) {
119 ESP_LOGE(TAG,
"Set power not found");
130 ESP_LOGE(TAG,
"Failed to write AT581X power registers");
137 ESP_LOGE(TAG,
"Failed to write AT581X gain registers");
143 ESP_LOGE(TAG,
"Failed to write AT581X trigger base time registers");
147 ESP_LOGE(TAG,
"Failed to write AT581X trigger keep time registers");
152 ESP_LOGE(TAG,
"Failed to write AT581X protect time registers");
156 ESP_LOGE(TAG,
"Failed to write AT581X self check time registers");
161 ESP_LOGE(TAG,
"Failed to enable AT581X time registers");
167 ESP_LOGE(TAG,
"Failed to enable AT581X");
178 ESP_LOGE(TAG,
"Failed to reset AT581X hardware frontend");
186 for (
size_t i = 0; i < ARRAY_SIZE(
RF_REG_ADDR); i++) {
188 ESP_LOGE(TAG,
"Failed to write AT581X RF mode");
bool i2c_read_reg(uint8_t addr, uint8_t &data)
void dump_config() override
const uint8_t RF_OFF_TABLE[]
ErrorCode read_register(uint8_t a_register, uint8_t *data, size_t len, bool stop=true)
reads an array of bytes from a specific register in the I²C device
bool i2c_write_reg(uint8_t addr, uint8_t data)
const uint8_t HIGH_LEVEL_DELAY_VALUE_ADDR
void set_rf_mode(bool enabled)
const uint8_t POWER67_TABLE[]
const uint8_t GAIN_ADDR_TABLE[]
const uint8_t RF_REG_ADDR[]
const uint8_t GAIN61_VALUE
const uint8_t GAIN63_TABLE[]
const uint8_t SIGNAL_DETECTION_THRESHOLD_ADDR_HI
const uint8_t PWR_THRESH_VAL_EN
const uint8_t PWR_WORK_TIME_EN
No error found during execution of method.
const uint8_t POWER_THRESHOLD_ADDR_HI
const uint8_t FREQ60_TABLE[]
const uint8_t POWER68_TABLE[]
const uint8_t PWR_BURST_TIME_EN
const uint8_t GAIN5C_TABLE[]
const uint8_t TRIGGER_KEEP_TIME_ADDR
const uint8_t PWR_THRESH_EN
const uint8_t SIGNAL_DETECTION_THRESHOLD_ADDR_LO
int trigger_keep_time_ms_
const uint16_t FREQ_TABLE[]
const uint8_t HIGH_LEVEL_DELAY_CONTROL_ADDR
int trigger_base_time_ms_
const uint8_t TRIGGER_BASE_TIME_ADDR
const uint8_t TIME41_VALUE
const uint8_t SELF_CHECK_TIME_ADDR
bool reset_hardware_frontend()
const uint8_t RF_ON_TABLE[]
Implementation of SPI Controller mode.
ErrorCode write_register(uint8_t a_register, const uint8_t *data, size_t len, bool stop=true)
writes an array of bytes to a specific register in the I²C device
const uint8_t FREQ5F_TABLE[]
const uint8_t POWER_TABLE[]
const uint8_t POWER_THRESHOLD_ADDR_LO
const uint8_t PROTECT_TIME_ADDR