MySensors Library & Examples  2.3.2-62-ge298769
SX126x.h
Go to the documentation of this file.
1 /*
2  * The MySensors Arduino library handles the wireless radio link and protocol
3  * between your home built sensors/actuators and HA controller of choice.
4  * The sensors forms a self healing radio network with optional repeaters. Each
5  * repeater and gateway builds a routing tables in EEPROM which keeps track of the
6  * network topology allowing messages to be routed to nodes.
7  *
8  * Created by Henrik Ekblad <[email protected]>
9  * Copyright (C) 2013-2023 Sensnology AB
10  * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
11  *
12  * Documentation: http://www.mysensors.org
13  * Support Forum: http://forum.mysensors.org
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * version 2 as published by the Free Software Foundation.
18  *
19  * Based on Olivier Mauti's RFM95 driver and Semtecs reference driver for the SX126x
20  *
21  * SX126x driver for MySensors, Copyright (C) 2020 Eduard Iten <[email protected]>
22  *
23  */
24 
79 #ifndef _SX126x_h
80 #define _SX126x_h
81 
82 #include <stdint.h>
83 
84 // SX126x hardware defaults
85 #if !defined(SX126x_SPI)
86 #define SX126x_SPI hwSPI
87 #endif
88 
89 // default PIN assignments, can be overridden
90 #if defined(ARDUINO_ARCH_AVR)
91 #if defined(__AVR_ATmega32U4__)
92 #define DEFAULT_SX126x_IRQ_PIN (3)
93 #else
94 #define DEFAULT_SX126x_IRQ_PIN (2)
95 #endif
96 #elif defined(ARDUINO_ARCH_ESP8266)
97 #define DEFAULT_SX126x_IRQ_PIN (5)
98 #elif defined(ARDUINO_ARCH_ESP32)
99 #define DEFAULT_SX126x_IRQ_PIN (16)
100 #define DEFAULT_SX126x_IRQ_NUM digitalPinToInterrupt(DEFAULT_SX126x_IRQ_PIN)
101 #elif defined(ARDUINO_ARCH_SAMD)
102 #define DEFAULT_SX126x_IRQ_PIN (2)
103 #elif defined(LINUX_ARCH_RASPBERRYPI)
104 #define DEFAULT_SX126x_IRQ_PIN (22)
105 #elif defined(ARDUINO_ARCH_STM32F1)
106 #define DEFAULT_SX126x_IRQ_PIN (PA3)
107 #elif defined(TEENSYDUINO)
108 #define DEFAULT_SX126x_IRQ_PIN (8)
109 #else
110 #define DEFAULT_SX126x_IRQ_PIN (2)
111 #endif
112 
113 #ifndef DEFAULT_SX126x_CS_PIN
114 #define DEFAULT_SX126x_CS_PIN (SS)
115 #endif
116 
117 // Frequency helpers
118 #define SX126x_XTAL_FREQ ( double )32000000
119 #define SX126x_FREQ_DIV ( double )pow( 2.0, 25.0 )
120 #define SX126x_FREQ_STEP ( double )( SX126x_XTAL_FREQ / SX126x_FREQ_DIV )
121 
122 // SX126x radio configurations: reg_1d, reg_1e, reg_26 (see datasheet)
123 #define SX126x_BW125CR45SF128 SX126x_BW_125KHZ | SX126x_CODING_RATE_4_5, SX126x_SPREADING_FACTOR_128CPS | SX126x_RX_PAYLOAD_CRC_ON, SX126x_AGC_AUTO_ON
124 #define SX126x_BW500CR45SF128 SX126x_BW_500KHZ | SX126x_CODING_RATE_4_5, SX126x_SPREADING_FACTOR_128CPS | SX126x_RX_PAYLOAD_CRC_ON, SX126x_AGC_AUTO_ON
125 #define SX126x_BW31_25CR48SF512 SX126x_BW_31_25KHZ | SX126x_CODING_RATE_4_8, SX126x_SPREADING_FACTOR_512CPS | SX126x_RX_PAYLOAD_CRC_ON, SX126x_AGC_AUTO_ON
126 #define SX126x_BW125CR48SF4096 SX126x_BW_125KHZ | SX126x_CODING_RATE_4_8, SX126x_SPREADING_FACTOR_4096CPS | SX126x_RX_PAYLOAD_CRC_ON, SX126x_AGC_AUTO_ON | SX126x_LOW_DATA_RATE_OPTIMIZE
127 
128 #define SX126x_BROADCAST_ADDRESS (255u)
129 #define SX126x_ATC_TARGET_RANGE_DBM (2u)
130 #define SX126x_RSSI_OFFSET (137u)
131 #define SX126x_TARGET_RSSI (-70)
132 #define SX126x_PROMISCUOUS (false)
133 
134 #if (MY_SX126x_MAX_POWER_LEVEL_DBM) <= (MY_SX126x_MIN_POWER_LEVEL_DBM)
135 #error SX126x_MAX_POWER_DBM has to be bigger than SX126x_MIN_POWER_DBM
136 #endif
137 
138 #define SX126x_PACKET_HEADER_VERSION (1u)
139 #define SX126x_MIN_PACKET_HEADER_VERSION (1u)
140 
141 #if !defined(SX126x_RETRY_TIMEOUT_MS)
142 // air-time approximation for timeout, 1 hop ~15 bytes payload - adjust if needed
143 // BW125/SF128: 50ms
144 // BW500/SF128: 15ms
145 // BW31.25/SF512: 900ms
146 // BW125/SF4096: 1500ms
147 #define SX126x_RETRY_TIMEOUT_MS (500ul)
148 #endif
149 
150 #if !defined(MY_SX126x_TX_TIMEOUT_MS)
151 #define MY_SX126x_TX_TIMEOUT_MS (5*1000ul)
152 #endif
153 
160 #ifndef MY_SX126x_TX_POWER_DBM
161 #define MY_SX126x_TX_POWER_DBM (13u) // 20mW
162 #endif
163 
164 // Frequency definitions
165 #define SX126x_169MHZ (169000000ul)
166 #define SX126x_315MHZ (315000000ul)
167 #define SX126x_434MHZ (433920000ul)
168 #define SX126x_868MHZ (868100000ul)
169 #define SX126x_915MHZ (915000000ul)
170 
171 #define SX126x_RETRIES (5u)
172 #define SX126x_MAX_PACKET_LEN (0x40u)
173 #define SX126x_PREAMBLE_LENGTH (8u)
174 #define SX126x_CAD_TIMEOUT_MS (2 * 1000ul)
175 
176 #define SX126x_POWERUP_DELAY_MS 3
177 #define SX126x_SLEEP_WARM_START 0x04
178 
179 
182 #define SX126x_REG_OCP 0x08E7
183 #define SX126x_REG_LORASW 0x0740
184 
185 
188 typedef enum sx126xCommands_e {
189  SX126x_RESET_STATS = 0x00,
190  SX126x_CLR_IRQSTATUS = 0x02,
191  SX126x_CLR_ERROR = 0x07,
192  SX126x_CFG_DIOIRQ = 0x08,
193  SX126x_SET_LORASYMBTIMEOUT = 0xA0,
194  SX126x_WRITE_REGISTER = 0x0D,
195  SX126x_WRITE_BUFFER = 0x0E,
196  SX126x_GET_STATS = 0x10,
197  SX126x_GET_PACKETTYPE = 0x11,
198  SX126x_GET_IRQSTATUS = 0x12,
199  SX126x_GET_RXBUFFERSTATUS = 0x13,
200  SX126x_GET_PACKETSTATUS = 0x14,
201  SX126x_GET_RSSIINST = 0x15,
202  SX126x_GET_ERROR = 0x17,
203  SX126x_READ_REGISTER = 0x1D,
204  SX126x_READ_BUFFER = 0x1E,
205  SX126x_SET_STANDBY = 0x80,
206  SX126x_SET_RX = 0x82,
207  SX126x_SET_TX = 0x83,
208  SX126x_SET_SLEEP = 0x84,
209  SX126x_SET_RFFREQUENCY = 0x86,
210  SX126x_SET_CADPARAMS = 0x88,
211  SX126x_CALIBRATE = 0x89,
212  SX126x_SET_PACKETTYPE = 0x8A,
213  SX126x_SET_MODULATIONPARAMS = 0x8B,
214  SX126x_SET_PACKETPARAMS = 0x8C,
215  SX126x_SET_TXPARAMS = 0x8E,
216  SX126x_SET_BUFFERBASEADDRESS = 0x8F,
217  SX126x_SET_TXFALLBACKMODE = 0x93,
218  SX126x_SET_RXDUTYCYCLE = 0x94,
219  SX126x_SET_PACONFIG = 0x95,
220  SX126x_SET_REGULATORMODE = 0x96,
221  SX126x_SET_TCXOMODE = 0x97,
222  SX126x_CALIBRATEIMAGE = 0x98,
223  SX126x_SET_RFSWITCHMODE = 0x9D,
224  SX126x_SET_STOPRXTIMERONPREAMBLE = 0x9F,
225  SX126x_GET_STATUS = 0xC0,
226  SX126x_SET_FS = 0xC1,
227  SX126x_SET_CAD = 0xC5,
228  SX126x_SET_TXCONTINUOUSWAVE = 0xD1,
229  SX126x_SET_TXCONTINUOUSPREAMBLE = 0xD2,
231 
238 typedef enum {
239  SX126x_STDBY_RC = 0x00,
240  SX126x_STDBY_XOSC = 0x01,
242 
249 typedef enum {
250  SX126x_USE_LDO = 0x00, // default
251  SX126x_USE_DCDC = 0x01,
253 
257 typedef enum {
258  SX126x_PACKET_TYPE_GFSK = 0x00,
259  SX126x_PACKET_TYPE_LORA = 0x01,
260  SX126x_PACKET_TYPE_NONE = 0x0F,
262 
266 typedef union {
267  struct {
268  uint8_t payloadLength;
269  uint8_t startPointer;
270  } fields;
271  uint8_t values[2];
273 
277 typedef union {
278  struct {
279  uint8_t rawRssiPkt;
280  int8_t rawSnrPkt;
282  } fields;
283  uint8_t values[3];
285 
289 typedef union {
290  struct {
291  bool wakeUpRTC : 1;
292  uint8_t : 1;
293  bool warmStart : 1;
294  uint8_t : 5;
295  } fields;
296  uint8_t value;
298 
302 typedef enum {
312 
316 typedef enum {
317  LORA_SF5 = 0x05,
318  LORA_SF6 = 0x06,
319  LORA_SF7 = 0x07,
320  LORA_SF8 = 0x08,
321  LORA_SF9 = 0x09,
322  LORA_SF10 = 0x0A,
323  LORA_SF11 = 0x0B,
324  LORA_SF12 = 0x0C,
326 
330 typedef enum {
331  LORA_BW_500 = 6,
332  LORA_BW_250 = 5,
333  LORA_BW_125 = 4,
334  LORA_BW_062 = 3,
335  LORA_BW_041 = 10,
336  LORA_BW_031 = 2,
337  LORA_BW_020 = 9,
338  LORA_BW_015 = 1,
339  LORA_BW_010 = 8,
340  LORA_BW_007 = 0,
342 
346 typedef enum {
347  LORA_CR_4_5 = 0x01,
348  LORA_CR_4_6 = 0x02,
349  LORA_CR_4_7 = 0x03,
350  LORA_CR_4_8 = 0x04,
352 
356 typedef enum {
357  LORA_CAD_ON_1_SYMB = 0x00,
358  LORA_CAD_ON_2_SYMB = 0x01,
359  LORA_CAD_ON_4_SYMB = 0x02,
360  LORA_CAD_ON_8_SYMB = 0x03,
361  LORA_CAD_ON_16_SYMB = 0x04,
363 
367 typedef enum {
368  SX126x_CAD_ONLY = 0x00,
369  SX126x_CAD_RX = 0x01,
371 
375 typedef union {
376  struct {
378  uint8_t cadDetPeak;
379  uint8_t cadDetMin;
381  uint8_t cadTimeout1;
382  uint8_t cadTimeout2;
383  uint8_t cadTimeout3;
384  } fields;
385  uint8_t values[7];
387 
388 // Define CAD parameters
389 
393 typedef struct {
394  union {
395  struct {
400  } fields;
401  uint8_t values[8];
402  };
404 
408 typedef enum {
409  PACKET_TYPE_GFSK = 0x00,
410  PACKET_TYPE_LORA = 0x01,
411  PACKET_TYPE_NONE = 0x0F,
413 
417 typedef struct {
418  union {
419  struct {
420  uint8_t paDutyCycle;
421  uint8_t hpMax;
422  uint8_t deviceSel;
423  uint8_t paLut = 0x01;
424  } fields;
425  uint8_t values[4];
426  };
428 
432 typedef enum {
433  RADIO_RAMP_10_US = 0x00,
434  RADIO_RAMP_20_US = 0x01,
435  RADIO_RAMP_40_US = 0x02,
436  RADIO_RAMP_80_US = 0x03,
437  RADIO_RAMP_200_US = 0x04,
438  RADIO_RAMP_800_US = 0x05,
439  RADIO_RAMP_1700_US = 0x06,
440  RADIO_RAMP_3400_US = 0x07,
442 
446 typedef struct {
447  union {
448  struct {
449  uint8_t power;
451  } fields;
452  uint8_t values[2];
453  };
455 
459 typedef uint16_t sx126x_sequenceNumber_t; // will eventually change to uint8_t in 3.0
463 typedef uint8_t sx126x_RSSI_t;
467 typedef int8_t sx126x_SNR_t;
471 typedef union {
472  struct {
473  uint8_t :5;
474  bool ackRssiReport :1;
475  bool ackReceived :1;
476  bool ackRequested :1;
477  } fields;
478  uint8_t values;
480 
484 typedef int8_t sx126x_powerLevel_t;
488 typedef struct {
489  uint8_t version;
490  uint8_t recipient;
491  uint8_t sender;
494 } __attribute__((packed)) sx126x_header_t;
495 
499 typedef struct {
500  sx126x_sequenceNumber_t sequenceNumber;
503 } __attribute__((packed)) sx126x_ack_t;
504 
505 #define SX126x_HEADER_LEN sizeof(sx126x_header_t)
506 #define SX126x_MAX_PAYLOAD_LEN (SX126x_MAX_PACKET_LEN - SX126x_HEADER_LEN)
507 
508 
511 typedef struct {
512  union {
513  struct {
514  sx126x_header_t header;
515  union {
516  uint8_t payload[SX126x_MAX_PAYLOAD_LEN];
517  sx126x_ack_t ACK;
518  };
519  };
520  uint8_t data[SX126x_MAX_PACKET_LEN];
521  };
522  uint8_t payloadLen;
523  sx126x_RSSI_t RSSI;
524  sx126x_SNR_t SNR;
525 } __attribute__((packed)) sx126x_packet_t;
526 
530 typedef struct {
531  uint8_t address;
532  sx126x_packet_t currentPacket;
537  bool ATCenabled;
538  bool channelActive : 1;
539  bool channelFree : 1;
540  volatile bool ackReceived : 1;
541  volatile bool dataReceived : 1;
542  volatile bool txComplete : 1;
543  volatile bool irqFired : 1;
545 
549 typedef enum {
550  SX126x_TCXO_1V6 = 0x00,
551  SX126x_TCXO_1V7,
552  SX126x_TCXO_1V8,
553  SX126x_TCXO_2V2,
554  SX126x_TCXO_2V4,
555  SX126x_TCXO_2V7,
556  SX126x_TCXO_3V0,
557  SX126x_TCXO_3V3,
559 
563 typedef enum {
564  SX126x_IRQ_NONE = 0x0000,
565  SX126x_IRQ_TX_DONE = 0x0001,
566  SX126x_IRQ_RX_DONE = 0x0002,
567  SX126x_IRQ_PREAMBLE_DETECTED = 0x0004,
568  SX126x_IRQ_SYNCWORD_VALID = 0x0008,
569  SX126x_IRQ_HEADER_VALID = 0x0010,
570  SX126x_IRQ_HEADER_ERROR = 0x0020,
571  SX126x_IRQ_CRC_ERROR = 0x0040,
572  SX126x_IRQ_CAD_DONE = 0x0080,
573  SX126x_IRQ_CAD_ACTIVITY_DETECTED = 0x0100,
574  SX126x_IRQ_RX_TX_TIMEOUT = 0x0200,
575  SX126x_IRQ_ALL = 0xFFFF,
577 
584 static void
585 SX126x_sendCommand(sx126x_commands_t command, uint8_t *buffer, uint16_t size);
586 
592 static void SX126x_sendCommand(sx126x_commands_t command, uint8_t parameter);
593 
600 static void SX126x_readCommand(sx126x_commands_t command, uint8_t *buffer, uint16_t size);
601 
608 static void SX126x_sendRegisters(uint16_t address, uint8_t *buffer, uint16_t size);
609 
615 static void SX126x_sendRegister(uint16_t address, uint8_t value);
616 
621 static bool SX126x_initialise();
622 
626 static void SX126x_wakeUp();
627 
631 static void SX126x_standBy();
632 
636 static void SX126x_busy();
637 
641 static void SX126x_sleep();
642 
646 static void SX126x_interruptHandler();
647 
651 static void SX126x_handle();
652 
657 static bool SX126x_txPower(sx126x_powerLevel_t power);
658 
663 static void SX126x_setFrequency(uint32_t frequency);
664 
669 static void SX126x_setIrqMask(uint16_t mask);
670 
675 static void SX126x_clearIrq(uint16_t mask);
676 
681 static void SX126x_setPacketParameters(uint8_t length);
682 
687 static bool SX126x_sanityCheck();
688 
693 static void SX126x_setAddress(uint8_t address);
694 
699 static uint8_t SX126x_getAddress(void);
700 
709 static bool SX126x_sendWithRetry(const uint8_t recipient, const void *buffer,
710  const uint8_t bufferSize, const bool noACK);
711 
720 static bool SX126x_send(const uint8_t recipient, uint8_t *data, const uint8_t len,
721  const sx126x_controlFlags_t flags);
727 static bool SX126x_sendPacket(sx126x_packet_t *packet);
728 
735 static void SX126x_sendBuffer(const uint8_t offset, const uint8_t *buffer, const uint8_t size);
736 
743 static void SX126x_readBuffer(const uint8_t offset, uint8_t *buffer, const uint8_t size);
744 
748 static void SX126x_tx();
749 
750 
754 static void SX126x_rx();
755 
760 static bool SX126x_cad();
761 
766 static bool SX126x_packetAvailable();
767 
773 static uint8_t SX126x_getData(uint8_t *buffer, const uint8_t bufferSize);
774 
782 static void SX126x_sendAck(const uint8_t recipient, const sx126x_sequenceNumber_t sequenceNumber,
783  const sx126x_RSSI_t RSSI, const sx126x_SNR_t SNR);
784 
788 static void SX126x_ATC();
789 
795 static void SX126x_setATC(bool onOff, int8_t targetRSSI);
796 
801 static int16_t SX126x_getSendingRSSI();
802 
807 static int16_t SX126x_getSendingSNR();
808 
813 static int16_t SX126x_getReceivingRSSI();
814 
819 static int16_t SX126x_getReceivingSNR();
820 
825 static int8_t SX126x_getTxPowerLevel();
826 
831 static uint8_t SX126x_getTxPowerPercent();
832 
837 static bool SX126x_setTxPowerPercent(const uint8_t newPowerPercent);
838 
840 #endif
sx126x_cadExitModes_t
sx126x_cadExitModes_t
CAD exit type.
Definition: SX126x.h:367
__attribute__::ACK
sx126x_ack_t ACK
Union: ACK.
Definition: SX126x.h:517
data
char data[MAX_PAYLOAD_SIZE+1]
Buffer for raw payload data.
Definition: MyMessage.h:654
sx126x_internal_t::channelFree
bool channelFree
SX126x_cadDone.
Definition: SX126x.h:539
__attribute__::header
sx126x_header_t header
LoRa header.
Definition: SX126x.h:514
sx126x_controlFlags_t::ackReceived
bool ackReceived
ackReceived
Definition: SX126x.h:475
sx126x_controlFlags_t::ackRssiReport
bool ackRssiReport
ackRssiReport
Definition: SX126x.h:474
sx126x_loRaBandwidths_t
sx126x_loRaBandwidths_t
LoRa Bandwiths.
Definition: SX126x.h:330
sx126x_RSSI_t
uint8_t sx126x_RSSI_t
RSSI data type.
Definition: SX126x.h:463
sx126x_internal_t::targetRSSI
sx126x_powerLevel_t targetRSSI
ATC target power level.
Definition: SX126x.h:536
sx126x_sequenceNumber_t
uint16_t sx126x_sequenceNumber_t
Sequence number data type.
Definition: SX126x.h:459
SX126x_MODE_RX_DC
@ SX126x_MODE_RX_DC
SX126x is in receive duty cycle mode.
Definition: SX126x.h:309
sx126x_SNR_t
int8_t sx126x_SNR_t
SNR data type.
Definition: SX126x.h:467
sx126x_sleepParams_t::warmStart
bool warmStart
false: cold start. true: warm start with config retention
Definition: SX126x.h:293
sx126x_modulationParams_t::bandwidth
sx126x_loRaBandwidths_t bandwidth
Bandwidth for the LoRa modulation.
Definition: SX126x.h:397
sx126x_rxBufferStatus_t::startPointer
uint8_t startPointer
startPointer
Definition: SX126x.h:269
sx126x_controlFlags_t::values
uint8_t values
values
Definition: SX126x.h:478
sx126x_loRaSpreadingFactors_t
sx126x_loRaSpreadingFactors_t
LoRa spreading factors.
Definition: SX126x.h:316
sx126x_internal_t::radioMode
sx126x_radioModes_t radioMode
Current radio mode.
Definition: SX126x.h:535
SX126x_MODE_RX
@ SX126x_MODE_RX
SX126x is in receive mode.
Definition: SX126x.h:308
sx126x_irqMasks_t
sx126x_irqMasks_t
IRQ masks.
Definition: SX126x.h:563
sx126x_txSettings_t::power
uint8_t power
power
Definition: SX126x.h:449
sx126x_cadParameters_t::cadTimeout1
uint8_t cadTimeout1
cadTimeout1
Definition: SX126x.h:381
sx126x_internal_t::txComplete
volatile bool txComplete
Transmission complete.
Definition: SX126x.h:542
__attribute__::controlFlags
sx126x_controlFlags_t controlFlags
Control flags, used for ACK.
Definition: SX126x.h:492
sx126x_cadParameters_t::cadDetPeak
uint8_t cadDetPeak
cadDetPeak
Definition: SX126x.h:378
sx126x_cadParameters_t::cadExitMode
sx126x_cadExitModes_t cadExitMode
cadExitMode
Definition: SX126x.h:380
sx126x_paSettings_t::hpMax
uint8_t hpMax
hpMax
Definition: SX126x.h:421
sx126x_controlFlags_t::ackRequested
bool ackRequested
ackRequested
Definition: SX126x.h:476
sx126x_paSettings_t::paDutyCycle
uint8_t paDutyCycle
paDutyCycle
Definition: SX126x.h:420
sx126x_sleepParams_t::wakeUpRTC
bool wakeUpRTC
wake up on RTC timeout
Definition: SX126x.h:291
SX126x_packetTypes_t
SX126x_packetTypes_t
SX126x packet types.
Definition: SX126x.h:408
__attribute__::sequenceNumber
sx126x_sequenceNumber_t sequenceNumber
Packet sequence number, used for ACK.
Definition: SX126x.h:493
sx126x_modulationParams_t::spreadingFactor
sx126x_loRaSpreadingFactors_t spreadingFactor
Spreading Factor for the LoRa modulation.
Definition: SX126x.h:396
sx126x_internal_t::dataReceived
volatile bool dataReceived
Data received.
Definition: SX126x.h:541
sx126x_packetStatus_t::rawRssiPkt
uint8_t rawRssiPkt
rawRssiPkt
Definition: SX126x.h:279
SX126x_MODE_STDBY_RC
@ SX126x_MODE_STDBY_RC
SX126x is in standby mode with RC oscillator.
Definition: SX126x.h:304
sx126x_modulationParams_t
Typedef for the SX126x modulation settings.
Definition: SX126x.h:393
sx126x_cadParameters_t::cadDetMin
uint8_t cadDetMin
cadDetMin
Definition: SX126x.h:379
sx126x_internal_t::ackReceived
volatile bool ackReceived
ACK received.
Definition: SX126x.h:540
sx126x_internal_t::currentPacket
sx126x_packet_t currentPacket
Buffer for current packet.
Definition: SX126x.h:532
sx126x_sleepParams_t::value
uint8_t value
value
Definition: SX126x.h:296
sx126x_radioStandbyModes_t
sx126x_radioStandbyModes_t
Declares the oscillator in use while in standby mode.
Definition: SX126x.h:238
sx126x_internal_t
SX126x internal variables.
Definition: SX126x.h:530
sx126x_paSettings_t
PA settings parameters type.
Definition: SX126x.h:417
__attribute__
struct @4::@5 __attribute__
Doxygen will complain without this comment.
Definition: DigitalPin.h:65
SX126x_MODE_STDBY_XOSC
@ SX126x_MODE_STDBY_XOSC
SX126x is in standby mode with XOSC oscillator.
Definition: SX126x.h:305
sx126x_internal_t::ATCenabled
bool ATCenabled
ATC enabled.
Definition: SX126x.h:537
sx126x_packetStatus_t::rawSignalRssiPkt
uint8_t rawSignalRssiPkt
rawSignalRssiPkt
Definition: SX126x.h:281
sx126x_internal_t::channelActive
bool channelActive
SX126x_cadDetected.
Definition: SX126x.h:538
__attribute__::RSSI
sx126x_RSSI_t RSSI
RSSI.
Definition: SX126x.h:501
sx126x_paSettings_t::deviceSel
uint8_t deviceSel
deviceSel
Definition: SX126x.h:422
SX126x_MAX_PACKET_LEN
#define SX126x_MAX_PACKET_LEN
This is the maximum number of bytes that can be carried by the LORA.
Definition: SX126x.h:172
sx126x_txSettings_t
Transmission settings parameters type.
Definition: SX126x.h:446
sx126x_packetStatus_t::rawSnrPkt
int8_t rawSnrPkt
rawSnrPkt
Definition: SX126x.h:280
sx126x_packetStatus_t
data type to receive packet status
Definition: SX126x.h:277
sx126x_loRaCodingRates_t
sx126x_loRaCodingRates_t
LoRa coding rates.
Definition: SX126x.h:346
sender
uint8_t sender
8 bit - Id of sender node (origin)
Definition: MyMessage.h:335
sx126x_controlFlags_t
Control flag data type.
Definition: SX126x.h:471
SX126x_MODE_CAD
@ SX126x_MODE_CAD
SX126x is in channel activity detection mode.
Definition: SX126x.h:310
sx126x_internal_t::address
uint8_t address
Node address.
Definition: SX126x.h:531
SX126x_MAX_PAYLOAD_LEN
#define SX126x_MAX_PAYLOAD_LEN
Max payload length.
Definition: SX126x.h:506
sx126x_cadParameters_t::cadTimeout2
uint8_t cadTimeout2
cadTimeout2
Definition: SX126x.h:382
sx126x_loRaCADSymbols_t
sx126x_loRaCADSymbols_t
LoRa CAD number of symbols.
Definition: SX126x.h:356
sx126x_cadParameters_t
CAD parameters type.
Definition: SX126x.h:375
sx126xCommands_e
sx126xCommands_e
Commands for the SX126x chip.
Definition: SX126x.h:188
sx126x_RampTimes_t
sx126x_RampTimes_t
Ramping time for power amplifier.
Definition: SX126x.h:432
SX126x_MODE_TX
@ SX126x_MODE_TX
SX126x is in transmit mode.
Definition: SX126x.h:307
sx126x_tcxoVoltage_t
sx126x_tcxoVoltage_t
SX126x TCXO output voltages.
Definition: SX126x.h:549
sx126x_sleepParams_t
sx126x sleep parameters
Definition: SX126x.h:289
sx126x_commands_t
enum sx126xCommands_e sx126x_commands_t
Commands for the SX126x chip.
sx126x_radioModes_t
sx126x_radioModes_t
SX126x operation Modes.
Definition: SX126x.h:302
sx126x_powerLevel_t
int8_t sx126x_powerLevel_t
Power level in dBm.
Definition: SX126x.h:484
__attribute__::SNR
sx126x_SNR_t SNR
SNR.
Definition: SX126x.h:502
sx126x_txSettings_t::rampTime
sx126x_RampTimes_t rampTime
rampTime
Definition: SX126x.h:450
sx126x_internal_t::txSequenceNumber
sx126x_sequenceNumber_t txSequenceNumber
SX126x_txSequenceNumber.
Definition: SX126x.h:533
sx126x_rxBufferStatus_t::payloadLength
uint8_t payloadLength
payloadLength
Definition: SX126x.h:268
sx126x_radioPacketTypes_t
sx126x_radioPacketTypes_t
Declares the possible packet type (i.e. modem) used.
Definition: SX126x.h:257
sx126x_internal_t::irqFired
volatile bool irqFired
irq occured
Definition: SX126x.h:543
sx126x_rxBufferStatus_t
data type to receive RX buffer status
Definition: SX126x.h:266
values
Structure to be used in percentage and resistance values matrix to be filtered (have to be in pairs)
Definition: SoilMoistSensor.ino:87
sx126x_radioRegulatorMode_t
sx126x_radioRegulatorMode_t
Declares the power regulation used to power the device.
Definition: SX126x.h:249
sx126x_cadParameters_t::cadTimeout3
uint8_t cadTimeout3
cadTimeout3
Definition: SX126x.h:383
sx126x_cadParameters_t::cadSymbolsNum
sx126x_loRaCADSymbols_t cadSymbolsNum
cadSymbolsNum
Definition: SX126x.h:377
sx126x_modulationParams_t::codingRate
sx126x_loRaCodingRates_t codingRate
Coding rate for the LoRa modulation.
Definition: SX126x.h:398
sx126x_internal_t::powerLevel
sx126x_powerLevel_t powerLevel
TX power level dBm.
Definition: SX126x.h:534
SX126x_MODE_SLEEP
@ SX126x_MODE_SLEEP
SX126x is in sleep mode.
Definition: SX126x.h:303
SX126x_MODE_FS
@ SX126x_MODE_FS
SX126x is in frequency synthesis mode.
Definition: SX126x.h:306
sx126x_modulationParams_t::lowDatarateOptimize
bool lowDatarateOptimize
Indicates if the modem uses the low datarate optimization.
Definition: SX126x.h:399