ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
cc1101.cpp
Go to the documentation of this file.
1#include "cc1101.h"
2#include "cc1101pa.h"
4#include "esphome/core/log.h"
5#include <cmath>
6
7namespace esphome::cc1101 {
8
9static const char *const TAG = "cc1101";
10
11static void split_float(float value, int mbits, uint8_t &e, uint32_t &m) {
12 int e_tmp;
13 float m_tmp = std::frexp(value, &e_tmp);
14 if (e_tmp <= mbits) {
15 e = 0;
16 m = 0;
17 return;
18 }
19 e = static_cast<uint8_t>(e_tmp - mbits - 1);
20 m = static_cast<uint32_t>(((m_tmp * 2 - 1) * (1 << (mbits + 1))) + 1) >> 1;
21 if (m == (1UL << mbits)) {
22 e = e + 1;
23 m = 0;
24 }
25}
26
28 // Datasheet defaults
29 memset(&this->state_, 0, sizeof(this->state_));
30 this->state_.GDO2_CFG = 0x0D; // Serial Data (for RX on GDO2)
31 this->state_.GDO1_CFG = 0x2E;
32 this->state_.GDO0_CFG = 0x0D; // Serial Data (for RX on GDO0 / TX Input)
33 this->state_.FIFO_THR = 7;
34 this->state_.SYNC1 = 0xD3;
35 this->state_.SYNC0 = 0x91;
36 this->state_.PKTLEN = 0xFF;
37 this->state_.APPEND_STATUS = 1;
38 this->state_.LENGTH_CONFIG = 1;
39 this->state_.CRC_EN = 1;
40 this->state_.WHITE_DATA = 1;
41 this->state_.FREQ_IF = 0x0F;
42 this->state_.FREQ2 = 0x1E;
43 this->state_.FREQ1 = 0xC4;
44 this->state_.FREQ0 = 0xEC;
45 this->state_.DRATE_E = 0x0C;
46 this->state_.CHANBW_E = 0x02;
47 this->state_.DRATE_M = 0x22;
48 this->state_.SYNC_MODE = 2;
49 this->state_.CHANSPC_E = 2;
50 this->state_.NUM_PREAMBLE = 2;
51 this->state_.CHANSPC_M = 0xF8;
52 this->state_.DEVIATION_M = 7;
53 this->state_.DEVIATION_E = 4;
54 this->state_.RX_TIME = 7;
55 this->state_.CCA_MODE = 3;
56 this->state_.PO_TIMEOUT = 1;
57 this->state_.FOC_LIMIT = 2;
58 this->state_.FOC_POST_K = 1;
59 this->state_.FOC_PRE_K = 2;
60 this->state_.FOC_BS_CS_GATE = 1;
61 this->state_.BS_POST_KP = 1;
62 this->state_.BS_POST_KI = 1;
63 this->state_.BS_PRE_KP = 2;
64 this->state_.BS_PRE_KI = 1;
65 this->state_.MAGN_TARGET = 3;
66 this->state_.AGC_LNA_PRIORITY = 1;
67 this->state_.FILTER_LENGTH = 1;
68 this->state_.WAIT_TIME = 1;
69 this->state_.HYST_LEVEL = 2;
70 this->state_.WOREVT1 = 0x87;
71 this->state_.WOREVT0 = 0x6B;
72 this->state_.RC_CAL = 1;
73 this->state_.EVENT1 = 7;
74 this->state_.RC_PD = 1;
75 this->state_.MIX_CURRENT = 2;
76 this->state_.LODIV_BUF_CURRENT_RX = 1;
77 this->state_.LNA2MIX_CURRENT = 1;
78 this->state_.LNA_CURRENT = 1;
79 this->state_.LODIV_BUF_CURRENT_TX = 1;
80 this->state_.FSCAL3_LO = 9;
81 this->state_.CHP_CURR_CAL_EN = 2;
82 this->state_.FSCAL3_HI = 2;
83 this->state_.FSCAL2 = 0x0A;
84 this->state_.FSCAL1 = 0x20;
85 this->state_.FSCAL0 = 0x0D;
86 this->state_.RCCTRL1 = 0x41;
87 this->state_.FSTEST = 0x59;
88 this->state_.PTEST = 0x7F;
89 this->state_.AGCTEST = 0x3F;
90 this->state_.TEST2 = 0x88;
91 this->state_.TEST1 = 0x31;
92 this->state_.TEST0_LO = 1;
93 this->state_.VCO_SEL_CAL_EN = 1;
94 this->state_.TEST0_HI = 2;
95
96 // PKTCTRL0
97 this->state_.PKT_FORMAT = 3;
98 this->state_.LENGTH_CONFIG = 2;
99 this->state_.FS_AUTOCAL = 1;
100
101 // CRITICAL: Initialize PA Table to avoid transmitting 0 power (Silence)
102 memset(this->pa_table_, 0, sizeof(this->pa_table_));
103}
104
106
108 this->spi_setup();
109
110 if (this->gdo0_pin_ != nullptr) {
111 this->gdo0_pin_->setup();
112 }
113
114 this->configure();
115 if (this->is_failed()) {
116 return;
117 }
118
119 // Defer pin mode setup until after all components have completed setup()
120 // This handles the case where remote_transmitter runs after CC1101 and changes pin mode
121 if (this->gdo0_pin_ != nullptr) {
122 this->defer([this]() {
124 if (this->state_.PKT_FORMAT == static_cast<uint8_t>(PacketFormat::PACKET_FORMAT_FIFO)) {
126 }
127 });
128 }
129}
130
132 // Manual reset sequence per CC1101 datasheet section 19.1.2
133 this->cs_->digital_write(true);
135 this->cs_->digital_write(false);
137 this->cs_->digital_write(true);
139 this->cs_->digital_write(false);
140 delay(5);
141
142 this->strobe_(Command::RES);
143 delay(5);
144
147 this->chip_id_ = encode_uint16(this->state_.PARTNUM, this->state_.VERSION);
148 ESP_LOGD(TAG, "CC1101 found! Chip ID: 0x%04X", this->chip_id_);
149 if (this->state_.VERSION == 0 || this->state_.PARTNUM == 0xFF) {
150 ESP_LOGE(TAG, "Failed to verify CC1101.");
151 this->mark_failed();
152 return;
153 }
154
155 this->initialized_ = true;
156
157 for (uint8_t i = 0; i <= static_cast<uint8_t>(Register::TEST0); i++) {
158 if (i == static_cast<uint8_t>(Register::FSTEST) || i == static_cast<uint8_t>(Register::AGCTEST)) {
159 continue;
160 }
161 this->write_(static_cast<Register>(i));
162 }
164
165 if (!this->enter_rx_()) {
166 this->mark_failed();
167 return;
168 }
169}
170
171void CC1101Component::call_listeners_(const std::vector<uint8_t> &packet, float freq_offset, float rssi, uint8_t lqi) {
172 for (auto &listener : this->listeners_) {
173 listener->on_packet(packet, freq_offset, rssi, lqi);
174 }
175 this->packet_trigger_.trigger(packet, freq_offset, rssi, lqi);
176}
177
179 this->disable_loop();
180 if (this->state_.PKT_FORMAT != static_cast<uint8_t>(PacketFormat::PACKET_FORMAT_FIFO) || this->gdo0_pin_ == nullptr ||
181 !this->gdo0_pin_->digital_read()) {
182 return;
183 }
184
185 // Read state
187 uint8_t rx_bytes = this->state_.NUM_RXBYTES;
188 bool overflow = this->state_.RXFIFO_OVERFLOW;
189 if (overflow || rx_bytes == 0) {
190 ESP_LOGW(TAG, "RX FIFO overflow, flushing");
191 this->enter_idle_();
192 this->strobe_(Command::FRX);
193 this->enter_rx_();
194 return;
195 }
196
197 // Read packet
198 uint8_t payload_length, expected_rx;
199 if (this->state_.LENGTH_CONFIG == static_cast<uint8_t>(LengthConfig::LENGTH_CONFIG_VARIABLE)) {
200 this->read_(Register::FIFO, &payload_length, 1);
201 expected_rx = payload_length + 1;
202 } else {
203 payload_length = this->state_.PKTLEN;
204 expected_rx = payload_length;
205 }
206 if (payload_length == 0 || payload_length > 64 || rx_bytes != expected_rx) {
207 ESP_LOGW(TAG, "Invalid packet: rx_bytes %u, payload_length %u", rx_bytes, payload_length);
208 this->enter_idle_();
209 this->strobe_(Command::FRX);
210 this->enter_rx_();
211 return;
212 }
213 this->packet_.resize(payload_length);
214 this->read_(Register::FIFO, this->packet_.data(), payload_length);
215
216 // Read status from registers (more reliable than FIFO status bytes due to timing issues)
218 this->read_(Register::RSSI);
219 this->read_(Register::LQI);
220 float freq_offset = static_cast<int8_t>(this->state_.FREQEST) * (XTAL_FREQUENCY / (1 << 14));
221 float rssi = (this->state_.RSSI * RSSI_STEP) - RSSI_OFFSET;
222 bool crc_ok = (this->state_.LQI & STATUS_CRC_OK_MASK) != 0;
223 uint8_t lqi = this->state_.LQI & STATUS_LQI_MASK;
224 if (this->state_.CRC_EN == 0 || crc_ok) {
225 this->call_listeners_(this->packet_, freq_offset, rssi, lqi);
226 }
227
228 // Return to rx
229 this->enter_idle_();
230 this->strobe_(Command::FRX);
231 this->enter_rx_();
232}
233
235 static const char *const MODULATION_NAMES[] = {"2-FSK", "GFSK", "UNUSED", "ASK/OOK",
236 "4-FSK", "UNUSED", "UNUSED", "MSK"};
237 int32_t freq = static_cast<int32_t>(this->state_.FREQ2 << 16 | this->state_.FREQ1 << 8 | this->state_.FREQ0) *
238 XTAL_FREQUENCY / (1 << 16);
239 float symbol_rate = (((256.0f + this->state_.DRATE_M) * (1 << this->state_.DRATE_E)) / (1 << 28)) * XTAL_FREQUENCY;
240 float bw = XTAL_FREQUENCY / (8.0f * (4 + this->state_.CHANBW_M) * (1 << this->state_.CHANBW_E));
241 ESP_LOGCONFIG(TAG,
242 "CC1101:\n"
243 " Chip ID: 0x%04X\n"
244 " Frequency: %" PRId32 " Hz\n"
245 " Channel: %u\n"
246 " Modulation: %s\n"
247 " Symbol Rate: %.0f baud\n"
248 " Filter Bandwidth: %.1f Hz\n"
249 " Output Power: %.1f dBm",
250 this->chip_id_, freq, this->state_.CHANNR, MODULATION_NAMES[this->state_.MOD_FORMAT & 0x07],
251 symbol_rate, bw, this->output_power_effective_);
252 LOG_PIN(" CS Pin: ", this->cs_);
253}
254
256 // Ensure Packet Format is 3 (Async Serial)
257 this->write_(Register::PKTCTRL0, 0x32);
258 ESP_LOGV(TAG, "Beginning TX sequence");
259 if (this->gdo0_pin_ != nullptr) {
262 }
263 // Transition through IDLE to bypass CCA (Clear Channel Assessment) which can
264 // block TX entry when strobing from RX, and to ensure FS_AUTOCAL calibration
265 this->enter_idle_();
266 if (!this->enter_tx_()) {
267 ESP_LOGW(TAG, "Failed to enter TX state!");
268 }
269}
270
272 ESP_LOGV(TAG, "Beginning RX sequence");
273 if (this->gdo0_pin_ != nullptr) {
275 }
276 // Transition through IDLE to ensure FS_AUTOCAL calibration occurs
277 this->enter_idle_();
278 if (!this->enter_rx_()) {
279 ESP_LOGW(TAG, "Failed to enter RX state!");
280 }
281}
282
284 this->strobe_(Command::RES);
285 this->configure();
286}
287
289 ESP_LOGV(TAG, "Setting IDLE state");
290 this->enter_idle_();
291}
292
293bool CC1101Component::wait_for_state_(State target_state, uint32_t timeout_ms) {
294 uint32_t start = millis();
295 while (millis() - start < timeout_ms) {
297 State s = static_cast<State>(this->state_.MARC_STATE);
298 if (s == target_state) {
299 return true;
300 }
302 }
303 return false;
304}
305
307 // The PLL must be recalibrated until PLL lock is achieved
308 for (uint8_t retries = PLL_LOCK_RETRIES; retries > 0; retries--) {
309 this->strobe_(cmd);
310 if (!this->wait_for_state_(target_state)) {
311 return false;
312 }
313 this->read_(Register::FSCAL1);
314 if (this->state_.FSCAL1 != FSCAL1_PLL_NOT_LOCKED) {
315 return true;
316 }
317 ESP_LOGW(TAG, "PLL lock failed, retrying calibration");
318 this->enter_idle_();
319 }
320 ESP_LOGE(TAG, "PLL lock failed after retries");
321 return false;
322}
323
328
330
332
334 uint8_t index = static_cast<uint8_t>(cmd);
335 if (cmd < Command::RES || cmd > Command::NOP) {
336 return 0xFF;
337 }
338 this->enable();
339 uint8_t status_byte = this->transfer_byte(index);
340 this->disable();
341 return status_byte;
342}
343
345 uint8_t index = static_cast<uint8_t>(reg);
346 this->enable();
347 this->write_byte(index);
348 this->write_array(&this->state_.regs()[index], 1);
349 this->disable();
350}
351
352void CC1101Component::write_(Register reg, uint8_t value) {
353 uint8_t index = static_cast<uint8_t>(reg);
354 this->state_.regs()[index] = value;
355 this->write_(reg);
356}
357
358void CC1101Component::write_(Register reg, const uint8_t *buffer, size_t length) {
359 uint8_t index = static_cast<uint8_t>(reg);
360 this->enable();
361 this->write_byte(index | BUS_WRITE | BUS_BURST);
362 this->write_array(buffer, length);
363 this->disable();
364}
365
367 uint8_t index = static_cast<uint8_t>(reg);
368 this->enable();
369 this->write_byte(index | BUS_READ | BUS_BURST);
370 this->state_.regs()[index] = this->transfer_byte(0);
371 this->disable();
372}
373
374void CC1101Component::read_(Register reg, uint8_t *buffer, size_t length) {
375 uint8_t index = static_cast<uint8_t>(reg);
376 this->enable();
377 this->write_byte(index | BUS_READ | BUS_BURST);
378 this->read_array(buffer, length);
379 this->disable();
380}
381
382CC1101Error CC1101Component::transmit_packet(const std::vector<uint8_t> &packet) {
383 if (this->state_.PKT_FORMAT != static_cast<uint8_t>(PacketFormat::PACKET_FORMAT_FIFO)) {
384 return CC1101Error::PARAMS;
385 }
386
387 // Write packet
388 this->enter_idle_();
389 this->strobe_(Command::FTX);
390 if (this->state_.LENGTH_CONFIG == static_cast<uint8_t>(LengthConfig::LENGTH_CONFIG_VARIABLE)) {
391 this->write_(Register::FIFO, static_cast<uint8_t>(packet.size()));
392 }
393 this->write_(Register::FIFO, packet.data(), packet.size());
394
395 // Calibrate PLL
397 ESP_LOGW(TAG, "PLL lock failed during TX");
398 this->enter_idle_();
399 this->enter_rx_();
401 }
402
403 // Transmit packet
404 this->strobe_(Command::TX);
405 if (!this->wait_for_state_(State::IDLE, 1000)) {
406 ESP_LOGW(TAG, "TX timeout");
407 this->enter_idle_();
408 this->enter_rx_();
410 }
411
412 // Return to rx
413 this->enter_rx_();
414 return CC1101Error::NONE;
415}
416
417// Setters
419 this->output_power_requested_ = value;
420 int32_t freq = static_cast<int32_t>(this->state_.FREQ2 << 16 | this->state_.FREQ1 << 8 | this->state_.FREQ0) *
421 XTAL_FREQUENCY / (1 << 16);
422 uint8_t a = 0xC0;
423 if (freq >= 300000000 && freq <= 348000000) {
424 a = PowerTableItem::find(PA_TABLE_315, sizeof(PA_TABLE_315) / sizeof(PA_TABLE_315[0]), value);
425 } else if (freq >= 378000000 && freq <= 464000000) {
426 a = PowerTableItem::find(PA_TABLE_433, sizeof(PA_TABLE_433) / sizeof(PA_TABLE_433[0]), value);
427 } else if (freq >= 779000000 && freq < 900000000) {
428 a = PowerTableItem::find(PA_TABLE_868, sizeof(PA_TABLE_868) / sizeof(PA_TABLE_868[0]), value);
429 } else if (freq >= 900000000 && freq <= 928000000) {
430 a = PowerTableItem::find(PA_TABLE_915, sizeof(PA_TABLE_915) / sizeof(PA_TABLE_915[0]), value);
431 }
432
433 if (static_cast<Modulation>(this->state_.MOD_FORMAT) == Modulation::MODULATION_ASK_OOK) {
434 this->pa_table_[0] = 0;
435 this->pa_table_[1] = a;
436 } else {
437 this->pa_table_[0] = a;
438 this->pa_table_[1] = 0;
439 }
440 this->output_power_effective_ = value;
441 if (this->initialized_) {
442 this->write_(Register::PATABLE, this->pa_table_, sizeof(this->pa_table_));
443 }
444}
445
447 this->state_.CLOSE_IN_RX = static_cast<uint8_t>(value);
448 if (this->initialized_) {
450 }
451}
452
454 this->state_.DEM_DCFILT_OFF = value ? 0 : 1;
455 if (this->initialized_) {
457 }
458}
459
461 int32_t freq = static_cast<int32_t>(value * (1 << 16) / XTAL_FREQUENCY);
462 this->state_.FREQ2 = static_cast<uint8_t>(freq >> 16);
463 this->state_.FREQ1 = static_cast<uint8_t>(freq >> 8);
464 this->state_.FREQ0 = static_cast<uint8_t>(freq);
465 if (this->initialized_) {
466 this->enter_idle_();
467 this->write_(Register::FREQ2);
468 this->write_(Register::FREQ1);
469 this->write_(Register::FREQ0);
470 this->enter_rx_();
471 }
472}
473
475 this->state_.FREQ_IF = value * (1 << 10) / XTAL_FREQUENCY;
476 if (this->initialized_) {
478 }
479}
480
482 uint8_t e;
483 uint32_t m;
484 split_float(XTAL_FREQUENCY / (value * 8), 2, e, m);
485 this->state_.CHANBW_E = e;
486 this->state_.CHANBW_M = static_cast<uint8_t>(m);
487 if (this->initialized_) {
489 }
490}
491
492void CC1101Component::set_channel(uint8_t value) {
493 this->state_.CHANNR = value;
494 if (this->initialized_) {
495 this->enter_idle_();
497 this->enter_rx_();
498 }
499}
500
502 uint8_t e;
503 uint32_t m;
504 split_float(value * (1 << 18) / XTAL_FREQUENCY, 8, e, m);
505 this->state_.CHANSPC_E = e;
506 this->state_.CHANSPC_M = static_cast<uint8_t>(m);
507 if (this->initialized_) {
510 }
511}
512
514 uint8_t e;
515 uint32_t m;
516 split_float(value * (1 << 17) / XTAL_FREQUENCY, 3, e, m);
517 this->state_.DEVIATION_E = e;
518 this->state_.DEVIATION_M = static_cast<uint8_t>(m);
519 if (this->initialized_) {
521 }
522}
523
525 this->state_.DEVIATION_E = 0;
526 this->state_.DEVIATION_M = value - 1;
527 if (this->initialized_) {
529 }
530}
531
533 uint8_t e;
534 uint32_t m;
535 split_float(value * (1 << 28) / XTAL_FREQUENCY, 8, e, m);
536 this->state_.DRATE_E = e;
537 this->state_.DRATE_M = static_cast<uint8_t>(m);
538 if (this->initialized_) {
541 }
542}
543
545 this->state_.SYNC_MODE = static_cast<uint8_t>(value);
546 if (this->initialized_) {
548 }
549}
550
552 this->state_.CARRIER_SENSE_ABOVE_THRESHOLD = value ? 1 : 0;
553 if (this->initialized_) {
555 }
556}
557
559 this->state_.MOD_FORMAT = static_cast<uint8_t>(value);
560 this->state_.PA_POWER = value == Modulation::MODULATION_ASK_OOK ? 1 : 0;
561 if (this->initialized_) {
562 this->enter_idle_();
566 this->enter_rx_();
567 }
568}
569
571 this->state_.MANCHESTER_EN = value ? 1 : 0;
572 if (this->initialized_) {
574 }
575}
576
578 this->state_.NUM_PREAMBLE = value;
579 if (this->initialized_) {
581 }
582}
583
584void CC1101Component::set_sync1(uint8_t value) {
585 this->state_.SYNC1 = value;
586 if (this->initialized_) {
587 this->write_(Register::SYNC1);
588 }
589}
590
591void CC1101Component::set_sync0(uint8_t value) {
592 this->state_.SYNC0 = value;
593 if (this->initialized_) {
594 this->write_(Register::SYNC0);
595 }
596}
597
599 this->state_.MAGN_TARGET = static_cast<uint8_t>(value);
600 if (this->initialized_) {
602 }
603}
604
606 this->state_.MAX_LNA_GAIN = static_cast<uint8_t>(value);
607 if (this->initialized_) {
609 }
610}
611
613 this->state_.MAX_DVGA_GAIN = static_cast<uint8_t>(value);
614 if (this->initialized_) {
616 }
617}
618
620 this->state_.CARRIER_SENSE_ABS_THR = static_cast<uint8_t>(value & 0b1111);
621 if (this->initialized_) {
623 }
624}
625
627 this->state_.CARRIER_SENSE_REL_THR = static_cast<uint8_t>(value);
628 if (this->initialized_) {
630 }
631}
632
634 this->state_.AGC_LNA_PRIORITY = value ? 1 : 0;
635 if (this->initialized_) {
637 }
638}
639
641 this->state_.FILTER_LENGTH = static_cast<uint8_t>(value);
642 if (this->initialized_) {
644 }
645}
646
648 this->state_.FILTER_LENGTH = static_cast<uint8_t>(value);
649 if (this->initialized_) {
651 }
652}
653
655 this->state_.AGC_FREEZE = static_cast<uint8_t>(value);
656 if (this->initialized_) {
658 }
659}
660
662 this->state_.WAIT_TIME = static_cast<uint8_t>(value);
663 if (this->initialized_) {
665 }
666}
667
669 this->state_.HYST_LEVEL = static_cast<uint8_t>(value);
670 if (this->initialized_) {
672 }
673}
674
676 this->state_.PKT_FORMAT =
678 if (value) {
679 // Configure GDO0 for FIFO status (asserts on RX FIFO threshold or end of packet)
680 this->state_.GDO0_CFG = 0x01;
681 // Set max RX FIFO threshold to ensure we only trigger on end-of-packet
682 this->state_.FIFO_THR = 15;
683 // Don't append status bytes to FIFO - we read from registers instead
684 this->state_.APPEND_STATUS = 0;
685 } else {
686 // Configure GDO0 for serial data (async serial mode)
687 this->state_.GDO0_CFG = 0x0D;
688 }
689 if (this->initialized_) {
690 if (this->gdo0_pin_ != nullptr) {
691 if (value) {
693 } else {
695 }
696 }
701 }
702}
703
705 if (value == 0) {
706 this->state_.LENGTH_CONFIG = static_cast<uint8_t>(LengthConfig::LENGTH_CONFIG_VARIABLE);
707 } else {
708 this->state_.LENGTH_CONFIG = static_cast<uint8_t>(LengthConfig::LENGTH_CONFIG_FIXED);
709 this->state_.PKTLEN = value;
710 }
711 if (this->initialized_) {
714 }
715}
716
718 this->state_.CRC_EN = value ? 1 : 0;
719 if (this->initialized_) {
721 }
722}
723
725 this->state_.WHITE_DATA = value ? 1 : 0;
726 if (this->initialized_) {
728 }
729}
730
731} // namespace esphome::cc1101
uint8_t m
Definition bl0906.h:1
void mark_failed()
Mark this component as failed.
ESPDEPRECATED("Use const char* overload instead. Removed in 2026.7.0", "2026.1.0") void defer(const std voi defer)(const char *name, std::function< void()> &&f)
Defer a callback to the next loop() call.
Definition component.h:560
bool is_failed() const
Definition component.h:284
void enable_loop_soon_any_context()
Thread and ISR-safe version of enable_loop() that can be called from any context.
void disable_loop()
Disable this component's loop.
virtual void pin_mode(gpio::Flags flags)=0
virtual void setup()=0
virtual void digital_write(bool value)=0
virtual void detach_interrupt() const =0
void attach_interrupt(void(*func)(T *), T *arg, gpio::InterruptType type) const
Definition gpio.h:107
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Inform the parent automation that the event has triggered.
Definition automation.h:482
void set_packet_mode(bool value)
Definition cc1101.cpp:675
void set_max_dvga_gain(MaxDvgaGain value)
Definition cc1101.cpp:612
void set_whitening(bool value)
Definition cc1101.cpp:724
void set_carrier_sense_above_threshold(bool value)
Definition cc1101.cpp:551
void write_(Register reg)
Definition cc1101.cpp:344
void set_sync0(uint8_t value)
Definition cc1101.cpp:591
void set_freeze(Freeze value)
Definition cc1101.cpp:654
void call_listeners_(const std::vector< uint8_t > &packet, float freq_offset, float rssi, uint8_t lqi)
Definition cc1101.cpp:171
void set_rx_attenuation(RxAttenuation value)
Definition cc1101.cpp:446
InternalGPIOPin * gdo0_pin_
Definition cc1101.h:96
void set_symbol_rate(float value)
Definition cc1101.cpp:532
uint8_t strobe_(Command cmd)
Definition cc1101.cpp:333
void set_sync_mode(SyncMode value)
Definition cc1101.cpp:544
void set_fsk_deviation(float value)
Definition cc1101.cpp:513
void set_msk_deviation(uint8_t value)
Definition cc1101.cpp:524
void set_carrier_sense_rel_thr(CarrierSenseRelThr value)
Definition cc1101.cpp:626
uint8_t pa_table_[PA_TABLE_SIZE]
Definition cc1101.h:91
void set_lna_priority(bool value)
Definition cc1101.cpp:633
void set_output_power(float value)
Definition cc1101.cpp:418
void set_modulation_type(Modulation value)
Definition cc1101.cpp:558
void set_if_frequency(float value)
Definition cc1101.cpp:474
void set_frequency(float value)
Definition cc1101.cpp:460
void set_num_preamble(uint8_t value)
Definition cc1101.cpp:577
void set_hyst_level(HystLevel value)
Definition cc1101.cpp:668
void set_filter_bandwidth(float value)
Definition cc1101.cpp:481
void set_filter_length_fsk_msk(FilterLengthFskMsk value)
Definition cc1101.cpp:640
void set_crc_enable(bool value)
Definition cc1101.cpp:717
static void IRAM_ATTR gpio_intr(CC1101Component *arg)
Definition cc1101.cpp:105
void set_carrier_sense_abs_thr(int8_t value)
Definition cc1101.cpp:619
bool enter_calibrated_(State target_state, Command cmd)
Definition cc1101.cpp:306
void set_magn_target(MagnTarget value)
Definition cc1101.cpp:598
void set_channel_spacing(float value)
Definition cc1101.cpp:501
CC1101Error transmit_packet(const std::vector< uint8_t > &packet)
Definition cc1101.cpp:382
void set_wait_time(WaitTime value)
Definition cc1101.cpp:661
std::vector< CC1101Listener * > listeners_
Definition cc1101.h:103
void set_dc_blocking_filter(bool value)
Definition cc1101.cpp:453
void set_packet_length(uint8_t value)
Definition cc1101.cpp:704
void set_manchester(bool value)
Definition cc1101.cpp:570
std::vector< uint8_t > packet_
Definition cc1101.h:102
void set_channel(uint8_t value)
Definition cc1101.cpp:492
void set_filter_length_ask_ook(FilterLengthAskOok value)
Definition cc1101.cpp:647
void set_max_lna_gain(MaxLnaGain value)
Definition cc1101.cpp:605
void set_sync1(uint8_t value)
Definition cc1101.cpp:584
bool wait_for_state_(State target_state, uint32_t timeout_ms=100)
Definition cc1101.cpp:293
Trigger< std::vector< uint8_t >, float, float, uint8_t > packet_trigger_
Definition cc1101.h:101
@ INTERRUPT_RISING_EDGE
Definition gpio.h:50
@ FLAG_OUTPUT
Definition gpio.h:28
@ FLAG_INPUT
Definition gpio.h:27
void IRAM_ATTR HOT delayMicroseconds(uint32_t us)
Definition hal.cpp:48
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb)
Encode a 16-bit value given the most and least significant byte.
Definition helpers.h:859
void HOT delay(uint32_t ms)
Definition hal.cpp:85
uint32_t IRAM_ATTR HOT millis()
Definition hal.cpp:28
static void uint32_t
static uint8_t find(const PowerTableItem *items, size_t count, float &dbm_target)
Definition cc1101pa.h:15
uint16_t length
Definition tt21100.cpp:0