ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
sx126x.cpp
Go to the documentation of this file.
1#include "sx126x.h"
2#include "esphome/core/hal.h"
3#include "esphome/core/log.h"
4
5namespace esphome::sx126x {
6
7static const char *const TAG = "sx126x";
8static const uint16_t RAMP[8] = {10, 20, 40, 80, 200, 800, 1700, 3400};
9static const uint32_t BW_HZ[31] = {4800, 5800, 7300, 9700, 11700, 14600, 19500, 23400, 29300, 39000, 46900,
10 58600, 78200, 93800, 117300, 156200, 187200, 234300, 312000, 373600, 467000, 7810,
11 10420, 15630, 20830, 31250, 41670, 62500, 125000, 250000, 500000};
12static const uint8_t BW_LORA[10] = {LORA_BW_7810, LORA_BW_10420, LORA_BW_15630, LORA_BW_20830, LORA_BW_31250,
14static const uint8_t BW_FSK[21] = {
18
19static constexpr uint32_t RESET_DELAY_HIGH_US = 5000;
20static constexpr uint32_t RESET_DELAY_LOW_US = 2000;
21static constexpr uint32_t SWITCHING_DELAY_US = 1;
22static constexpr uint32_t TRANSMIT_TIMEOUT_MS = 4000;
23static constexpr uint32_t BUSY_TIMEOUT_MS = 20;
24
25// OCP (Over Current Protection) values
26static constexpr uint8_t OCP_80MA = 0x18; // 80 mA max current
27static constexpr uint8_t OCP_140MA = 0x38; // 140 mA max current
28
29// LoRa low data rate optimization threshold
30static constexpr float LOW_DATA_RATE_OPTIMIZE_THRESHOLD = 16.38f; // 16.38 ms
31
32uint8_t SX126x::read_fifo_(uint8_t offset, std::vector<uint8_t> &packet) {
33 this->enable();
34 this->wait_busy_();
36 this->transfer_byte(offset);
37 uint8_t status = this->transfer_byte(0x00);
38 for (uint8_t &byte : packet) {
39 byte = this->transfer_byte(0x00);
40 }
41 this->disable();
42 return status;
43}
44
45void SX126x::write_fifo_(uint8_t offset, const std::vector<uint8_t> &packet) {
46 this->enable();
47 this->wait_busy_();
49 this->transfer_byte(offset);
50 for (const uint8_t &byte : packet) {
51 this->transfer_byte(byte);
52 }
53 this->disable();
54 delayMicroseconds(SWITCHING_DELAY_US);
55}
56
57uint8_t SX126x::read_opcode_(uint8_t opcode, uint8_t *data, uint8_t size) {
58 this->enable();
59 this->wait_busy_();
60 this->transfer_byte(opcode);
61 uint8_t status = this->transfer_byte(0x00);
62 for (int32_t i = 0; i < size; i++) {
63 data[i] = this->transfer_byte(0x00);
64 }
65 this->disable();
66 return status;
67}
68
69void SX126x::write_opcode_(uint8_t opcode, uint8_t *data, uint8_t size) {
70 this->enable();
71 this->wait_busy_();
72 this->transfer_byte(opcode);
73 for (int32_t i = 0; i < size; i++) {
74 this->transfer_byte(data[i]);
75 }
76 this->disable();
77 delayMicroseconds(SWITCHING_DELAY_US);
78}
79
80void SX126x::read_register_(uint16_t reg, uint8_t *data, uint8_t size) {
81 this->enable();
82 this->wait_busy_();
84 this->write_byte((reg >> 8) & 0xFF);
85 this->write_byte((reg >> 0) & 0xFF);
86 this->write_byte(0x00);
87 for (int32_t i = 0; i < size; i++) {
88 data[i] = this->transfer_byte(0x00);
89 }
90 this->disable();
91}
92
93void SX126x::write_register_(uint16_t reg, uint8_t *data, uint8_t size) {
94 this->enable();
95 this->wait_busy_();
97 this->write_byte((reg >> 8) & 0xFF);
98 this->write_byte((reg >> 0) & 0xFF);
99 for (int32_t i = 0; i < size; i++) {
100 this->transfer_byte(data[i]);
101 }
102 this->disable();
103 delayMicroseconds(SWITCHING_DELAY_US);
104}
105
107
109 // setup pins
110 this->busy_pin_->setup();
111 this->rst_pin_->setup();
112 this->dio1_pin_->setup();
113 if (this->dio1_pin_->is_internal()) {
114 static_cast<InternalGPIOPin *>(this->dio1_pin_)
115 ->attach_interrupt(&SX126x::gpio_intr, this, gpio::INTERRUPT_RISING_EDGE);
116 }
117
118 // start spi
119 this->spi_setup();
120
121 // configure rf
122 this->configure();
123}
124
126 uint8_t buf[8];
127
128 // toggle chip reset
129 this->rst_pin_->digital_write(true);
130 delayMicroseconds(RESET_DELAY_HIGH_US);
131 this->rst_pin_->digital_write(false);
132 delayMicroseconds(RESET_DELAY_LOW_US);
133 this->rst_pin_->digital_write(true);
134 delayMicroseconds(RESET_DELAY_HIGH_US);
135
136 // wakeup
137 this->read_opcode_(RADIO_GET_STATUS, nullptr, 0);
138
139 // config tcxo
140 if (this->tcxo_voltage_ != TCXO_CTRL_NONE) {
141 uint32_t delay = this->tcxo_delay_ >> 6;
142 buf[0] = this->tcxo_voltage_;
143 buf[1] = (delay >> 16) & 0xFF;
144 buf[2] = (delay >> 8) & 0xFF;
145 buf[3] = (delay >> 0) & 0xFF;
146 this->write_opcode_(RADIO_SET_TCXOMODE, buf, 4);
147 buf[0] = 0x7F;
148 this->write_opcode_(RADIO_CALIBRATE, buf, 1);
149 }
150
151 // clear errors
152 buf[0] = 0x00;
153 buf[1] = 0x00;
154 this->write_opcode_(RADIO_CLR_ERROR, buf, 2);
155
156 // rf switch
157 if (this->rf_switch_) {
158 buf[0] = 0x01;
160 }
161
162 // check silicon version to make sure hw is ok
163 this->read_register_(REG_VERSION_STRING, (uint8_t *) this->version_, sizeof(this->version_));
164 this->version_[sizeof(this->version_) - 1] = '\0';
165 if (strncmp(this->version_, "SX126", 5) != 0 && strncmp(this->version_, "LLCC68", 6) != 0) {
166 this->mark_failed();
167 return;
168 }
169
170 // setup packet type
171 buf[0] = this->modulation_;
172 this->write_opcode_(RADIO_SET_PACKETTYPE, buf, 1);
173
174 // calibrate image
175 this->run_image_cal();
176
177 // set frequency
178 uint64_t freq = ((uint64_t) this->frequency_ << 25) / XTAL_FREQ;
179 buf[0] = (uint8_t) ((freq >> 24) & 0xFF);
180 buf[1] = (uint8_t) ((freq >> 16) & 0xFF);
181 buf[2] = (uint8_t) ((freq >> 8) & 0xFF);
182 buf[3] = (uint8_t) (freq & 0xFF);
184
185 // configure pa
186 int8_t pa_power = this->pa_power_;
187 if (this->hw_version_ == "sx1261") {
188 // the following values were taken from section 13.1.14.1 table 13-21
189 // in rev 2.1 of the datasheet
190 if (pa_power == 15) {
191 uint8_t cfg[4] = {0x06, 0x00, 0x01, 0x01};
192 this->write_opcode_(RADIO_SET_PACONFIG, cfg, 4);
193 } else {
194 uint8_t cfg[4] = {0x04, 0x00, 0x01, 0x01};
195 this->write_opcode_(RADIO_SET_PACONFIG, cfg, 4);
196 }
197 pa_power = std::max(pa_power, (int8_t) -3);
198 pa_power = std::min(pa_power, (int8_t) 14);
199 buf[0] = OCP_80MA;
200 this->write_register_(REG_OCP, buf, 1);
201 } else {
202 // the following values were taken from section 13.1.14.1 table 13-21
203 // in rev 2.1 of the datasheet
204 uint8_t cfg[4] = {0x04, 0x07, 0x00, 0x01};
205 this->write_opcode_(RADIO_SET_PACONFIG, cfg, 4);
206 pa_power = std::max(pa_power, (int8_t) -3);
207 pa_power = std::min(pa_power, (int8_t) 22);
208 buf[0] = OCP_140MA;
209 this->write_register_(REG_OCP, buf, 1);
210 }
211 buf[0] = pa_power;
212 buf[1] = this->pa_ramp_;
213 this->write_opcode_(RADIO_SET_TXPARAMS, buf, 2);
214
215 // configure modem
216 if (this->modulation_ == PACKET_TYPE_LORA) {
217 // set modulation params
218 float duration = 1000.0f * std::pow(2, this->spreading_factor_) / BW_HZ[this->bandwidth_];
219 buf[0] = this->spreading_factor_;
220 buf[1] = BW_LORA[this->bandwidth_ - SX126X_BW_7810];
221 buf[2] = this->coding_rate_;
222 buf[3] = (duration > LOW_DATA_RATE_OPTIMIZE_THRESHOLD) ? 0x01 : 0x00;
224
225 // set packet params and sync word
227 if (this->sync_value_.size() == 2) {
228 this->write_register_(REG_LORA_SYNCWORD, this->sync_value_.data(), this->sync_value_.size());
229 }
230 } else {
231 // set modulation params
232 uint32_t bitrate = ((uint64_t) XTAL_FREQ * 32) / this->bitrate_;
233 uint32_t fdev = ((uint64_t) this->deviation_ << 25) / XTAL_FREQ;
234 buf[0] = (bitrate >> 16) & 0xFF;
235 buf[1] = (bitrate >> 8) & 0xFF;
236 buf[2] = (bitrate >> 0) & 0xFF;
237 buf[3] = this->shaping_;
238 buf[4] = BW_FSK[this->bandwidth_ - SX126X_BW_4800];
239 buf[5] = (fdev >> 16) & 0xFF;
240 buf[6] = (fdev >> 8) & 0xFF;
241 buf[7] = (fdev >> 0) & 0xFF;
243
244 // set crc params
245 if (this->crc_enable_) {
246 buf[0] = this->crc_initial_ >> 8;
247 buf[1] = this->crc_initial_ & 0xFF;
248 this->write_register_(REG_CRC_INITIAL, buf, 2);
249 buf[0] = this->crc_polynomial_ >> 8;
250 buf[1] = this->crc_polynomial_ & 0xFF;
251 this->write_register_(REG_CRC_POLYNOMIAL, buf, 2);
252 }
253
254 // set packet params and sync word
256 if (!this->sync_value_.empty()) {
257 this->write_register_(REG_GFSK_SYNCWORD, this->sync_value_.data(), this->sync_value_.size());
258 }
259 }
260
261 // switch to rx or sleep
262 if (this->rx_start_) {
263 this->set_mode_rx();
264 } else {
265 this->set_mode_sleep();
266 }
267}
268
270 if (this->payload_length_ > 0) {
271 return this->payload_length_;
272 }
273 return 255;
274}
275
276void SX126x::set_packet_params_(uint8_t payload_length) {
277 uint8_t buf[9];
278 if (this->modulation_ == PACKET_TYPE_LORA) {
279 buf[0] = (this->preamble_size_ >> 8) & 0xFF;
280 buf[1] = (this->preamble_size_ >> 0) & 0xFF;
281 buf[2] = (this->payload_length_ > 0) ? 0x01 : 0x00;
282 buf[3] = payload_length;
283 buf[4] = (this->crc_enable_) ? 0x01 : 0x00;
284 buf[5] = 0x00;
286 } else {
287 uint16_t preamble_size = this->preamble_size_ * 8;
288 buf[0] = (preamble_size >> 8) & 0xFF;
289 buf[1] = (preamble_size >> 0) & 0xFF;
290 buf[2] = (this->preamble_detect_ > 0) ? ((this->preamble_detect_ - 1) | 0x04) : 0x00;
291 buf[3] = this->sync_value_.size() * 8;
292 buf[4] = 0x00;
293 buf[5] = (this->payload_length_ > 0) ? 0x00 : 0x01;
294 buf[6] = payload_length;
295 if (this->crc_enable_) {
296 buf[7] = (this->crc_inverted_ ? 0x04 : 0x00) + (this->crc_size_ & 0x02);
297 } else {
298 buf[7] = 0x01;
299 }
300 buf[8] = 0x00;
302 }
303}
304
305SX126xError SX126x::transmit_packet(const std::vector<uint8_t> &packet) {
306 if (this->payload_length_ > 0 && this->payload_length_ != packet.size()) {
307 ESP_LOGE(TAG, "Packet size does not match config");
309 }
310 if (packet.empty() || packet.size() > this->get_max_packet_size()) {
311 ESP_LOGE(TAG, "Packet size out of range");
313 }
314
317 if (this->payload_length_ == 0) {
318 this->set_packet_params_(packet.size());
319 }
320 this->write_fifo_(0x00, packet);
321 this->set_mode_tx();
322
323 // wait until transmit completes, typically the delay will be less than 100 ms
324 uint32_t start = millis();
325 while (!this->dio1_pin_->digital_read()) {
326 if (millis() - start > TRANSMIT_TIMEOUT_MS) {
327 ESP_LOGE(TAG, "Transmit packet failure");
329 break;
330 }
331 }
332
333 uint8_t buf[2];
334 buf[0] = 0xFF;
335 buf[1] = 0xFF;
336 this->write_opcode_(RADIO_CLR_IRQSTATUS, buf, 2);
337 if (this->payload_length_ == 0) {
339 }
340 if (this->rx_start_) {
341 this->set_mode_rx();
342 } else {
343 this->set_mode_sleep();
344 }
345 return ret;
346}
347
348void SX126x::call_listeners_(const std::vector<uint8_t> &packet, float rssi, float snr) {
349 for (auto &listener : this->listeners_) {
350 listener->on_packet(packet, rssi, snr);
351 }
352 this->packet_trigger_.trigger(packet, rssi, snr);
353}
354
356 if (this->dio1_pin_->is_internal()) {
357 this->disable_loop();
358 }
359 if (!this->dio1_pin_->digital_read()) {
360 return;
361 }
362
363 uint16_t status;
364 uint8_t buf[3];
365 uint8_t rssi;
366 int8_t snr;
367 this->read_opcode_(RADIO_GET_IRQSTATUS, buf, 2);
368 this->write_opcode_(RADIO_CLR_IRQSTATUS, buf, 2);
369 status = (buf[0] << 8) | buf[1];
370 if ((status & IRQ_RX_DONE) == IRQ_RX_DONE) {
373 if (this->modulation_ == PACKET_TYPE_LORA) {
374 rssi = buf[0];
375 snr = buf[1];
376 } else {
377 rssi = buf[2];
378 snr = 0;
379 }
381 this->packet_.resize(buf[0]);
382 this->read_fifo_(buf[1], this->packet_);
383 this->call_listeners_(this->packet_, (float) rssi / -2.0f, (float) snr / 4.0f);
384 }
385 }
386}
387
389 // the following values were taken from section 9.2.1 table 9-2
390 // in rev 2.1 of the datasheet
391 uint8_t buf[2] = {0, 0};
392 if (this->frequency_ > 900000000) {
393 buf[0] = 0xE1;
394 buf[1] = 0xE9;
395 } else if (this->frequency_ > 850000000) {
396 buf[0] = 0xD7;
397 buf[1] = 0xDB;
398 } else if (this->frequency_ > 770000000) {
399 buf[0] = 0xC1;
400 buf[1] = 0xC5;
401 } else if (this->frequency_ > 460000000) {
402 buf[0] = 0x75;
403 buf[1] = 0x81;
404 } else if (this->frequency_ > 425000000) {
405 buf[0] = 0x6B;
406 buf[1] = 0x6F;
407 }
408 if (buf[0] > 0 && buf[1] > 0) {
409 this->write_opcode_(RADIO_CALIBRATEIMAGE, buf, 2);
410 }
411}
412
414 uint8_t buf[8];
415
416 // configure irq params
418 buf[0] = (irq >> 8) & 0xFF;
419 buf[1] = (irq >> 0) & 0xFF;
420 buf[2] = (irq >> 8) & 0xFF;
421 buf[3] = (irq >> 0) & 0xFF;
422 buf[4] = (IRQ_RADIO_NONE >> 8) & 0xFF;
423 buf[5] = (IRQ_RADIO_NONE >> 0) & 0xFF;
424 buf[6] = (IRQ_RADIO_NONE >> 8) & 0xFF;
425 buf[7] = (IRQ_RADIO_NONE >> 0) & 0xFF;
427
428 // set timeout to 0
429 buf[0] = 0x00;
431
432 // switch to continuous mode rx
433 buf[0] = 0xFF;
434 buf[1] = 0xFF;
435 buf[2] = 0xFF;
436 this->write_opcode_(RADIO_SET_RX, buf, 3);
437}
438
440 uint8_t buf[8];
441
442 // configure irq params
443 uint16_t irq = IRQ_TX_DONE | IRQ_RX_TX_TIMEOUT;
444 buf[0] = (irq >> 8) & 0xFF;
445 buf[1] = (irq >> 0) & 0xFF;
446 buf[2] = (irq >> 8) & 0xFF;
447 buf[3] = (irq >> 0) & 0xFF;
448 buf[4] = (IRQ_RADIO_NONE >> 8) & 0xFF;
449 buf[5] = (IRQ_RADIO_NONE >> 0) & 0xFF;
450 buf[6] = (IRQ_RADIO_NONE >> 8) & 0xFF;
451 buf[7] = (IRQ_RADIO_NONE >> 0) & 0xFF;
453
454 // switch to single mode tx
455 buf[0] = 0x00;
456 buf[1] = 0x00;
457 buf[2] = 0x00;
458 this->write_opcode_(RADIO_SET_TX, buf, 3);
459}
460
461void SX126x::set_mode_sleep(bool cold) {
462 // 0x04 = warm start (config retained), 0x00 = cold start (config lost, lowest power)
463 uint8_t buf[1];
464 buf[0] = cold ? 0x00 : 0x04;
465 this->write_opcode_(RADIO_SET_SLEEP, buf, 1);
466}
467
469 uint8_t buf[1];
470 buf[0] = mode;
471 this->write_opcode_(RADIO_SET_STANDBY, buf, 1);
472}
473
475 // wait if the device is busy, the maximum delay is only be a few ms
476 // with most commands taking only a few us
477 uint32_t start = millis();
478 while (this->busy_pin_->digital_read()) {
479 if (millis() - start > BUSY_TIMEOUT_MS) {
480 ESP_LOGE(TAG, "Wait busy timeout");
481 this->mark_failed();
482 break;
483 }
484 }
485}
486
488 ESP_LOGCONFIG(TAG, "SX126x:");
489 LOG_PIN(" CS Pin: ", this->cs_);
490 LOG_PIN(" BUSY Pin: ", this->busy_pin_);
491 LOG_PIN(" RST Pin: ", this->rst_pin_);
492 LOG_PIN(" DIO1 Pin: ", this->dio1_pin_);
493 ESP_LOGCONFIG(TAG,
494 " HW Version: %15s\n"
495 " Frequency: %" PRIu32 " Hz\n"
496 " Bandwidth: %" PRIu32 " Hz\n"
497 " PA Power: %" PRId8 " dBm\n"
498 " PA Ramp: %" PRIu16 " us\n"
499 " Payload Length: %" PRIu32 "\n"
500 " CRC Enable: %s\n"
501 " Rx Start: %s",
502 this->version_, this->frequency_, BW_HZ[this->bandwidth_], this->pa_power_, RAMP[this->pa_ramp_],
503 this->payload_length_, TRUEFALSE(this->crc_enable_), TRUEFALSE(this->rx_start_));
504 if (this->modulation_ == PACKET_TYPE_GFSK) {
505 const char *shaping = "NONE";
506 if (this->shaping_ == GAUSSIAN_BT_0_3) {
507 shaping = "GAUSSIAN_BT_0_3";
508 } else if (this->shaping_ == GAUSSIAN_BT_0_5) {
509 shaping = "GAUSSIAN_BT_0_5";
510 } else if (this->shaping_ == GAUSSIAN_BT_0_7) {
511 shaping = "GAUSSIAN_BT_0_7";
512 } else if (this->shaping_ == GAUSSIAN_BT_1_0) {
513 shaping = "GAUSSIAN_BT_1_0";
514 }
515 ESP_LOGCONFIG(TAG,
516 " Modulation: FSK\n"
517 " Deviation: %" PRIu32 " Hz\n"
518 " Shaping: %s\n"
519 " Preamble Size: %" PRIu16 "\n"
520 " Preamble Detect: %" PRIu16 "\n"
521 " Bitrate: %" PRIu32 "b/s",
522 this->deviation_, shaping, this->preamble_size_, this->preamble_detect_, this->bitrate_);
523 } else if (this->modulation_ == PACKET_TYPE_LORA) {
524 const char *cr = "4/8";
525 if (this->coding_rate_ == LORA_CR_4_5) {
526 cr = "4/5";
527 } else if (this->coding_rate_ == LORA_CR_4_6) {
528 cr = "4/6";
529 } else if (this->coding_rate_ == LORA_CR_4_7) {
530 cr = "4/7";
531 }
532 ESP_LOGCONFIG(TAG,
533 " Modulation: LORA\n"
534 " Spreading Factor: %" PRIu8 "\n"
535 " Coding Rate: %s\n"
536 " Preamble Size: %" PRIu16,
537 this->spreading_factor_, cr, this->preamble_size_);
538 }
539 if (!this->sync_value_.empty()) {
540 char hex_buf[17]; // 8 bytes max = 16 hex chars + null
541 ESP_LOGCONFIG(TAG, " Sync Value: 0x%s",
542 format_hex_to(hex_buf, this->sync_value_.data(), this->sync_value_.size()));
543 }
544 if (this->is_failed()) {
545 ESP_LOGE(TAG, "Configuring SX126x failed");
546 }
547}
548
549} // namespace esphome::sx126x
BedjetMode mode
BedJet operating mode.
uint8_t status
Definition bl0942.h:8
void mark_failed()
Mark this component as failed.
bool is_failed() const
Definition component.h:272
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 setup()=0
virtual void digital_write(bool value)=0
virtual ESPDEPRECATED("Override dump_summary(char*, size_t) instead. Will be removed in 2026.7.0.", "2026.1.0") virtual std boo is_internal)()
Get a summary of this pin as a string.
Definition gpio.h:88
virtual bool digital_read()=0
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Inform the parent automation that the event has triggered.
Definition automation.h:461
uint8_t read_fifo_(uint8_t offset, std::vector< uint8_t > &packet)
Definition sx126x.cpp:32
void write_opcode_(uint8_t opcode, uint8_t *data, uint8_t size)
Definition sx126x.cpp:69
std::vector< uint8_t > sync_value_
Definition sx126x.h:118
std::vector< SX126xListener * > listeners_
Definition sx126x.h:116
size_t get_max_packet_size()
Definition sx126x.cpp:269
void set_mode_standby(SX126xStandbyMode mode)
Definition sx126x.cpp:468
static void IRAM_ATTR gpio_intr(SX126x *arg)
Definition sx126x.cpp:106
Trigger< std::vector< uint8_t >, float, float > packet_trigger_
Definition sx126x.h:115
uint8_t read_opcode_(uint8_t opcode, uint8_t *data, uint8_t size)
Definition sx126x.cpp:57
void dump_config() override
Definition sx126x.cpp:487
void read_register_(uint16_t reg, uint8_t *data, uint8_t size)
Definition sx126x.cpp:80
void write_register_(uint16_t reg, uint8_t *data, uint8_t size)
Definition sx126x.cpp:93
uint16_t crc_polynomial_
Definition sx126x.h:129
uint16_t preamble_size_
Definition sx126x.h:136
void loop() override
Definition sx126x.cpp:355
void set_packet_params_(uint8_t payload_length)
Definition sx126x.cpp:276
void call_listeners_(const std::vector< uint8_t > &packet, float rssi, float snr)
Definition sx126x.cpp:348
std::vector< uint8_t > packet_
Definition sx126x.h:117
uint16_t preamble_detect_
Definition sx126x.h:135
void setup() override
Definition sx126x.cpp:108
std::string hw_version_
Definition sx126x.h:122
uint32_t payload_length_
Definition sx126x.h:133
SX126xError transmit_packet(const std::vector< uint8_t > &packet)
Definition sx126x.cpp:305
uint8_t spreading_factor_
Definition sx126x.h:142
void write_fifo_(uint8_t offset, const std::vector< uint8_t > &packet)
Definition sx126x.cpp:45
void set_mode_sleep(bool cold=false)
Definition sx126x.cpp:461
uint16_t preamble_size
uint8_t duration
Definition msa3xx.h:0
@ INTERRUPT_RISING_EDGE
Definition gpio.h:50
const char *const TAG
Definition spi.cpp:7
@ RADIO_SET_MODULATIONPARAMS
Definition sx126x_reg.h:31
@ RADIO_SET_LORASYMBTIMEOUT
Definition sx126x_reg.h:50
void IRAM_ATTR HOT delayMicroseconds(uint32_t us)
Definition hal.cpp:48
uint16_t size
Definition helpers.cpp:25
void HOT delay(uint32_t ms)
Definition hal.cpp:85
uint32_t IRAM_ATTR HOT millis()
Definition hal.cpp:28
char * format_hex_to(char *buffer, size_t buffer_size, const uint8_t *data, size_t length)
Format byte array as lowercase hex to buffer (base implementation).
Definition helpers.cpp:334
static void uint32_t