sx1276-Fsk.h 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460
  1. /*
  2. * THE FOLLOWING FIRMWARE IS PROVIDED: (1) "AS IS" WITH NO WARRANTY; AND
  3. * (2)TO ENABLE ACCESS TO CODING INFORMATION TO GUIDE AND FACILITATE CUSTOMER.
  4. * CONSEQUENTLY, SEMTECH SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR
  5. * CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
  6. * OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
  7. * CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  8. *
  9. * Copyright (C) SEMTECH S.A.
  10. */
  11. /*!
  12. * \file sx1276-Fsk.h
  13. * \brief SX1276 RF chip driver mode FSK
  14. *
  15. * \version 2.0.B2
  16. * \date May 6 2013
  17. * \author Gregory Cristian
  18. *
  19. * Last modified by Miguel Luis on Jun 19 2013
  20. */
  21. #ifndef __SX1276_FSK_H__
  22. #define __SX1276_FSK_H__
  23. /*!
  24. * SX1276 FSK General parameters definition
  25. */
  26. typedef struct sFskSettings
  27. {
  28. uint32_t RFFrequency;
  29. uint32_t Bitrate;
  30. uint32_t Fdev;
  31. int8_t Power;
  32. uint32_t RxBw;
  33. uint32_t RxBwAfc;
  34. bool CrcOn;
  35. bool AfcOn;
  36. uint8_t PayloadLength;
  37. }tFskSettings;
  38. /*!
  39. * RF packet definition
  40. */
  41. #define RF_BUFFER_SIZE_MAX 256
  42. #define RF_BUFFER_SIZE 256
  43. /*!
  44. * RF state machine
  45. */
  46. // FSK
  47. typedef enum
  48. {
  49. RF_STATE_IDLE,
  50. RF_STATE_RX_INIT,
  51. RF_STATE_RX_SYNC,
  52. RF_STATE_RX_RUNNING,
  53. RF_STATE_RX_DONE,
  54. RF_STATE_RX_TIMEOUT,
  55. RF_STATE_RX_LEN_ERROR,
  56. RF_STATE_TX_INIT,
  57. RF_STATE_TX_READY_WAIT,
  58. RF_STATE_TX_RUNNING,
  59. RF_STATE_TX_DONE,
  60. RF_STATE_TX_TIMEOUT,
  61. }tRFStates;
  62. /*!
  63. * SX1276 definitions
  64. */
  65. #define XTAL_FREQ 32000000
  66. #define FREQ_STEP 61.03515625
  67. /*!
  68. * SX1276 Internal registers Address
  69. */
  70. #define REG_FIFO 0x00
  71. // Common settings
  72. #define REG_OPMODE 0x01
  73. #define REG_BITRATEMSB 0x02
  74. #define REG_BITRATELSB 0x03
  75. #define REG_FDEVMSB 0x04
  76. #define REG_FDEVLSB 0x05
  77. #define REG_FRFMSB 0x06
  78. #define REG_FRFMID 0x07
  79. #define REG_FRFLSB 0x08
  80. // Tx settings
  81. #define REG_PACONFIG 0x09
  82. #define REG_PARAMP 0x0A
  83. #define REG_OCP 0x0B
  84. // Rx settings
  85. #define REG_LNA 0x0C
  86. #define REG_RXCONFIG 0x0D
  87. #define REG_RSSICONFIG 0x0E
  88. #define REG_RSSICOLLISION 0x0F
  89. #define REG_RSSITHRESH 0x10
  90. #define REG_RSSIVALUE 0x11
  91. #define REG_RXBW 0x12
  92. #define REG_AFCBW 0x13
  93. #define REG_OOKPEAK 0x14
  94. #define REG_OOKFIX 0x15
  95. #define REG_OOKAVG 0x16
  96. #define REG_RES17 0x17
  97. #define REG_RES18 0x18
  98. #define REG_RES19 0x19
  99. #define REG_AFCFEI 0x1A
  100. #define REG_AFCMSB 0x1B
  101. #define REG_AFCLSB 0x1C
  102. #define REG_FEIMSB 0x1D
  103. #define REG_FEILSB 0x1E
  104. #define REG_PREAMBLEDETECT 0x1F
  105. #define REG_RXTIMEOUT1 0x20
  106. #define REG_RXTIMEOUT2 0x21
  107. #define REG_RXTIMEOUT3 0x22
  108. #define REG_RXDELAY 0x23
  109. // Oscillator settings
  110. #define REG_OSC 0x24
  111. // Packet handler settings
  112. #define REG_PREAMBLEMSB 0x25
  113. #define REG_PREAMBLELSB 0x26
  114. #define REG_SYNCCONFIG 0x27
  115. #define REG_SYNCVALUE1 0x28
  116. #define REG_SYNCVALUE2 0x29
  117. #define REG_SYNCVALUE3 0x2A
  118. #define REG_SYNCVALUE4 0x2B
  119. #define REG_SYNCVALUE5 0x2C
  120. #define REG_SYNCVALUE6 0x2D
  121. #define REG_SYNCVALUE7 0x2E
  122. #define REG_SYNCVALUE8 0x2F
  123. #define REG_PACKETCONFIG1 0x30
  124. #define REG_PACKETCONFIG2 0x31
  125. #define REG_PAYLOADLENGTH 0x32
  126. #define REG_NODEADRS 0x33
  127. #define REG_BROADCASTADRS 0x34
  128. #define REG_FIFOTHRESH 0x35
  129. // SM settings
  130. #define REG_SEQCONFIG1 0x36
  131. #define REG_SEQCONFIG2 0x37
  132. #define REG_TIMERRESOL 0x38
  133. #define REG_TIMER1COEF 0x39
  134. #define REG_TIMER2COEF 0x3A
  135. // Service settings
  136. #define REG_IMAGECAL 0x3B
  137. #define REG_TEMP 0x3C
  138. #define REG_LOWBAT 0x3D
  139. // Status
  140. #define REG_IRQFLAGS1 0x3E
  141. #define REG_IRQFLAGS2 0x3F
  142. // I/O settings
  143. #define REG_DIOMAPPING1 0x40
  144. #define REG_DIOMAPPING2 0x41
  145. // Version
  146. #define REG_VERSION 0x42
  147. // Additional settings
  148. #define REG_PLLHOP 0x44
  149. #define REG_TCXO 0x4B
  150. #define REG_PADAC 0x4D
  151. #define REG_FORMERTEMP 0x5B
  152. #define REG_BITRATEFRAC 0x5D
  153. #define REG_AGCREF 0x61
  154. #define REG_AGCTHRESH1 0x62
  155. #define REG_AGCTHRESH2 0x63
  156. #define REG_AGCTHRESH3 0x64
  157. /*!
  158. * SX1276 FSK bit control definition
  159. */
  160. /*!
  161. * RegFifo
  162. */
  163. /*!
  164. * RegOpMode
  165. */
  166. #define RF_OPMODE_LONGRANGEMODE_MASK 0x7F
  167. #define RF_OPMODE_LONGRANGEMODE_OFF 0x00 // Default
  168. #define RF_OPMODE_LONGRANGEMODE_ON 0x80
  169. #define RF_OPMODE_MODULATIONTYPE_MASK 0x9F
  170. #define RF_OPMODE_MODULATIONTYPE_FSK 0x00 // Default
  171. #define RF_OPMODE_MODULATIONTYPE_OOK 0x20
  172. #define RF_OPMODE_FREQMODE_ACCESS_MASK 0xF7
  173. #define RF_OPMODE_FREQMODE_ACCESS_LF 0x08 // Default
  174. #define RF_OPMODE_FREQMODE_ACCESS_HF 0x00
  175. #define RF_OPMODE_MASK 0xF8
  176. #define RF_OPMODE_SLEEP 0x00
  177. #define RF_OPMODE_STANDBY 0x01 // Default
  178. #define RF_OPMODE_SYNTHESIZER_TX 0x02
  179. #define RF_OPMODE_TRANSMITTER 0x03
  180. #define RF_OPMODE_SYNTHESIZER_RX 0x04
  181. #define RF_OPMODE_RECEIVER 0x05
  182. /*!
  183. * RegBitRate (bits/sec)
  184. */
  185. #define RF_BITRATEMSB_1200_BPS 0x68
  186. #define RF_BITRATELSB_1200_BPS 0x2B
  187. #define RF_BITRATEMSB_2400_BPS 0x34
  188. #define RF_BITRATELSB_2400_BPS 0x15
  189. #define RF_BITRATEMSB_4800_BPS 0x1A // Default
  190. #define RF_BITRATELSB_4800_BPS 0x0B // Default
  191. #define RF_BITRATEMSB_9600_BPS 0x0D
  192. #define RF_BITRATELSB_9600_BPS 0x05
  193. #define RF_BITRATEMSB_15000_BPS 0x08
  194. #define RF_BITRATELSB_15000_BPS 0x55
  195. #define RF_BITRATEMSB_19200_BPS 0x06
  196. #define RF_BITRATELSB_19200_BPS 0x83
  197. #define RF_BITRATEMSB_38400_BPS 0x03
  198. #define RF_BITRATELSB_38400_BPS 0x41
  199. #define RF_BITRATEMSB_76800_BPS 0x01
  200. #define RF_BITRATELSB_76800_BPS 0xA1
  201. #define RF_BITRATEMSB_153600_BPS 0x00
  202. #define RF_BITRATELSB_153600_BPS 0xD0
  203. #define RF_BITRATEMSB_57600_BPS 0x02
  204. #define RF_BITRATELSB_57600_BPS 0x2C
  205. #define RF_BITRATEMSB_115200_BPS 0x01
  206. #define RF_BITRATELSB_115200_BPS 0x16
  207. #define RF_BITRATEMSB_12500_BPS 0x0A
  208. #define RF_BITRATELSB_12500_BPS 0x00
  209. #define RF_BITRATEMSB_25000_BPS 0x05
  210. #define RF_BITRATELSB_25000_BPS 0x00
  211. #define RF_BITRATEMSB_50000_BPS 0x02
  212. #define RF_BITRATELSB_50000_BPS 0x80
  213. #define RF_BITRATEMSB_100000_BPS 0x01
  214. #define RF_BITRATELSB_100000_BPS 0x40
  215. #define RF_BITRATEMSB_150000_BPS 0x00
  216. #define RF_BITRATELSB_150000_BPS 0xD5
  217. #define RF_BITRATEMSB_200000_BPS 0x00
  218. #define RF_BITRATELSB_200000_BPS 0xA0
  219. #define RF_BITRATEMSB_250000_BPS 0x00
  220. #define RF_BITRATELSB_250000_BPS 0x80
  221. #define RF_BITRATEMSB_32768_BPS 0x03
  222. #define RF_BITRATELSB_32768_BPS 0xD1
  223. /*!
  224. * RegFdev (Hz)
  225. */
  226. #define RF_FDEVMSB_BANDREG_MASK 0x3F
  227. #define RF_FDEVMSB_BANDREG_AUTO 0x00 // Default
  228. #define RF_FDEVMSB_BANDREG_DIV_BY_1 0x40
  229. #define RF_FDEVMSB_BANDREG_DIV_BY_2 0x80
  230. #define RF_FDEVMSB_BANDREG_DIV_BY_6 0xC0
  231. #define RF_FDEVMSB_FDEV_MASK 0xC0
  232. #define RF_FDEVMSB_2000_HZ 0x00
  233. #define RF_FDEVLSB_2000_HZ 0x21
  234. #define RF_FDEVMSB_5000_HZ 0x00 // Default
  235. #define RF_FDEVLSB_5000_HZ 0x52 // Default
  236. #define RF_FDEVMSB_10000_HZ 0x00
  237. #define RF_FDEVLSB_10000_HZ 0xA4
  238. #define RF_FDEVMSB_15000_HZ 0x00
  239. #define RF_FDEVLSB_15000_HZ 0xF6
  240. #define RF_FDEVMSB_20000_HZ 0x01
  241. #define RF_FDEVLSB_20000_HZ 0x48
  242. #define RF_FDEVMSB_25000_HZ 0x01
  243. #define RF_FDEVLSB_25000_HZ 0x9A
  244. #define RF_FDEVMSB_30000_HZ 0x01
  245. #define RF_FDEVLSB_30000_HZ 0xEC
  246. #define RF_FDEVMSB_35000_HZ 0x02
  247. #define RF_FDEVLSB_35000_HZ 0x3D
  248. #define RF_FDEVMSB_40000_HZ 0x02
  249. #define RF_FDEVLSB_40000_HZ 0x8F
  250. #define RF_FDEVMSB_45000_HZ 0x02
  251. #define RF_FDEVLSB_45000_HZ 0xE1
  252. #define RF_FDEVMSB_50000_HZ 0x03
  253. #define RF_FDEVLSB_50000_HZ 0x33
  254. #define RF_FDEVMSB_55000_HZ 0x03
  255. #define RF_FDEVLSB_55000_HZ 0x85
  256. #define RF_FDEVMSB_60000_HZ 0x03
  257. #define RF_FDEVLSB_60000_HZ 0xD7
  258. #define RF_FDEVMSB_65000_HZ 0x04
  259. #define RF_FDEVLSB_65000_HZ 0x29
  260. #define RF_FDEVMSB_70000_HZ 0x04
  261. #define RF_FDEVLSB_70000_HZ 0x7B
  262. #define RF_FDEVMSB_75000_HZ 0x04
  263. #define RF_FDEVLSB_75000_HZ 0xCD
  264. #define RF_FDEVMSB_80000_HZ 0x05
  265. #define RF_FDEVLSB_80000_HZ 0x1F
  266. #define RF_FDEVMSB_85000_HZ 0x05
  267. #define RF_FDEVLSB_85000_HZ 0x71
  268. #define RF_FDEVMSB_90000_HZ 0x05
  269. #define RF_FDEVLSB_90000_HZ 0xC3
  270. #define RF_FDEVMSB_95000_HZ 0x06
  271. #define RF_FDEVLSB_95000_HZ 0x14
  272. #define RF_FDEVMSB_100000_HZ 0x06
  273. #define RF_FDEVLSB_100000_HZ 0x66
  274. #define RF_FDEVMSB_110000_HZ 0x07
  275. #define RF_FDEVLSB_110000_HZ 0x0A
  276. #define RF_FDEVMSB_120000_HZ 0x07
  277. #define RF_FDEVLSB_120000_HZ 0xAE
  278. #define RF_FDEVMSB_130000_HZ 0x08
  279. #define RF_FDEVLSB_130000_HZ 0x52
  280. #define RF_FDEVMSB_140000_HZ 0x08
  281. #define RF_FDEVLSB_140000_HZ 0xF6
  282. #define RF_FDEVMSB_150000_HZ 0x09
  283. #define RF_FDEVLSB_150000_HZ 0x9A
  284. #define RF_FDEVMSB_160000_HZ 0x0A
  285. #define RF_FDEVLSB_160000_HZ 0x3D
  286. #define RF_FDEVMSB_170000_HZ 0x0A
  287. #define RF_FDEVLSB_170000_HZ 0xE1
  288. #define RF_FDEVMSB_180000_HZ 0x0B
  289. #define RF_FDEVLSB_180000_HZ 0x85
  290. #define RF_FDEVMSB_190000_HZ 0x0C
  291. #define RF_FDEVLSB_190000_HZ 0x29
  292. #define RF_FDEVMSB_200000_HZ 0x0C
  293. #define RF_FDEVLSB_200000_HZ 0xCD
  294. /*!
  295. * RegFrf (MHz)
  296. */
  297. #define RF_FRFMSB_863_MHZ 0xD7
  298. #define RF_FRFMID_863_MHZ 0xC0
  299. #define RF_FRFLSB_863_MHZ 0x00
  300. #define RF_FRFMSB_864_MHZ 0xD8
  301. #define RF_FRFMID_864_MHZ 0x00
  302. #define RF_FRFLSB_864_MHZ 0x00
  303. #define RF_FRFMSB_865_MHZ 0xD8
  304. #define RF_FRFMID_865_MHZ 0x40
  305. #define RF_FRFLSB_865_MHZ 0x00
  306. #define RF_FRFMSB_866_MHZ 0xD8
  307. #define RF_FRFMID_866_MHZ 0x80
  308. #define RF_FRFLSB_866_MHZ 0x00
  309. #define RF_FRFMSB_867_MHZ 0xD8
  310. #define RF_FRFMID_867_MHZ 0xC0
  311. #define RF_FRFLSB_867_MHZ 0x00
  312. #define RF_FRFMSB_868_MHZ 0xD9
  313. #define RF_FRFMID_868_MHZ 0x00
  314. #define RF_FRFLSB_868_MHZ 0x00
  315. #define RF_FRFMSB_869_MHZ 0xD9
  316. #define RF_FRFMID_869_MHZ 0x40
  317. #define RF_FRFLSB_869_MHZ 0x00
  318. #define RF_FRFMSB_870_MHZ 0xD9
  319. #define RF_FRFMID_870_MHZ 0x80
  320. #define RF_FRFLSB_870_MHZ 0x00
  321. #define RF_FRFMSB_902_MHZ 0xE1
  322. #define RF_FRFMID_902_MHZ 0x80
  323. #define RF_FRFLSB_902_MHZ 0x00
  324. #define RF_FRFMSB_903_MHZ 0xE1
  325. #define RF_FRFMID_903_MHZ 0xC0
  326. #define RF_FRFLSB_903_MHZ 0x00
  327. #define RF_FRFMSB_904_MHZ 0xE2
  328. #define RF_FRFMID_904_MHZ 0x00
  329. #define RF_FRFLSB_904_MHZ 0x00
  330. #define RF_FRFMSB_905_MHZ 0xE2
  331. #define RF_FRFMID_905_MHZ 0x40
  332. #define RF_FRFLSB_905_MHZ 0x00
  333. #define RF_FRFMSB_906_MHZ 0xE2
  334. #define RF_FRFMID_906_MHZ 0x80
  335. #define RF_FRFLSB_906_MHZ 0x00
  336. #define RF_FRFMSB_907_MHZ 0xE2
  337. #define RF_FRFMID_907_MHZ 0xC0
  338. #define RF_FRFLSB_907_MHZ 0x00
  339. #define RF_FRFMSB_908_MHZ 0xE3
  340. #define RF_FRFMID_908_MHZ 0x00
  341. #define RF_FRFLSB_908_MHZ 0x00
  342. #define RF_FRFMSB_909_MHZ 0xE3
  343. #define RF_FRFMID_909_MHZ 0x40
  344. #define RF_FRFLSB_909_MHZ 0x00
  345. #define RF_FRFMSB_910_MHZ 0xE3
  346. #define RF_FRFMID_910_MHZ 0x80
  347. #define RF_FRFLSB_910_MHZ 0x00
  348. #define RF_FRFMSB_911_MHZ 0xE3
  349. #define RF_FRFMID_911_MHZ 0xC0
  350. #define RF_FRFLSB_911_MHZ 0x00
  351. #define RF_FRFMSB_912_MHZ 0xE4
  352. #define RF_FRFMID_912_MHZ 0x00
  353. #define RF_FRFLSB_912_MHZ 0x00
  354. #define RF_FRFMSB_913_MHZ 0xE4
  355. #define RF_FRFMID_913_MHZ 0x40
  356. #define RF_FRFLSB_913_MHZ 0x00
  357. #define RF_FRFMSB_914_MHZ 0xE4
  358. #define RF_FRFMID_914_MHZ 0x80
  359. #define RF_FRFLSB_914_MHZ 0x00
  360. #define RF_FRFMSB_915_MHZ 0xE4 // Default
  361. #define RF_FRFMID_915_MHZ 0xC0 // Default
  362. #define RF_FRFLSB_915_MHZ 0x00 // Default
  363. #define RF_FRFMSB_916_MHZ 0xE5
  364. #define RF_FRFMID_916_MHZ 0x00
  365. #define RF_FRFLSB_916_MHZ 0x00
  366. #define RF_FRFMSB_917_MHZ 0xE5
  367. #define RF_FRFMID_917_MHZ 0x40
  368. #define RF_FRFLSB_917_MHZ 0x00
  369. #define RF_FRFMSB_918_MHZ 0xE5
  370. #define RF_FRFMID_918_MHZ 0x80
  371. #define RF_FRFLSB_918_MHZ 0x00
  372. #define RF_FRFMSB_919_MHZ 0xE5
  373. #define RF_FRFMID_919_MHZ 0xC0
  374. #define RF_FRFLSB_919_MHZ 0x00
  375. #define RF_FRFMSB_920_MHZ 0xE6
  376. #define RF_FRFMID_920_MHZ 0x00
  377. #define RF_FRFLSB_920_MHZ 0x00
  378. #define RF_FRFMSB_921_MHZ 0xE6
  379. #define RF_FRFMID_921_MHZ 0x40
  380. #define RF_FRFLSB_921_MHZ 0x00
  381. #define RF_FRFMSB_922_MHZ 0xE6
  382. #define RF_FRFMID_922_MHZ 0x80
  383. #define RF_FRFLSB_922_MHZ 0x00
  384. #define RF_FRFMSB_923_MHZ 0xE6
  385. #define RF_FRFMID_923_MHZ 0xC0
  386. #define RF_FRFLSB_923_MHZ 0x00
  387. #define RF_FRFMSB_924_MHZ 0xE7
  388. #define RF_FRFMID_924_MHZ 0x00
  389. #define RF_FRFLSB_924_MHZ 0x00
  390. #define RF_FRFMSB_925_MHZ 0xE7
  391. #define RF_FRFMID_925_MHZ 0x40
  392. #define RF_FRFLSB_925_MHZ 0x00
  393. #define RF_FRFMSB_926_MHZ 0xE7
  394. #define RF_FRFMID_926_MHZ 0x80
  395. #define RF_FRFLSB_926_MHZ 0x00
  396. #define RF_FRFMSB_927_MHZ 0xE7
  397. #define RF_FRFMID_927_MHZ 0xC0
  398. #define RF_FRFLSB_927_MHZ 0x00
  399. #define RF_FRFMSB_928_MHZ 0xE8
  400. #define RF_FRFMID_928_MHZ 0x00
  401. #define RF_FRFLSB_928_MHZ 0x00
  402. /*!
  403. * RegPaConfig
  404. */
  405. #define RF_PACONFIG_PASELECT_MASK 0x7F
  406. #define RF_PACONFIG_PASELECT_PABOOST 0x80
  407. #define RF_PACONFIG_PASELECT_RFO 0x00 // Default
  408. #define RF_PACONFIG_MAX_POWER_MASK 0x8F
  409. #define RF_PACONFIG_OUTPUTPOWER_MASK 0xF0
  410. /*!
  411. * RegPaRamp
  412. */
  413. #define RF_PARAMP_MODULATIONSHAPING_MASK 0x9F
  414. #define RF_PARAMP_MODULATIONSHAPING_00 0x00 // Default
  415. #define RF_PARAMP_MODULATIONSHAPING_01 0x20
  416. #define RF_PARAMP_MODULATIONSHAPING_10 0x40
  417. #define RF_PARAMP_MODULATIONSHAPING_11 0x60
  418. #define RF_PARAMP_TXBANDFORCE_MASK 0xEF
  419. #define RF_PARAMP_TXBANDFORCE_BAND_SEL 0x10
  420. #define RF_PARAMP_TXBANDFORCE_AUTO 0x00 // Default
  421. #define RF_PARAMP_MASK 0xF0
  422. #define RF_PARAMP_3400_US 0x00
  423. #define RF_PARAMP_2000_US 0x01
  424. #define RF_PARAMP_1000_US 0x02
  425. #define RF_PARAMP_0500_US 0x03
  426. #define RF_PARAMP_0250_US 0x04
  427. #define RF_PARAMP_0125_US 0x05
  428. #define RF_PARAMP_0100_US 0x06
  429. #define RF_PARAMP_0062_US 0x07
  430. #define RF_PARAMP_0050_US 0x08
  431. #define RF_PARAMP_0040_US 0x09 // Default
  432. #define RF_PARAMP_0031_US 0x0A
  433. #define RF_PARAMP_0025_US 0x0B
  434. #define RF_PARAMP_0020_US 0x0C
  435. #define RF_PARAMP_0015_US 0x0D
  436. #define RF_PARAMP_0012_US 0x0E
  437. #define RF_PARAMP_0010_US 0x0F
  438. /*!
  439. * RegOcp
  440. */
  441. #define RF_OCP_MASK 0xDF
  442. #define RF_OCP_ON 0x20 // Default
  443. #define RF_OCP_OFF 0x00
  444. #define RF_OCP_TRIM_MASK 0xE0
  445. #define RF_OCP_TRIM_045_MA 0x00
  446. #define RF_OCP_TRIM_050_MA 0x01
  447. #define RF_OCP_TRIM_055_MA 0x02
  448. #define RF_OCP_TRIM_060_MA 0x03
  449. #define RF_OCP_TRIM_065_MA 0x04
  450. #define RF_OCP_TRIM_070_MA 0x05
  451. #define RF_OCP_TRIM_075_MA 0x06
  452. #define RF_OCP_TRIM_080_MA 0x07
  453. #define RF_OCP_TRIM_085_MA 0x08
  454. #define RF_OCP_TRIM_090_MA 0x09
  455. #define RF_OCP_TRIM_095_MA 0x0A
  456. #define RF_OCP_TRIM_100_MA 0x0B // Default
  457. #define RF_OCP_TRIM_105_MA 0x0C
  458. #define RF_OCP_TRIM_110_MA 0x0D
  459. #define RF_OCP_TRIM_115_MA 0x0E
  460. #define RF_OCP_TRIM_120_MA 0x0F
  461. #define RF_OCP_TRIM_130_MA 0x10
  462. #define RF_OCP_TRIM_140_MA 0x11
  463. #define RF_OCP_TRIM_150_MA 0x12
  464. #define RF_OCP_TRIM_160_MA 0x13
  465. #define RF_OCP_TRIM_170_MA 0x14
  466. #define RF_OCP_TRIM_180_MA 0x15
  467. #define RF_OCP_TRIM_190_MA 0x16
  468. #define RF_OCP_TRIM_200_MA 0x17
  469. #define RF_OCP_TRIM_210_MA 0x18
  470. #define RF_OCP_TRIM_220_MA 0x19
  471. #define RF_OCP_TRIM_230_MA 0x1A
  472. #define RF_OCP_TRIM_240_MA 0x1B
  473. /*!
  474. * RegLna
  475. */
  476. #define RF_LNA_GAIN_MASK 0x1F
  477. #define RF_LNA_GAIN_G1 0x20 // Default
  478. #define RF_LNA_GAIN_G2 0x40
  479. #define RF_LNA_GAIN_G3 0x60
  480. #define RF_LNA_GAIN_G4 0x80
  481. #define RF_LNA_GAIN_G5 0xA0
  482. #define RF_LNA_GAIN_G6 0xC0
  483. #define RF_LNA_BOOST_LF_MASK 0xE7
  484. #define RF_LNA_BOOST_LF_DEFAULT 0x00 // Default
  485. #define RF_LNA_BOOST_LF_GAIN 0x08
  486. #define RF_LNA_BOOST_LF_IP3 0x10
  487. #define RF_LNA_BOOST_LF_BOOST 0x18
  488. #define RF_LNA_RXBANDFORCE_MASK 0xFB
  489. #define RF_LNA_RXBANDFORCE_BAND_SEL 0x04
  490. #define RF_LNA_RXBANDFORCE_AUTO 0x00 // Default
  491. #define RF_LNA_BOOST_HF_MASK 0xFC
  492. #define RF_LNA_BOOST_HF_OFF 0x00 // Default
  493. #define RF_LNA_BOOST_HF_ON 0x03
  494. /*!
  495. * RegRxConfig
  496. */
  497. #define RF_RXCONFIG_RESTARTRXONCOLLISION_MASK 0x7F
  498. #define RF_RXCONFIG_RESTARTRXONCOLLISION_ON 0x80
  499. #define RF_RXCONFIG_RESTARTRXONCOLLISION_OFF 0x00 // Default
  500. #define RF_RXCONFIG_RESTARTRXWITHOUTPLLLOCK 0x40 // Write only
  501. #define RF_RXCONFIG_RESTARTRXWITHPLLLOCK 0x20 // Write only
  502. #define RF_RXCONFIG_AFCAUTO_MASK 0xEF
  503. #define RF_RXCONFIG_AFCAUTO_ON 0x10
  504. #define RF_RXCONFIG_AFCAUTO_OFF 0x00 // Default
  505. #define RF_RXCONFIG_AGCAUTO_MASK 0xF7
  506. #define RF_RXCONFIG_AGCAUTO_ON 0x08 // Default
  507. #define RF_RXCONFIG_AGCAUTO_OFF 0x00
  508. #define RF_RXCONFIG_RXTRIGER_MASK 0xF8
  509. #define RF_RXCONFIG_RXTRIGER_OFF 0x00
  510. #define RF_RXCONFIG_RXTRIGER_RSSI 0x01
  511. #define RF_RXCONFIG_RXTRIGER_PREAMBLEDETECT 0x06 // Default
  512. #define RF_RXCONFIG_RXTRIGER_RSSI_PREAMBLEDETECT 0x07
  513. /*!
  514. * RegRssiConfig
  515. */
  516. #define RF_RSSICONFIG_OFFSET_MASK 0x07
  517. #define RF_RSSICONFIG_OFFSET_P_00_DB 0x00 // Default
  518. #define RF_RSSICONFIG_OFFSET_P_01_DB 0x08
  519. #define RF_RSSICONFIG_OFFSET_P_02_DB 0x10
  520. #define RF_RSSICONFIG_OFFSET_P_03_DB 0x18
  521. #define RF_RSSICONFIG_OFFSET_P_04_DB 0x20
  522. #define RF_RSSICONFIG_OFFSET_P_05_DB 0x28
  523. #define RF_RSSICONFIG_OFFSET_P_06_DB 0x30
  524. #define RF_RSSICONFIG_OFFSET_P_07_DB 0x38
  525. #define RF_RSSICONFIG_OFFSET_P_08_DB 0x40
  526. #define RF_RSSICONFIG_OFFSET_P_09_DB 0x48
  527. #define RF_RSSICONFIG_OFFSET_P_10_DB 0x50
  528. #define RF_RSSICONFIG_OFFSET_P_11_DB 0x58
  529. #define RF_RSSICONFIG_OFFSET_P_12_DB 0x60
  530. #define RF_RSSICONFIG_OFFSET_P_13_DB 0x68
  531. #define RF_RSSICONFIG_OFFSET_P_14_DB 0x70
  532. #define RF_RSSICONFIG_OFFSET_P_15_DB 0x78
  533. #define RF_RSSICONFIG_OFFSET_M_16_DB 0x80
  534. #define RF_RSSICONFIG_OFFSET_M_15_DB 0x88
  535. #define RF_RSSICONFIG_OFFSET_M_14_DB 0x90
  536. #define RF_RSSICONFIG_OFFSET_M_13_DB 0x98
  537. #define RF_RSSICONFIG_OFFSET_M_12_DB 0xA0
  538. #define RF_RSSICONFIG_OFFSET_M_11_DB 0xA8
  539. #define RF_RSSICONFIG_OFFSET_M_10_DB 0xB0
  540. #define RF_RSSICONFIG_OFFSET_M_09_DB 0xB8
  541. #define RF_RSSICONFIG_OFFSET_M_08_DB 0xC0
  542. #define RF_RSSICONFIG_OFFSET_M_07_DB 0xC8
  543. #define RF_RSSICONFIG_OFFSET_M_06_DB 0xD0
  544. #define RF_RSSICONFIG_OFFSET_M_05_DB 0xD8
  545. #define RF_RSSICONFIG_OFFSET_M_04_DB 0xE0
  546. #define RF_RSSICONFIG_OFFSET_M_03_DB 0xE8
  547. #define RF_RSSICONFIG_OFFSET_M_02_DB 0xF0
  548. #define RF_RSSICONFIG_OFFSET_M_01_DB 0xF8
  549. #define RF_RSSICONFIG_SMOOTHING_MASK 0xF8
  550. #define RF_RSSICONFIG_SMOOTHING_2 0x00
  551. #define RF_RSSICONFIG_SMOOTHING_4 0x01
  552. #define RF_RSSICONFIG_SMOOTHING_8 0x02 // Default
  553. #define RF_RSSICONFIG_SMOOTHING_16 0x03
  554. #define RF_RSSICONFIG_SMOOTHING_32 0x04
  555. #define RF_RSSICONFIG_SMOOTHING_64 0x05
  556. #define RF_RSSICONFIG_SMOOTHING_128 0x06
  557. #define RF_RSSICONFIG_SMOOTHING_256 0x07
  558. /*!
  559. * RegRssiCollision
  560. */
  561. #define RF_RSSICOLISION_THRESHOLD 0x0A // Default
  562. /*!
  563. * RegRssiThresh
  564. */
  565. #define RF_RSSITHRESH_THRESHOLD 0xFF // Default
  566. /*!
  567. * RegRssiValue (Read Only)
  568. */
  569. /*!
  570. * RegRxBw
  571. */
  572. #define RF_RXBW_MANT_MASK 0xE7
  573. #define RF_RXBW_MANT_16 0x00
  574. #define RF_RXBW_MANT_20 0x08
  575. #define RF_RXBW_MANT_24 0x10 // Default
  576. #define RF_RXBW_EXP_MASK 0xF8
  577. #define RF_RXBW_EXP_0 0x00
  578. #define RF_RXBW_EXP_1 0x01
  579. #define RF_RXBW_EXP_2 0x02
  580. #define RF_RXBW_EXP_3 0x03
  581. #define RF_RXBW_EXP_4 0x04
  582. #define RF_RXBW_EXP_5 0x05 // Default
  583. #define RF_RXBW_EXP_6 0x06
  584. #define RF_RXBW_EXP_7 0x07
  585. /*!
  586. * RegAfcBw
  587. */
  588. #define RF_AFCBW_MANTAFC_MASK 0xE7
  589. #define RF_AFCBW_MANTAFC_16 0x00
  590. #define RF_AFCBW_MANTAFC_20 0x08 // Default
  591. #define RF_AFCBW_MANTAFC_24 0x10
  592. #define RF_AFCBW_EXPAFC_MASK 0xF8
  593. #define RF_AFCBW_EXPAFC_0 0x00
  594. #define RF_AFCBW_EXPAFC_1 0x01
  595. #define RF_AFCBW_EXPAFC_2 0x02
  596. #define RF_AFCBW_EXPAFC_3 0x03 // Default
  597. #define RF_AFCBW_EXPAFC_4 0x04
  598. #define RF_AFCBW_EXPAFC_5 0x05
  599. #define RF_AFCBW_EXPAFC_6 0x06
  600. #define RF_AFCBW_EXPAFC_7 0x07
  601. /*!
  602. * RegOokPeak
  603. */
  604. #define RF_OOKPEAK_BITSYNC_MASK 0xDF // Default
  605. #define RF_OOKPEAK_BITSYNC_ON 0x20 // Default
  606. #define RF_OOKPEAK_BITSYNC_OFF 0x00
  607. #define RF_OOKPEAK_OOKTHRESHTYPE_MASK 0xE7
  608. #define RF_OOKPEAK_OOKTHRESHTYPE_FIXED 0x00
  609. #define RF_OOKPEAK_OOKTHRESHTYPE_PEAK 0x08 // Default
  610. #define RF_OOKPEAK_OOKTHRESHTYPE_AVERAGE 0x10
  611. #define RF_OOKPEAK_OOKPEAKTHRESHSTEP_MASK 0xF8
  612. #define RF_OOKPEAK_OOKPEAKTHRESHSTEP_0_5_DB 0x00 // Default
  613. #define RF_OOKPEAK_OOKPEAKTHRESHSTEP_1_0_DB 0x01
  614. #define RF_OOKPEAK_OOKPEAKTHRESHSTEP_1_5_DB 0x02
  615. #define RF_OOKPEAK_OOKPEAKTHRESHSTEP_2_0_DB 0x03
  616. #define RF_OOKPEAK_OOKPEAKTHRESHSTEP_3_0_DB 0x04
  617. #define RF_OOKPEAK_OOKPEAKTHRESHSTEP_4_0_DB 0x05
  618. #define RF_OOKPEAK_OOKPEAKTHRESHSTEP_5_0_DB 0x06
  619. #define RF_OOKPEAK_OOKPEAKTHRESHSTEP_6_0_DB 0x07
  620. /*!
  621. * RegOokFix
  622. */
  623. #define RF_OOKFIX_OOKFIXEDTHRESHOLD 0x0C // Default
  624. /*!
  625. * RegOokAvg
  626. */
  627. #define RF_OOKAVG_OOKPEAKTHRESHDEC_MASK 0x1F
  628. #define RF_OOKAVG_OOKPEAKTHRESHDEC_000 0x00 // Default
  629. #define RF_OOKAVG_OOKPEAKTHRESHDEC_001 0x20
  630. #define RF_OOKAVG_OOKPEAKTHRESHDEC_010 0x40
  631. #define RF_OOKAVG_OOKPEAKTHRESHDEC_011 0x60
  632. #define RF_OOKAVG_OOKPEAKTHRESHDEC_100 0x80
  633. #define RF_OOKAVG_OOKPEAKTHRESHDEC_101 0xA0
  634. #define RF_OOKAVG_OOKPEAKTHRESHDEC_110 0xC0
  635. #define RF_OOKAVG_OOKPEAKTHRESHDEC_111 0xE0
  636. #define RF_OOKAVG_AVERAGEOFFSET_MASK 0xF3
  637. #define RF_OOKAVG_AVERAGEOFFSET_0_DB 0x00 // Default
  638. #define RF_OOKAVG_AVERAGEOFFSET_2_DB 0x04
  639. #define RF_OOKAVG_AVERAGEOFFSET_4_DB 0x08
  640. #define RF_OOKAVG_AVERAGEOFFSET_6_DB 0x0C
  641. #define RF_OOKAVG_OOKAVERAGETHRESHFILT_MASK 0xFC
  642. #define RF_OOKAVG_OOKAVERAGETHRESHFILT_00 0x00
  643. #define RF_OOKAVG_OOKAVERAGETHRESHFILT_01 0x01
  644. #define RF_OOKAVG_OOKAVERAGETHRESHFILT_10 0x02 // Default
  645. #define RF_OOKAVG_OOKAVERAGETHRESHFILT_11 0x03
  646. /*!
  647. * RegAfcFei
  648. */
  649. #define RF_AFCFEI_AGCSTART 0x10
  650. #define RF_AFCFEI_AFCCLEAR 0x02
  651. #define RF_AFCFEI_AFCAUTOCLEAR_MASK 0xFE
  652. #define RF_AFCFEI_AFCAUTOCLEAR_ON 0x01
  653. #define RF_AFCFEI_AFCAUTOCLEAR_OFF 0x00 // Default
  654. /*!
  655. * RegAfcMsb (Read Only)
  656. */
  657. /*!
  658. * RegAfcLsb (Read Only)
  659. */
  660. /*!
  661. * RegFeiMsb (Read Only)
  662. */
  663. /*!
  664. * RegFeiLsb (Read Only)
  665. */
  666. /*!
  667. * RegPreambleDetect
  668. */
  669. #define RF_PREAMBLEDETECT_DETECTOR_MASK 0x7F
  670. #define RF_PREAMBLEDETECT_DETECTOR_ON 0x80 // Default
  671. #define RF_PREAMBLEDETECT_DETECTOR_OFF 0x00
  672. #define RF_PREAMBLEDETECT_DETECTORSIZE_MASK 0x9F
  673. #define RF_PREAMBLEDETECT_DETECTORSIZE_1 0x00
  674. #define RF_PREAMBLEDETECT_DETECTORSIZE_2 0x20 // Default
  675. #define RF_PREAMBLEDETECT_DETECTORSIZE_3 0x40
  676. #define RF_PREAMBLEDETECT_DETECTORSIZE_4 0x60
  677. #define RF_PREAMBLEDETECT_DETECTORTOL_MASK 0xE0
  678. #define RF_PREAMBLEDETECT_DETECTORTOL_0 0x00
  679. #define RF_PREAMBLEDETECT_DETECTORTOL_1 0x01
  680. #define RF_PREAMBLEDETECT_DETECTORTOL_2 0x02
  681. #define RF_PREAMBLEDETECT_DETECTORTOL_3 0x03
  682. #define RF_PREAMBLEDETECT_DETECTORTOL_4 0x04
  683. #define RF_PREAMBLEDETECT_DETECTORTOL_5 0x05
  684. #define RF_PREAMBLEDETECT_DETECTORTOL_6 0x06
  685. #define RF_PREAMBLEDETECT_DETECTORTOL_7 0x07
  686. #define RF_PREAMBLEDETECT_DETECTORTOL_8 0x08
  687. #define RF_PREAMBLEDETECT_DETECTORTOL_9 0x09
  688. #define RF_PREAMBLEDETECT_DETECTORTOL_10 0x0A // Default
  689. #define RF_PREAMBLEDETECT_DETECTORTOL_11 0x0B
  690. #define RF_PREAMBLEDETECT_DETECTORTOL_12 0x0C
  691. #define RF_PREAMBLEDETECT_DETECTORTOL_13 0x0D
  692. #define RF_PREAMBLEDETECT_DETECTORTOL_14 0x0E
  693. #define RF_PREAMBLEDETECT_DETECTORTOL_15 0x0F
  694. #define RF_PREAMBLEDETECT_DETECTORTOL_16 0x10
  695. #define RF_PREAMBLEDETECT_DETECTORTOL_17 0x11
  696. #define RF_PREAMBLEDETECT_DETECTORTOL_18 0x12
  697. #define RF_PREAMBLEDETECT_DETECTORTOL_19 0x13
  698. #define RF_PREAMBLEDETECT_DETECTORTOL_20 0x14
  699. #define RF_PREAMBLEDETECT_DETECTORTOL_21 0x15
  700. #define RF_PREAMBLEDETECT_DETECTORTOL_22 0x16
  701. #define RF_PREAMBLEDETECT_DETECTORTOL_23 0x17
  702. #define RF_PREAMBLEDETECT_DETECTORTOL_24 0x18
  703. #define RF_PREAMBLEDETECT_DETECTORTOL_25 0x19
  704. #define RF_PREAMBLEDETECT_DETECTORTOL_26 0x1A
  705. #define RF_PREAMBLEDETECT_DETECTORTOL_27 0x1B
  706. #define RF_PREAMBLEDETECT_DETECTORTOL_28 0x1C
  707. #define RF_PREAMBLEDETECT_DETECTORTOL_29 0x1D
  708. #define RF_PREAMBLEDETECT_DETECTORTOL_30 0x1E
  709. #define RF_PREAMBLEDETECT_DETECTORTOL_31 0x1F
  710. /*!
  711. * RegRxTimeout1
  712. */
  713. #define RF_RXTIMEOUT1_TIMEOUTRXRSSI 0x00 // Default
  714. /*!
  715. * RegRxTimeout2
  716. */
  717. #define RF_RXTIMEOUT2_TIMEOUTRXPREAMBLE 0x00 // Default
  718. /*!
  719. * RegRxTimeout3
  720. */
  721. #define RF_RXTIMEOUT3_TIMEOUTSIGNALSYNC 0x00 // Default
  722. /*!
  723. * RegRxDelay
  724. */
  725. #define RF_RXDELAY_INTERPACKETRXDELAY 0x00 // Default
  726. /*!
  727. * RegOsc
  728. */
  729. #define RF_OSC_RCCALSTART 0x08
  730. #define RF_OSC_CLKOUT_MASK 0xF8
  731. #define RF_OSC_CLKOUT_32_MHZ 0x00
  732. #define RF_OSC_CLKOUT_16_MHZ 0x01
  733. #define RF_OSC_CLKOUT_8_MHZ 0x02
  734. #define RF_OSC_CLKOUT_4_MHZ 0x03
  735. #define RF_OSC_CLKOUT_2_MHZ 0x04
  736. #define RF_OSC_CLKOUT_1_MHZ 0x05 // Default
  737. #define RF_OSC_CLKOUT_RC 0x06
  738. #define RF_OSC_CLKOUT_OFF 0x07
  739. /*!
  740. * RegPreambleMsb/RegPreambleLsb
  741. */
  742. #define RF_PREAMBLEMSB_SIZE 0x00 // Default
  743. #define RF_PREAMBLELSB_SIZE 0x03 // Default
  744. /*!
  745. * RegSyncConfig
  746. */
  747. #define RF_SYNCCONFIG_AUTORESTARTRXMODE_MASK 0x3F
  748. #define RF_SYNCCONFIG_AUTORESTARTRXMODE_WAITPLL_ON 0x80 // Default
  749. #define RF_SYNCCONFIG_AUTORESTARTRXMODE_WAITPLL_OFF 0x40
  750. #define RF_SYNCCONFIG_AUTORESTARTRXMODE_OFF 0x00
  751. #define RF_SYNCCONFIG_PREAMBLEPOLARITY_MASK 0xDF
  752. #define RF_SYNCCONFIG_PREAMBLEPOLARITY_55 0x20
  753. #define RF_SYNCCONFIG_PREAMBLEPOLARITY_AA 0x00 // Default
  754. #define RF_SYNCCONFIG_SYNC_MASK 0xEF
  755. #define RF_SYNCCONFIG_SYNC_ON 0x10 // Default
  756. #define RF_SYNCCONFIG_SYNC_OFF 0x00
  757. #define RF_SYNCCONFIG_SYNCSIZE_MASK 0xF8
  758. #define RF_SYNCCONFIG_SYNCSIZE_1 0x00
  759. #define RF_SYNCCONFIG_SYNCSIZE_2 0x01
  760. #define RF_SYNCCONFIG_SYNCSIZE_3 0x02
  761. #define RF_SYNCCONFIG_SYNCSIZE_4 0x03 // Default
  762. #define RF_SYNCCONFIG_SYNCSIZE_5 0x04
  763. #define RF_SYNCCONFIG_SYNCSIZE_6 0x05
  764. #define RF_SYNCCONFIG_SYNCSIZE_7 0x06
  765. #define RF_SYNCCONFIG_SYNCSIZE_8 0x07
  766. /*!
  767. * RegSyncValue1-8
  768. */
  769. #define RF_SYNCVALUE1_SYNCVALUE 0x01 // Default
  770. #define RF_SYNCVALUE2_SYNCVALUE 0x01 // Default
  771. #define RF_SYNCVALUE3_SYNCVALUE 0x01 // Default
  772. #define RF_SYNCVALUE4_SYNCVALUE 0x01 // Default
  773. #define RF_SYNCVALUE5_SYNCVALUE 0x01 // Default
  774. #define RF_SYNCVALUE6_SYNCVALUE 0x01 // Default
  775. #define RF_SYNCVALUE7_SYNCVALUE 0x01 // Default
  776. #define RF_SYNCVALUE8_SYNCVALUE 0x01 // Default
  777. /*!
  778. * RegPacketConfig1
  779. */
  780. #define RF_PACKETCONFIG1_PACKETFORMAT_MASK 0x7F
  781. #define RF_PACKETCONFIG1_PACKETFORMAT_FIXED 0x00
  782. #define RF_PACKETCONFIG1_PACKETFORMAT_VARIABLE 0x80 // Default
  783. #define RF_PACKETCONFIG1_DCFREE_MASK 0x9F
  784. #define RF_PACKETCONFIG1_DCFREE_OFF 0x00 // Default
  785. #define RF_PACKETCONFIG1_DCFREE_MANCHESTER 0x20
  786. #define RF_PACKETCONFIG1_DCFREE_WHITENING 0x40
  787. #define RF_PACKETCONFIG1_CRC_MASK 0xEF
  788. #define RF_PACKETCONFIG1_CRC_ON 0x10 // Default
  789. #define RF_PACKETCONFIG1_CRC_OFF 0x00
  790. #define RF_PACKETCONFIG1_CRCAUTOCLEAR_MASK 0xF7
  791. #define RF_PACKETCONFIG1_CRCAUTOCLEAR_ON 0x00 // Default
  792. #define RF_PACKETCONFIG1_CRCAUTOCLEAR_OFF 0x08
  793. #define RF_PACKETCONFIG1_ADDRSFILTERING_MASK 0xF9
  794. #define RF_PACKETCONFIG1_ADDRSFILTERING_OFF 0x00 // Default
  795. #define RF_PACKETCONFIG1_ADDRSFILTERING_NODE 0x02
  796. #define RF_PACKETCONFIG1_ADDRSFILTERING_NODEBROADCAST 0x04
  797. #define RF_PACKETCONFIG1_CRCWHITENINGTYPE_MASK 0xFE
  798. #define RF_PACKETCONFIG1_CRCWHITENINGTYPE_CCITT 0x00 // Default
  799. #define RF_PACKETCONFIG1_CRCWHITENINGTYPE_IBM 0x01
  800. /*!
  801. * RegPacketConfig2
  802. */
  803. #define RF_PACKETCONFIG2_WMBUS_CRC_ENABLE_MASK 0x7F
  804. #define RF_PACKETCONFIG2_WMBUS_CRC_ENABLE 0x80
  805. #define RF_PACKETCONFIG2_WMBUS_CRC_DISABLE 0x00 // Default
  806. #define RF_PACKETCONFIG2_DATAMODE_MASK 0xBF
  807. #define RF_PACKETCONFIG2_DATAMODE_CONTINUOUS 0x00
  808. #define RF_PACKETCONFIG2_DATAMODE_PACKET 0x40 // Default
  809. #define RF_PACKETCONFIG2_IOHOME_MASK 0xDF
  810. #define RF_PACKETCONFIG2_IOHOME_ON 0x20
  811. #define RF_PACKETCONFIG2_IOHOME_OFF 0x00 // Default
  812. #define RF_PACKETCONFIG2_BEACON_MASK 0xF7
  813. #define RF_PACKETCONFIG2_BEACON_ON 0x08
  814. #define RF_PACKETCONFIG2_BEACON_OFF 0x00 // Default
  815. #define RF_PACKETCONFIG2_PAYLOADLENGTH_MSB_MASK 0xF8
  816. /*!
  817. * RegPayloadLength
  818. */
  819. #define RF_PAYLOADLENGTH_LENGTH 0x40 // Default
  820. /*!
  821. * RegNodeAdrs
  822. */
  823. #define RF_NODEADDRESS_ADDRESS 0x00
  824. /*!
  825. * RegBroadcastAdrs
  826. */
  827. #define RF_BROADCASTADDRESS_ADDRESS 0x00
  828. /*!
  829. * RegFifoThresh
  830. */
  831. #define RF_FIFOTHRESH_TXSTARTCONDITION_MASK 0x7F
  832. #define RF_FIFOTHRESH_TXSTARTCONDITION_FIFOTHRESH 0x00 // Default
  833. #define RF_FIFOTHRESH_TXSTARTCONDITION_FIFONOTEMPTY 0x80
  834. #define RF_FIFOTHRESH_FIFOTHRESHOLD_MASK 0xC0
  835. #define RF_FIFOTHRESH_FIFOTHRESHOLD_THRESHOLD 0x0F // Default
  836. /*!
  837. * RegSeqConfig1
  838. */
  839. #define RF_SEQCONFIG1_SEQUENCER_START 0x80
  840. #define RF_SEQCONFIG1_SEQUENCER_STOP 0x40
  841. #define RF_SEQCONFIG1_IDLEMODE_MASK 0xDF
  842. #define RF_SEQCONFIG1_IDLEMODE_SLEEP 0x20
  843. #define RF_SEQCONFIG1_IDLEMODE_STANDBY 0x00 // Default
  844. #define RF_SEQCONFIG1_FROMSTART_MASK 0xE7
  845. #define RF_SEQCONFIG1_FROMSTART_TOLPS 0x00 // Default
  846. #define RF_SEQCONFIG1_FROMSTART_TORX 0x08
  847. #define RF_SEQCONFIG1_FROMSTART_TOTX 0x10
  848. #define RF_SEQCONFIG1_FROMSTART_TOTX_ONFIFOLEVEL 0x18
  849. #define RF_SEQCONFIG1_LPS_MASK 0xFB
  850. #define RF_SEQCONFIG1_LPS_SEQUENCER_OFF 0x00 // Default
  851. #define RF_SEQCONFIG1_LPS_IDLE 0x04
  852. #define RF_SEQCONFIG1_FROMIDLE_MASK 0xFD
  853. #define RF_SEQCONFIG1_FROMIDLE_TOTX 0x00 // Default
  854. #define RF_SEQCONFIG1_FROMIDLE_TORX 0x02
  855. #define RF_SEQCONFIG1_FROMTX_MASK 0xFE
  856. #define RF_SEQCONFIG1_FROMTX_TOLPS 0x00 // Default
  857. #define RF_SEQCONFIG1_FROMTX_TORX 0x01
  858. /*!
  859. * RegSeqConfig2
  860. */
  861. #define RF_SEQCONFIG2_FROMRX_MASK 0x1F
  862. #define RF_SEQCONFIG2_FROMRX_TOUNUSED_000 0x00 // Default
  863. #define RF_SEQCONFIG2_FROMRX_TORXPKT_ONPLDRDY 0x20
  864. #define RF_SEQCONFIG2_FROMRX_TOLPS_ONPLDRDY 0x40
  865. #define RF_SEQCONFIG2_FROMRX_TORXPKT_ONCRCOK 0x60
  866. #define RF_SEQCONFIG2_FROMRX_TOSEQUENCEROFF_ONRSSI 0x80
  867. #define RF_SEQCONFIG2_FROMRX_TOSEQUENCEROFF_ONSYNC 0xA0
  868. #define RF_SEQCONFIG2_FROMRX_TOSEQUENCEROFF_ONPREAMBLE 0xC0
  869. #define RF_SEQCONFIG2_FROMRX_TOUNUSED_111 0xE0
  870. #define RF_SEQCONFIG2_FROMRXTIMEOUT_MASK 0xE7
  871. #define RF_SEQCONFIG2_FROMRXTIMEOUT_TORXRESTART 0x00 // Default
  872. #define RF_SEQCONFIG2_FROMRXTIMEOUT_TOTX 0x08
  873. #define RF_SEQCONFIG2_FROMRXTIMEOUT_TOLPS 0x10
  874. #define RF_SEQCONFIG2_FROMRXTIMEOUT_TOSEQUENCEROFF 0x18
  875. #define RF_SEQCONFIG2_FROMRXPKT_MASK 0xF8
  876. #define RF_SEQCONFIG2_FROMRXPKT_TOSEQUENCEROFF 0x00 // Default
  877. #define RF_SEQCONFIG2_FROMRXPKT_TOTX_ONFIFOEMPTY 0x01
  878. #define RF_SEQCONFIG2_FROMRXPKT_TOLPS 0x02
  879. #define RF_SEQCONFIG2_FROMRXPKT_TOSYNTHESIZERRX 0x03
  880. #define RF_SEQCONFIG2_FROMRXPKT_TORX 0x04
  881. /*!
  882. * RegTimerResol
  883. */
  884. #define RF_TIMERRESOL_TIMER1RESOL_MASK 0xF3
  885. #define RF_TIMERRESOL_TIMER1RESOL_OFF 0x00 // Default
  886. #define RF_TIMERRESOL_TIMER1RESOL_000064_US 0x04
  887. #define RF_TIMERRESOL_TIMER1RESOL_004100_US 0x08
  888. #define RF_TIMERRESOL_TIMER1RESOL_262000_US 0x0C
  889. #define RF_TIMERRESOL_TIMER2RESOL_MASK 0xFC
  890. #define RF_TIMERRESOL_TIMER2RESOL_OFF 0x00 // Default
  891. #define RF_TIMERRESOL_TIMER2RESOL_000064_US 0x01
  892. #define RF_TIMERRESOL_TIMER2RESOL_004100_US 0x02
  893. #define RF_TIMERRESOL_TIMER2RESOL_262000_US 0x03
  894. /*!
  895. * RegTimer1Coef
  896. */
  897. #define RF_TIMER1COEF_TIMER1COEFFICIENT 0xF5 // Default
  898. /*!
  899. * RegTimer2Coef
  900. */
  901. #define RF_TIMER2COEF_TIMER2COEFFICIENT 0x20 // Default
  902. /*!
  903. * RegImageCal
  904. */
  905. #define RF_IMAGECAL_AUTOIMAGECAL_MASK 0x7F
  906. #define RF_IMAGECAL_AUTOIMAGECAL_ON 0x80
  907. #define RF_IMAGECAL_AUTOIMAGECAL_OFF 0x00 // Default
  908. #define RF_IMAGECAL_IMAGECAL_MASK 0xBF
  909. #define RF_IMAGECAL_IMAGECAL_START 0x40
  910. #define RF_IMAGECAL_IMAGECAL_RUNNING 0x20
  911. #define RF_IMAGECAL_IMAGECAL_DONE 0x00 // Default
  912. #define RF_IMAGECAL_TEMPCHANGE_HIGHER 0x08
  913. #define RF_IMAGECAL_TEMPCHANGE_LOWER 0x00
  914. #define RF_IMAGECAL_TEMPTHRESHOLD_MASK 0xF9
  915. #define RF_IMAGECAL_TEMPTHRESHOLD_05 0x00
  916. #define RF_IMAGECAL_TEMPTHRESHOLD_10 0x02 // Default
  917. #define RF_IMAGECAL_TEMPTHRESHOLD_15 0x04
  918. #define RF_IMAGECAL_TEMPTHRESHOLD_20 0x06
  919. #define RF_IMAGECAL_TEMPMONITOR_MASK 0xFE
  920. #define RF_IMAGECAL_TEMPMONITOR_ON 0x00 // Default
  921. #define RF_IMAGECAL_TEMPMONITOR_OFF 0x01
  922. /*!
  923. * RegTemp (Read Only)
  924. */
  925. /*!
  926. * RegLowBat
  927. */
  928. #define RF_LOWBAT_MASK 0xF7
  929. #define RF_LOWBAT_ON 0x08
  930. #define RF_LOWBAT_OFF 0x00 // Default
  931. #define RF_LOWBAT_TRIM_MASK 0xF8
  932. #define RF_LOWBAT_TRIM_1695 0x00
  933. #define RF_LOWBAT_TRIM_1764 0x01
  934. #define RF_LOWBAT_TRIM_1835 0x02 // Default
  935. #define RF_LOWBAT_TRIM_1905 0x03
  936. #define RF_LOWBAT_TRIM_1976 0x04
  937. #define RF_LOWBAT_TRIM_2045 0x05
  938. #define RF_LOWBAT_TRIM_2116 0x06
  939. #define RF_LOWBAT_TRIM_2185 0x07
  940. /*!
  941. * RegIrqFlags1
  942. */
  943. #define RF_IRQFLAGS1_MODEREADY 0x80
  944. #define RF_IRQFLAGS1_RXREADY 0x40
  945. #define RF_IRQFLAGS1_TXREADY 0x20
  946. #define RF_IRQFLAGS1_PLLLOCK 0x10
  947. #define RF_IRQFLAGS1_RSSI 0x08
  948. #define RF_IRQFLAGS1_TIMEOUT 0x04
  949. #define RF_IRQFLAGS1_PREAMBLEDETECT 0x02
  950. #define RF_IRQFLAGS1_SYNCADDRESSMATCH 0x01
  951. /*!
  952. * RegIrqFlags2
  953. */
  954. #define RF_IRQFLAGS2_FIFOFULL 0x80
  955. #define RF_IRQFLAGS2_FIFOEMPTY 0x40
  956. #define RF_IRQFLAGS2_FIFOLEVEL 0x20
  957. #define RF_IRQFLAGS2_FIFOOVERRUN 0x10
  958. #define RF_IRQFLAGS2_PACKETSENT 0x08
  959. #define RF_IRQFLAGS2_PAYLOADREADY 0x04
  960. #define RF_IRQFLAGS2_CRCOK 0x02
  961. #define RF_IRQFLAGS2_LOWBAT 0x01
  962. /*!
  963. * RegDioMapping1
  964. */
  965. #define RF_DIOMAPPING1_DIO0_MASK 0x3F
  966. #define RF_DIOMAPPING1_DIO0_00 0x00 // Default
  967. #define RF_DIOMAPPING1_DIO0_01 0x40
  968. #define RF_DIOMAPPING1_DIO0_10 0x80
  969. #define RF_DIOMAPPING1_DIO0_11 0xC0
  970. #define RF_DIOMAPPING1_DIO1_MASK 0xCF
  971. #define RF_DIOMAPPING1_DIO1_00 0x00 // Default
  972. #define RF_DIOMAPPING1_DIO1_01 0x10
  973. #define RF_DIOMAPPING1_DIO1_10 0x20
  974. #define RF_DIOMAPPING1_DIO1_11 0x30
  975. #define RF_DIOMAPPING1_DIO2_MASK 0xF3
  976. #define RF_DIOMAPPING1_DIO2_00 0x00 // Default
  977. #define RF_DIOMAPPING1_DIO2_01 0x04
  978. #define RF_DIOMAPPING1_DIO2_10 0x08
  979. #define RF_DIOMAPPING1_DIO2_11 0x0C
  980. #define RF_DIOMAPPING1_DIO3_MASK 0xFC
  981. #define RF_DIOMAPPING1_DIO3_00 0x00 // Default
  982. #define RF_DIOMAPPING1_DIO3_01 0x01
  983. #define RF_DIOMAPPING1_DIO3_10 0x02
  984. #define RF_DIOMAPPING1_DIO3_11 0x03
  985. /*!
  986. * RegDioMapping2
  987. */
  988. #define RF_DIOMAPPING2_DIO4_MASK 0x3F
  989. #define RF_DIOMAPPING2_DIO4_00 0x00 // Default
  990. #define RF_DIOMAPPING2_DIO4_01 0x40
  991. #define RF_DIOMAPPING2_DIO4_10 0x80
  992. #define RF_DIOMAPPING2_DIO4_11 0xC0
  993. #define RF_DIOMAPPING2_DIO5_MASK 0xCF
  994. #define RF_DIOMAPPING2_DIO5_00 0x00 // Default
  995. #define RF_DIOMAPPING2_DIO5_01 0x10
  996. #define RF_DIOMAPPING2_DIO5_10 0x20
  997. #define RF_DIOMAPPING2_DIO5_11 0x30
  998. #define RF_DIOMAPPING2_MAP_MASK 0xFE
  999. #define RF_DIOMAPPING2_MAP_PREAMBLEDETECT 0x01
  1000. #define RF_DIOMAPPING2_MAP_RSSI 0x00 // Default
  1001. /*!
  1002. * RegVersion (Read Only)
  1003. */
  1004. /*!
  1005. * RegAgcRef
  1006. */
  1007. /*!
  1008. * RegAgcThresh1
  1009. */
  1010. /*!
  1011. * RegAgcThresh2
  1012. */
  1013. /*!
  1014. * RegAgcThresh3
  1015. */
  1016. /*!
  1017. * RegPllHop
  1018. */
  1019. #define RF_PLLHOP_FASTHOP_MASK 0x7F
  1020. #define RF_PLLHOP_FASTHOP_ON 0x80
  1021. #define RF_PLLHOP_FASTHOP_OFF 0x00 // Default
  1022. /*!
  1023. * RegTcxo
  1024. */
  1025. #define RF_TCXO_TCXOINPUT_MASK 0xEF
  1026. #define RF_TCXO_TCXOINPUT_ON 0x10
  1027. #define RF_TCXO_TCXOINPUT_OFF 0x00 // Default
  1028. /*!
  1029. * RegPaDac
  1030. */
  1031. #define RF_PADAC_20DBM_MASK 0xF8
  1032. #define RF_PADAC_20DBM_ON 0x07
  1033. #define RF_PADAC_20DBM_OFF 0x04 // Default
  1034. /*!
  1035. * RegPll
  1036. */
  1037. #define RF_PLL_BANDWIDTH_MASK 0x3F
  1038. #define RF_PLL_BANDWIDTH_75 0x00
  1039. #define RF_PLL_BANDWIDTH_150 0x40
  1040. #define RF_PLL_BANDWIDTH_225 0x80
  1041. #define RF_PLL_BANDWIDTH_300 0xC0 // Default
  1042. /*!
  1043. * RegPllLowPn
  1044. */
  1045. #define RF_PLLLOWPN_BANDWIDTH_MASK 0x3F
  1046. #define RF_PLLLOWPN_BANDWIDTH_75 0x00
  1047. #define RF_PLLLOWPN_BANDWIDTH_150 0x40
  1048. #define RF_PLLLOWPN_BANDWIDTH_225 0x80
  1049. #define RF_PLLLOWPN_BANDWIDTH_300 0xC0 // Default
  1050. /*!
  1051. * RegFormerTemp
  1052. */
  1053. /*!
  1054. * RegBitrateFrac
  1055. */
  1056. #define RF_BITRATEFRAC_MASK 0xF0
  1057. typedef struct sSX1276
  1058. {
  1059. uint8_t RegFifo; // 0x00
  1060. // Common settings
  1061. uint8_t RegOpMode; // 0x01
  1062. uint8_t RegBitrateMsb; // 0x02
  1063. uint8_t RegBitrateLsb; // 0x03
  1064. uint8_t RegFdevMsb; // 0x04
  1065. uint8_t RegFdevLsb; // 0x05
  1066. uint8_t RegFrfMsb; // 0x06
  1067. uint8_t RegFrfMid; // 0x07
  1068. uint8_t RegFrfLsb; // 0x08
  1069. // Tx settings
  1070. uint8_t RegPaConfig; // 0x09
  1071. uint8_t RegPaRamp; // 0x0A
  1072. uint8_t RegOcp; // 0x0B
  1073. // Rx settings
  1074. uint8_t RegLna; // 0x0C
  1075. uint8_t RegRxConfig; // 0x0D
  1076. uint8_t RegRssiConfig; // 0x0E
  1077. uint8_t RegRssiCollision; // 0x0F
  1078. uint8_t RegRssiThresh; // 0x10
  1079. uint8_t RegRssiValue; // 0x11
  1080. uint8_t RegRxBw; // 0x12
  1081. uint8_t RegAfcBw; // 0x13
  1082. uint8_t RegOokPeak; // 0x14
  1083. uint8_t RegOokFix; // 0x15
  1084. uint8_t RegOokAvg; // 0x16
  1085. uint8_t RegRes17; // 0x17
  1086. uint8_t RegRes18; // 0x18
  1087. uint8_t RegRes19; // 0x19
  1088. uint8_t RegAfcFei; // 0x1A
  1089. uint8_t RegAfcMsb; // 0x1B
  1090. uint8_t RegAfcLsb; // 0x1C
  1091. uint8_t RegFeiMsb; // 0x1D
  1092. uint8_t RegFeiLsb; // 0x1E
  1093. uint8_t RegPreambleDetect; // 0x1F
  1094. uint8_t RegRxTimeout1; // 0x20
  1095. uint8_t RegRxTimeout2; // 0x21
  1096. uint8_t RegRxTimeout3; // 0x22
  1097. uint8_t RegRxDelay; // 0x23
  1098. // Oscillator settings
  1099. uint8_t RegOsc; // 0x24
  1100. // Packet handler settings
  1101. uint8_t RegPreambleMsb; // 0x25
  1102. uint8_t RegPreambleLsb; // 0x26
  1103. uint8_t RegSyncConfig; // 0x27
  1104. uint8_t RegSyncValue1; // 0x28
  1105. uint8_t RegSyncValue2; // 0x29
  1106. uint8_t RegSyncValue3; // 0x2A
  1107. uint8_t RegSyncValue4; // 0x2B
  1108. uint8_t RegSyncValue5; // 0x2C
  1109. uint8_t RegSyncValue6; // 0x2D
  1110. uint8_t RegSyncValue7; // 0x2E
  1111. uint8_t RegSyncValue8; // 0x2F
  1112. uint8_t RegPacketConfig1; // 0x30
  1113. uint8_t RegPacketConfig2; // 0x31
  1114. uint8_t RegPayloadLength; // 0x32
  1115. uint8_t RegNodeAdrs; // 0x33
  1116. uint8_t RegBroadcastAdrs; // 0x34
  1117. uint8_t RegFifoThresh; // 0x35
  1118. // Sequencer settings
  1119. uint8_t RegSeqConfig1; // 0x36
  1120. uint8_t RegSeqConfig2; // 0x37
  1121. uint8_t RegTimerResol; // 0x38
  1122. uint8_t RegTimer1Coef; // 0x39
  1123. uint8_t RegTimer2Coef; // 0x3A
  1124. // Service settings
  1125. uint8_t RegImageCal; // 0x3B
  1126. uint8_t RegTemp; // 0x3C
  1127. uint8_t RegLowBat; // 0x3D
  1128. // Status
  1129. uint8_t RegIrqFlags1; // 0x3E
  1130. uint8_t RegIrqFlags2; // 0x3F
  1131. // I/O settings
  1132. uint8_t RegDioMapping1; // 0x40
  1133. uint8_t RegDioMapping2; // 0x41
  1134. // Version
  1135. uint8_t RegVersion; // 0x42
  1136. // Additional settings
  1137. uint8_t RegAgcRef; // 0x43
  1138. uint8_t RegAgcThresh1; // 0x44
  1139. uint8_t RegAgcThresh2; // 0x45
  1140. uint8_t RegAgcThresh3; // 0x46
  1141. // Test
  1142. uint8_t RegTestReserved47[0x4B - 0x47]; // 0x47-0x4A
  1143. // Additional settings
  1144. uint8_t RegPllHop; // 0x4B
  1145. uint8_t RegTestReserved4C; // 0x4C
  1146. uint8_t RegPaDac; // 0x4D
  1147. // Test
  1148. uint8_t RegTestReserved4E[0x58-0x4E]; // 0x4E-0x57
  1149. // Additional settings
  1150. uint8_t RegTcxo; // 0x58
  1151. // Test
  1152. uint8_t RegTestReserved59; // 0x59
  1153. // Test
  1154. uint8_t RegTestReserved5B; // 0x5B
  1155. // Additional settings
  1156. uint8_t RegPll; // 0x5C
  1157. // Test
  1158. uint8_t RegTestReserved5D; // 0x5D
  1159. // Additional settings
  1160. uint8_t RegPllLowPn; // 0x5E
  1161. // Test
  1162. uint8_t RegTestReserved5F[0x6C - 0x5F]; // 0x5F-0x6B
  1163. // Additional settings
  1164. uint8_t RegFormerTemp; // 0x6C
  1165. // Test
  1166. uint8_t RegTestReserved6D[0x70 - 0x6D]; // 0x6D-0x6F
  1167. // Additional settings
  1168. uint8_t RegBitrateFrac; // 0x70
  1169. }tSX1276;
  1170. extern tSX1276* SX1276;
  1171. /*!
  1172. * \brief Initializes the SX1276
  1173. */
  1174. void SX1276FskInit( void );
  1175. /*!
  1176. * \brief Sets the SX1276 to datasheet default values
  1177. */
  1178. void SX1276FskSetDefaults( void );
  1179. /*!
  1180. * \brief Resets the SX1276
  1181. */
  1182. void SX1276FskReset( void );
  1183. /*!
  1184. * \brief Enables/Disables the LoRa modem
  1185. *
  1186. * \param [IN]: enable [true, false]
  1187. */
  1188. void SX1276FskSetLoRaOn( bool enable );
  1189. /*!
  1190. * \brief Sets the SX1276 operating mode
  1191. *
  1192. * \param [IN] opMode New operating mode
  1193. */
  1194. void SX1276FskSetOpMode( uint8_t opMode );
  1195. /*!
  1196. * \brief Gets the SX1276 operating mode
  1197. *
  1198. * \retval opMode Current operating mode
  1199. */
  1200. uint8_t SX1276FskGetOpMode( void );
  1201. /*!
  1202. * \brief Trigs and reads the FEI
  1203. *
  1204. * \retval feiValue Frequency error value.
  1205. */
  1206. int32_t SX1276FskReadFei( void );
  1207. /*!
  1208. * \brief Reads the current AFC value
  1209. *
  1210. * \retval afcValue Frequency offset value.
  1211. */
  1212. int32_t SX1276FskReadAfc( void );
  1213. /*!
  1214. * \brief Reads the current Rx gain setting
  1215. *
  1216. * \retval rxGain Current gain setting
  1217. */
  1218. uint8_t SX1276FskReadRxGain( void );
  1219. /*!
  1220. * \brief Trigs and reads the current RSSI value
  1221. *
  1222. * \retval rssiValue Current RSSI value in [dBm]
  1223. */
  1224. double SX1276FskReadRssi( void );
  1225. /*!
  1226. * \brief Gets the Rx gain value measured while receiving the packet
  1227. *
  1228. * \retval rxGainValue Current Rx gain value
  1229. */
  1230. uint8_t SX1276FskGetPacketRxGain( void );
  1231. /*!
  1232. * \brief Gets the RSSI value measured while receiving the packet
  1233. *
  1234. * \retval rssiValue Current RSSI value in [dBm]
  1235. */
  1236. double SX1276FskGetPacketRssi( void );
  1237. /*!
  1238. * \brief Gets the AFC value measured while receiving the packet
  1239. *
  1240. * \retval afcValue Current AFC value in [Hz]
  1241. */
  1242. uint32_t SX1276FskGetPacketAfc( void );
  1243. /*!
  1244. * \brief Sets the radio in Rx mode. Waiting for a packet
  1245. */
  1246. void SX1276FskStartRx( void );
  1247. /*!
  1248. * \brief Gets a copy of the current received buffer
  1249. *
  1250. * \param [IN]: buffer Buffer pointer
  1251. * \param [IN]: size Buffer size
  1252. */
  1253. void SX1276FskGetRxPacket( void *buffer, uint16_t *size );
  1254. /*!
  1255. * \brief Sets a copy of the buffer to be transmitted and starts the
  1256. * transmission
  1257. *
  1258. * \param [IN]: buffer Buffer pointer
  1259. * \param [IN]: size Buffer size
  1260. */
  1261. void SX1276FskSetTxPacket( const void *buffer, uint16_t size );
  1262. /*!
  1263. * \brief Gets the current RFState
  1264. *
  1265. * \retval rfState Current RF state [RF_IDLE, RF_BUSY,
  1266. * RF_RX_DONE, RF_RX_TIMEOUT,
  1267. * RF_TX_DONE, RF_TX_TIMEOUT]
  1268. */
  1269. uint8_t SX1276FskGetRFState( void );
  1270. /*!
  1271. * \brief Sets the new state of the RF state machine
  1272. *
  1273. * \param [IN]: state New RF state machine state
  1274. */
  1275. void SX1276FskSetRFState( uint8_t state );
  1276. /*!
  1277. * \brief Process the FSK modem Rx and Tx state machines depending on the
  1278. * SX1276 operating mode.
  1279. *
  1280. * \retval rfState Current RF state [RF_IDLE, RF_BUSY,
  1281. * RF_RX_DONE, RF_RX_TIMEOUT,
  1282. * RF_TX_DONE, RF_TX_TIMEOUT]
  1283. */
  1284. uint32_t SX1276FskProcess( void );
  1285. #endif //__SX1276_FSK_H__