sx126x_reg.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. #ifndef __SX126X_REG_H
  2. #define __SX126X_REG_H
  3. #define AUTO_RX_TX_OFFSET 2
  4. /*!
  5. * \brief LFSR initial value to compute IBM type CRC
  6. */
  7. #define CRC_IBM_SEED 0xFFFF
  8. /*!
  9. * \brief LFSR initial value to compute CCIT type CRC
  10. */
  11. #define CRC_CCITT_SEED 0x1D0F
  12. /*!
  13. * \brief Polynomial used to compute IBM CRC
  14. */
  15. #define CRC_POLYNOMIAL_IBM 0x8005
  16. /*!
  17. * \brief Polynomial used to compute CCIT CRC
  18. */
  19. #define CRC_POLYNOMIAL_CCITT 0x1021
  20. /*!
  21. * \brief The address of the register holding the first byte defining the CRC seed
  22. *
  23. */
  24. #define REG_LR_CRCSEEDBASEADDR 0x06BC
  25. /*!
  26. * \brief The address of the register holding the first byte defining the CRC polynomial
  27. */
  28. #define REG_LR_CRCPOLYBASEADDR 0x06BE
  29. /*!
  30. * \brief The address of the register holding the first byte defining the whitening seed
  31. */
  32. #define REG_LR_WHITSEEDBASEADDR_MSB 0x06B8
  33. #define REG_LR_WHITSEEDBASEADDR_LSB 0x06B9
  34. /*!
  35. * \brief The address of the register holding the packet configuration
  36. */
  37. #define REG_LR_PACKETPARAMS 0x0704
  38. /*!
  39. * \brief The address of the register holding the payload size
  40. */
  41. #define REG_LR_PAYLOADLENGTH 0x0702
  42. /*!
  43. * \brief The addresses of the registers holding SyncWords values
  44. */
  45. #define REG_LR_SYNCWORDBASEADDRESS 0x06C0
  46. /*!
  47. * \brief The addresses of the register holding LoRa Modem SyncWord value
  48. */
  49. #define REG_LR_SYNCWORD 0x0740
  50. /*!
  51. * Syncword for Private LoRa networks
  52. */
  53. #define LORA_MAC_PRIVATE_SYNCWORD 0x1424
  54. /*!
  55. * Syncword for Public LoRa networks
  56. */
  57. #define LORA_MAC_PUBLIC_SYNCWORD 0x3444
  58. /*!
  59. * The address of the register giving a 4 bytes random number
  60. */
  61. #define RANDOM_NUMBER_GENERATORBASEADDR 0x0819
  62. /*!
  63. * The address of the register holding RX Gain value (0x94: power saving, 0x96: rx boosted)
  64. */
  65. #define REG_RX_GAIN 0x08AC
  66. /*!
  67. * Change the value on the device internal trimming capacitor
  68. */
  69. #define REG_XTA_TRIM 0x0911
  70. /*!
  71. * Set the current max value in the over current protection
  72. */
  73. #define REG_OCP 0x08E7
  74. /*!
  75. * \brief Structure describing the radio status
  76. */
  77. typedef union RadioStatus_u
  78. {
  79. uint8_t Value;
  80. struct
  81. { //bit order is lsb -> msb
  82. uint8_t Reserved : 1; //!< Reserved
  83. uint8_t CmdStatus : 3; //!< Command status
  84. uint8_t ChipMode : 3; //!< Chip mode
  85. uint8_t CpuBusy : 1; //!< Flag for CPU radio busy
  86. }Fields;
  87. }RadioStatus_t;
  88. /*!
  89. * \brief Structure describing the error codes for callback functions
  90. */
  91. typedef enum
  92. {
  93. IRQ_HEADER_ERROR_CODE = 0x01,
  94. IRQ_SYNCWORD_ERROR_CODE = 0x02,
  95. IRQ_CRC_ERROR_CODE = 0x04,
  96. }IrqErrorCode_t;
  97. enum IrqPblSyncHeaderCode_t
  98. {
  99. IRQ_PBL_DETECT_CODE = 0x01,
  100. IRQ_SYNCWORD_VALID_CODE = 0x02,
  101. IRQ_HEADER_VALID_CODE = 0x04,
  102. };
  103. /*!
  104. * \brief Represents the operating mode the radio is actually running
  105. */
  106. typedef enum
  107. {
  108. MODE_SLEEP = 0x00, //! The radio is in sleep mode
  109. MODE_STDBY_RC, //! The radio is in standby mode with RC oscillator
  110. MODE_STDBY_XOSC, //! The radio is in standby mode with XOSC oscillator
  111. MODE_FS, //! The radio is in frequency synthesis mode
  112. MODE_TX, //! The radio is in transmit mode
  113. MODE_RX, //! The radio is in receive mode
  114. MODE_RX_DC, //! The radio is in receive duty cycle mode
  115. MODE_CAD //! The radio is in channel activity detection mode
  116. }RadioOperatingModes_t;
  117. /*!
  118. * \brief Declares the oscillator in use while in standby mode
  119. *
  120. * Using the STDBY_RC standby mode allow to reduce the energy consumption
  121. * STDBY_XOSC should be used for time critical applications
  122. */
  123. typedef enum
  124. {
  125. STDBY_RC = 0x00,
  126. STDBY_XOSC = 0x01,
  127. }RadioStandbyModes_t;
  128. /*!
  129. * \brief Declares the power regulation used to power the device
  130. *
  131. * This command allows the user to specify if DC-DC or LDO is used for power regulation.
  132. * Using only LDO implies that the Rx or Tx current is doubled
  133. */
  134. typedef enum
  135. {
  136. USE_LDO = 0x00, // default
  137. USE_DCDC = 0x01,
  138. }RadioRegulatorMode_t;
  139. /*!
  140. * \brief Represents the possible packet type (i.e. modem) used
  141. */
  142. typedef enum
  143. {
  144. PACKET_TYPE_GFSK = 0x00,
  145. PACKET_TYPE_LORA = 0x01,
  146. PACKET_TYPE_NONE = 0x0F,
  147. }RadioPacketTypes_t;
  148. /*!
  149. * \brief Represents the ramping time for power amplifier
  150. */
  151. typedef enum
  152. {
  153. RADIO_RAMP_10_US = 0x00,
  154. RADIO_RAMP_20_US = 0x01,
  155. RADIO_RAMP_40_US = 0x02,
  156. RADIO_RAMP_80_US = 0x03,
  157. RADIO_RAMP_200_US = 0x04,
  158. RADIO_RAMP_800_US = 0x05,
  159. RADIO_RAMP_1700_US = 0x06,
  160. RADIO_RAMP_3400_US = 0x07,
  161. }RadioRampTimes_t;
  162. /*!
  163. * \brief Represents the number of symbols to be used for channel activity detection operation
  164. */
  165. typedef enum
  166. {
  167. LORA_CAD_01_SYMBOL = 0x00,
  168. LORA_CAD_02_SYMBOL = 0x01,
  169. LORA_CAD_04_SYMBOL = 0x02,
  170. LORA_CAD_08_SYMBOL = 0x03,
  171. LORA_CAD_16_SYMBOL = 0x04,
  172. }RadioLoRaCadSymbols_t;
  173. /*!
  174. * \brief Represents the Channel Activity Detection actions after the CAD operation is finished
  175. */
  176. typedef enum
  177. {
  178. LORA_CAD_ONLY = 0x00,
  179. LORA_CAD_RX = 0x01,
  180. LORA_CAD_LBT = 0x10,
  181. }RadioCadExitModes_t;
  182. /*!
  183. * \brief Represents the modulation shaping parameter
  184. */
  185. typedef enum
  186. {
  187. MOD_SHAPING_OFF = 0x00,
  188. MOD_SHAPING_G_BT_03 = 0x08,
  189. MOD_SHAPING_G_BT_05 = 0x09,
  190. MOD_SHAPING_G_BT_07 = 0x0A,
  191. MOD_SHAPING_G_BT_1 = 0x0B,
  192. }RadioModShapings_t;
  193. /*!
  194. * \brief Represents the modulation shaping parameter
  195. */
  196. typedef enum
  197. {
  198. RX_BW_4800 = 0x1F,
  199. RX_BW_5800 = 0x17,
  200. RX_BW_7300 = 0x0F,
  201. RX_BW_9700 = 0x1E,
  202. RX_BW_11700 = 0x16,
  203. RX_BW_14600 = 0x0E,
  204. RX_BW_19500 = 0x1D,
  205. RX_BW_23400 = 0x15,
  206. RX_BW_29300 = 0x0D,
  207. RX_BW_39000 = 0x1C,
  208. RX_BW_46900 = 0x14,
  209. RX_BW_58600 = 0x0C,
  210. RX_BW_78200 = 0x1B,
  211. RX_BW_93800 = 0x13,
  212. RX_BW_117300 = 0x0B,
  213. RX_BW_156200 = 0x1A,
  214. RX_BW_187200 = 0x12,
  215. RX_BW_234300 = 0x0A,
  216. RX_BW_312000 = 0x19,
  217. RX_BW_373600 = 0x11,
  218. RX_BW_467000 = 0x09,
  219. }RadioRxBandwidth_t;
  220. /*!
  221. * \brief Represents the possible spreading factor values in LoRa packet types
  222. */
  223. typedef enum
  224. {
  225. LORA_SF5 = 0x05,
  226. LORA_SF6 = 0x06,
  227. LORA_SF7 = 0x07,
  228. LORA_SF8 = 0x08,
  229. LORA_SF9 = 0x09,
  230. LORA_SF10 = 0x0A,
  231. LORA_SF11 = 0x0B,
  232. LORA_SF12 = 0x0C,
  233. }RadioLoRaSpreadingFactors_t;
  234. /*!
  235. * \brief Represents the bandwidth values for LoRa packet type
  236. */
  237. typedef enum
  238. {
  239. LORA_BW_500 = 6,
  240. LORA_BW_250 = 5,
  241. LORA_BW_125 = 4,
  242. LORA_BW_062 = 3,
  243. LORA_BW_041 = 10,
  244. LORA_BW_031 = 2,
  245. LORA_BW_020 = 9,
  246. LORA_BW_015 = 1,
  247. LORA_BW_010 = 8,
  248. LORA_BW_007 = 0,
  249. }RadioLoRaBandwidths_t;
  250. /*!
  251. * \brief Represents the coding rate values for LoRa packet type
  252. */
  253. typedef enum
  254. {
  255. LORA_CR_4_5 = 0x01,
  256. LORA_CR_4_6 = 0x02,
  257. LORA_CR_4_7 = 0x03,
  258. LORA_CR_4_8 = 0x04,
  259. }RadioLoRaCodingRates_t;
  260. /*!
  261. * \brief Represents the preamble length used to detect the packet on Rx side
  262. */
  263. typedef enum
  264. {
  265. RADIO_PREAMBLE_DETECTOR_OFF = 0x00, //!< Preamble detection length off
  266. RADIO_PREAMBLE_DETECTOR_08_BITS = 0x04, //!< Preamble detection length 8 bits
  267. RADIO_PREAMBLE_DETECTOR_16_BITS = 0x05, //!< Preamble detection length 16 bits
  268. RADIO_PREAMBLE_DETECTOR_24_BITS = 0x06, //!< Preamble detection length 24 bits
  269. RADIO_PREAMBLE_DETECTOR_32_BITS = 0x07, //!< Preamble detection length 32 bit
  270. }RadioPreambleDetection_t;
  271. /*!
  272. * \brief Represents the possible combinations of SyncWord correlators activated
  273. */
  274. typedef enum
  275. {
  276. RADIO_ADDRESSCOMP_FILT_OFF = 0x00, //!< No correlator turned on, i.e. do not search for SyncWord
  277. RADIO_ADDRESSCOMP_FILT_NODE = 0x01,
  278. RADIO_ADDRESSCOMP_FILT_NODE_BROAD = 0x02,
  279. }RadioAddressComp_t;
  280. /*!
  281. * \brief Radio GFSK packet length mode
  282. */
  283. typedef enum
  284. {
  285. RADIO_PACKET_FIXED_LENGTH = 0x00, //!< The packet is known on both sides, no header included in the packet
  286. RADIO_PACKET_VARIABLE_LENGTH = 0x01, //!< The packet is on variable size, header included
  287. }RadioPacketLengthModes_t;
  288. /*!
  289. * \brief Represents the CRC length
  290. */
  291. typedef enum
  292. {
  293. RADIO_CRC_OFF = 0x01, //!< No CRC in use
  294. RADIO_CRC_1_BYTES = 0x00,
  295. RADIO_CRC_2_BYTES = 0x02,
  296. RADIO_CRC_1_BYTES_INV = 0x04,
  297. RADIO_CRC_2_BYTES_INV = 0x06,
  298. RADIO_CRC_2_BYTES_IBM = 0xF1,
  299. RADIO_CRC_2_BYTES_CCIT = 0xF2,
  300. }RadioCrcTypes_t;
  301. /*!
  302. * \brief Radio whitening mode activated or deactivated
  303. */
  304. typedef enum
  305. {
  306. RADIO_DC_FREE_OFF = 0x00,
  307. RADIO_DC_FREEWHITENING = 0x01,
  308. }RadioDcFree_t;
  309. /*!
  310. * \brief Holds the Radio lengths mode for the LoRa packet type
  311. */
  312. typedef enum
  313. {
  314. LORA_PACKET_VARIABLE_LENGTH = 0x00, //!< The packet is on variable size, header included
  315. LORA_PACKET_FIXED_LENGTH = 0x01, //!< The packet is known on both sides, no header included in the packet
  316. LORA_PACKET_EXPLICIT = LORA_PACKET_VARIABLE_LENGTH,
  317. LORA_PACKET_IMPLICIT = LORA_PACKET_FIXED_LENGTH,
  318. }RadioLoRaPacketLengthsMode_t;
  319. /*!
  320. * \brief Represents the CRC mode for LoRa packet type
  321. */
  322. typedef enum
  323. {
  324. LORA_CRC_ON = 0x01, //!< CRC activated
  325. LORA_CRC_OFF = 0x00, //!< CRC not used
  326. }RadioLoRaCrcModes_t;
  327. /*!
  328. * \brief Represents the IQ mode for LoRa packet type
  329. */
  330. typedef enum
  331. {
  332. LORA_IQ_NORMAL = 0x00,
  333. LORA_IQ_INVERTED = 0x01,
  334. }RadioLoRaIQModes_t;
  335. /*!
  336. * \brief Represents the voltage used to control the TCXO on/off from DIO3
  337. */
  338. typedef enum
  339. {
  340. TCXO_CTRL_1_6V = 0x00,
  341. TCXO_CTRL_1_7V = 0x01,
  342. TCXO_CTRL_1_8V = 0x02,
  343. TCXO_CTRL_2_2V = 0x03,
  344. TCXO_CTRL_2_4V = 0x04,
  345. TCXO_CTRL_2_7V = 0x05,
  346. TCXO_CTRL_3_0V = 0x06,
  347. TCXO_CTRL_3_3V = 0x07,
  348. }RadioTcxoCtrlVoltage_t;
  349. /*!
  350. * \brief Represents the interruption masks available for the radio
  351. *
  352. * \remark Note that not all these interruptions are available for all packet types
  353. */
  354. typedef enum
  355. {
  356. IRQ_RADIO_NONE = 0x0000,
  357. IRQ_TX_DONE = 0x0001,
  358. IRQ_RX_DONE = 0x0002,
  359. IRQ_PREAMBLE_DETECTED = 0x0004,
  360. IRQ_SYNCWORD_VALID = 0x0008,
  361. IRQ_HEADER_VALID = 0x0010,
  362. IRQ_HEADER_ERROR = 0x0020,
  363. IRQ_CRC_ERROR = 0x0040,
  364. IRQ_CAD_DONE = 0x0080,
  365. IRQ_CAD_ACTIVITY_DETECTED = 0x0100,
  366. IRQ_RX_TX_TIMEOUT = 0x0200,
  367. IRQ_RADIO_ALL = 0xFFFF,
  368. }RadioIrqMasks_t;
  369. /*!
  370. * \brief Represents all possible opcode understood by the radio
  371. */
  372. typedef enum RadioCommands_e
  373. {
  374. RADIO_GET_STATUS = 0xC0,
  375. RADIO_WRITE_REGISTER = 0x0D,
  376. RADIO_READ_REGISTER = 0x1D,
  377. RADIO_WRITE_BUFFER = 0x0E,
  378. RADIO_READ_BUFFER = 0x1E,
  379. RADIO_SET_SLEEP = 0x84,
  380. RADIO_SET_STANDBY = 0x80,
  381. RADIO_SET_FS = 0xC1,
  382. RADIO_SET_TX = 0x83,
  383. RADIO_SET_RX = 0x82,
  384. RADIO_SET_RXDUTYCYCLE = 0x94,
  385. RADIO_SET_CAD = 0xC5,
  386. RADIO_SET_TXCONTINUOUSWAVE = 0xD1,
  387. RADIO_SET_TXCONTINUOUSPREAMBLE = 0xD2,
  388. RADIO_SET_PACKETTYPE = 0x8A,
  389. RADIO_GET_PACKETTYPE = 0x11,
  390. RADIO_SET_RFFREQUENCY = 0x86,
  391. RADIO_SET_TXPARAMS = 0x8E,
  392. RADIO_SET_PACONFIG = 0x95,
  393. RADIO_SET_CADPARAMS = 0x88,
  394. RADIO_SET_BUFFERBASEADDRESS = 0x8F,
  395. RADIO_SET_MODULATIONPARAMS = 0x8B,
  396. RADIO_SET_PACKETPARAMS = 0x8C,
  397. RADIO_GET_RXBUFFERSTATUS = 0x13,
  398. RADIO_GET_PACKETSTATUS = 0x14,
  399. RADIO_GET_RSSIINST = 0x15,
  400. RADIO_GET_STATS = 0x10,
  401. RADIO_RESET_STATS = 0x00,
  402. RADIO_CFG_DIOIRQ = 0x08,
  403. RADIO_GET_IRQSTATUS = 0x12,
  404. RADIO_CLR_IRQSTATUS = 0x02,
  405. RADIO_CALIBRATE = 0x89,
  406. RADIO_CALIBRATEIMAGE = 0x98,
  407. RADIO_SET_REGULATORMODE = 0x96,
  408. RADIO_GET_ERROR = 0x17,
  409. RADIO_CLR_ERROR = 0x07,
  410. RADIO_SET_TCXOMODE = 0x97,
  411. RADIO_SET_TXFALLBACKMODE = 0x93,
  412. RADIO_SET_RFSWITCHMODE = 0x9D,
  413. RADIO_SET_STOPRXTIMERONPREAMBLE = 0x9F,
  414. RADIO_SET_LORASYMBTIMEOUT = 0xA0,
  415. }RadioCommands_t;
  416. /*!
  417. * \brief The type describing the modulation parameters for every packet types
  418. */
  419. typedef struct
  420. {
  421. RadioPacketTypes_t PacketType; //!< Packet to which the modulation parameters are referring to.
  422. struct
  423. {
  424. struct
  425. {
  426. uint32_t BitRate;
  427. uint32_t Fdev;
  428. RadioModShapings_t ModulationShaping;
  429. uint8_t Bandwidth;
  430. }Gfsk;
  431. struct
  432. {
  433. RadioLoRaSpreadingFactors_t SpreadingFactor; //!< Spreading Factor for the LoRa modulation
  434. RadioLoRaBandwidths_t Bandwidth; //!< Bandwidth for the LoRa modulation
  435. RadioLoRaCodingRates_t CodingRate; //!< Coding rate for the LoRa modulation
  436. uint8_t LowDatarateOptimize; //!< Indicates if the modem uses the low datarate optimization
  437. }LoRa;
  438. }Params; //!< Holds the modulation parameters structure
  439. }ModulationParams_t;
  440. /*!
  441. * \brief The type describing the packet parameters for every packet types
  442. */
  443. typedef struct
  444. {
  445. RadioPacketTypes_t PacketType; //!< Packet to which the packet parameters are referring to.
  446. struct
  447. {
  448. /*!
  449. * \brief Holds the GFSK packet parameters
  450. */
  451. struct
  452. {
  453. uint16_t PreambleLength; //!< The preamble Tx length for GFSK packet type in bit
  454. RadioPreambleDetection_t PreambleMinDetect; //!< The preamble Rx length minimal for GFSK packet type
  455. uint8_t SyncWordLength; //!< The synchronization word length for GFSK packet type
  456. RadioAddressComp_t AddrComp; //!< Activated SyncWord correlators
  457. RadioPacketLengthModes_t HeaderType; //!< If the header is explicit, it will be transmitted in the GFSK packet. If the header is implicit, it will not be transmitted
  458. uint8_t PayloadLength; //!< Size of the payload in the GFSK packet
  459. RadioCrcTypes_t CrcLength; //!< Size of the CRC block in the GFSK packet
  460. RadioDcFree_t DcFree;
  461. }Gfsk;
  462. /*!
  463. * \brief Holds the LoRa packet parameters
  464. */
  465. struct
  466. {
  467. uint16_t PreambleLength; //!< The preamble length is the number of LoRa symbols in the preamble
  468. RadioLoRaPacketLengthsMode_t HeaderType; //!< If the header is explicit, it will be transmitted in the LoRa packet. If the header is implicit, it will not be transmitted
  469. uint8_t PayloadLength; //!< Size of the payload in the LoRa packet
  470. RadioLoRaCrcModes_t CrcMode; //!< Size of CRC block in LoRa packet
  471. RadioLoRaIQModes_t InvertIQ; //!< Allows to swap IQ for LoRa packet
  472. }LoRa;
  473. }Params; //!< Holds the packet parameters structure
  474. }PacketParams_t;
  475. /*!
  476. * \brief Represents the packet status for every packet type
  477. */
  478. typedef struct
  479. {
  480. RadioPacketTypes_t packetType; //!< Packet to which the packet status are referring to.
  481. struct
  482. {
  483. struct
  484. {
  485. uint8_t RxStatus;
  486. int8_t RssiAvg; //!< The averaged RSSI
  487. int8_t RssiSync; //!< The RSSI measured on last packet
  488. uint32_t FreqError;
  489. }Gfsk;
  490. struct
  491. {
  492. int8_t RssiPkt; //!< The RSSI of the last packet
  493. int8_t SnrPkt; //!< The SNR of the last packet
  494. int8_t SignalRssiPkt;
  495. uint32_t FreqError;
  496. }LoRa;
  497. }Params;
  498. }PacketStatus_t;
  499. /*!
  500. * \brief Represents the Rx internal counters values when GFSK or LoRa packet type is used
  501. */
  502. typedef struct
  503. {
  504. RadioPacketTypes_t packetType; //!< Packet to which the packet status are referring to.
  505. uint16_t PacketReceived;
  506. uint16_t CrcOk;
  507. uint16_t LengthError;
  508. }RxCounter_t;
  509. /*!
  510. * \brief Represents a calibration configuration
  511. */
  512. typedef union
  513. {
  514. struct
  515. {
  516. uint8_t RC64KEnable : 1; //!< Calibrate RC64K clock
  517. uint8_t RC13MEnable : 1; //!< Calibrate RC13M clock
  518. uint8_t PLLEnable : 1; //!< Calibrate PLL
  519. uint8_t ADCPulseEnable : 1; //!< Calibrate ADC Pulse
  520. uint8_t ADCBulkNEnable : 1; //!< Calibrate ADC bulkN
  521. uint8_t ADCBulkPEnable : 1; //!< Calibrate ADC bulkP
  522. uint8_t ImgEnable : 1;
  523. uint8_t : 1;
  524. }Fields;
  525. uint8_t Value;
  526. }CalibrationParams_t;
  527. /*!
  528. * \brief Represents a sleep mode configuration
  529. */
  530. typedef union
  531. {
  532. struct
  533. {
  534. uint8_t WakeUpRTC : 1; //!< Get out of sleep mode if wakeup signal received from RTC
  535. uint8_t Reset : 1;
  536. uint8_t WarmStart : 1;
  537. uint8_t Reserved : 5;
  538. }Fields;
  539. uint8_t Value;
  540. }SleepParams_t;
  541. /*!
  542. * \brief Represents the possible radio system error states
  543. */
  544. typedef union
  545. {
  546. struct
  547. {
  548. uint8_t Rc64kCalib : 1; //!< RC 64kHz oscillator calibration failed
  549. uint8_t Rc13mCalib : 1; //!< RC 13MHz oscillator calibration failed
  550. uint8_t PllCalib : 1; //!< PLL calibration failed
  551. uint8_t AdcCalib : 1; //!< ADC calibration failed
  552. uint8_t ImgCalib : 1; //!< Image calibration failed
  553. uint8_t XoscStart : 1; //!< XOSC oscillator failed to start
  554. uint8_t PllLock : 1; //!< PLL lock failed
  555. uint8_t BuckStart : 1; //!< Buck converter failed to start
  556. uint8_t PaRamp : 1; //!< PA ramp failed
  557. uint8_t : 7; //!< Reserved
  558. }Fields;
  559. uint16_t Value;
  560. }RadioError_t;
  561. /*!
  562. * Radio hardware and global parameters
  563. */
  564. typedef struct SX126x_s
  565. {
  566. PacketParams_t PacketParams;
  567. PacketStatus_t PacketStatus;
  568. ModulationParams_t ModulationParams;
  569. }SX126x_t;
  570. #endif