This is code is part of a Technion course project in advanced IoT, implementing a device to read and transmit sensors data from a Formula racing car built by students at Technion - Israel Institute of Technology.

Dependencies:   mbed Buffer

Fork of DISCO-L072CZ-LRWAN1_LoRa_PingPong by ST

This is code is part of a Technion course project in advanced IoT, implementing a device to read and transmit sensors data from a Formula racing car built by students at Technion - Israel Institute of Technology.

How to install

  • Create an account on Mbed: https://os.mbed.com/account/signup/
  • Import project into Compiler
  • In the Program Workspace select "Formula_Nucleo_Reader"
  • Select a Platform like so:
  1. Click button at top-left
  2. Add Board
  3. Search "B-L072Z-LRWAN1" and then "Add to your Mbed Compiler"
  • Finally click "Compile", if the build was successful, the binary would download automatically
  • To install it on device simply plug it in to a PC, open device drive and drag then drop binary file in it
Committer:
wardm
Date:
Sat May 19 11:41:10 2018 +0000
Revision:
12:02d779e8c4f6
Code for Technion Formula car sensors reader transmit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wardm 12:02d779e8c4f6 1 /*
wardm 12:02d779e8c4f6 2 / _____) _ | |
wardm 12:02d779e8c4f6 3 ( (____ _____ ____ _| |_ _____ ____| |__
wardm 12:02d779e8c4f6 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
wardm 12:02d779e8c4f6 5 _____) ) ____| | | || |_| ____( (___| | | |
wardm 12:02d779e8c4f6 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
wardm 12:02d779e8c4f6 7 (C) 2014 Semtech
wardm 12:02d779e8c4f6 8
wardm 12:02d779e8c4f6 9 Description: SX1276 LoRa modem registers and bits definitions
wardm 12:02d779e8c4f6 10
wardm 12:02d779e8c4f6 11 License: Revised BSD License, see LICENSE.TXT file include in the project
wardm 12:02d779e8c4f6 12
wardm 12:02d779e8c4f6 13 Maintainer: Miguel Luis and Gregory Cristian
wardm 12:02d779e8c4f6 14 */
wardm 12:02d779e8c4f6 15 #ifndef __SX1276_REGS_LORA_H__
wardm 12:02d779e8c4f6 16 #define __SX1276_REGS_LORA_H__
wardm 12:02d779e8c4f6 17
wardm 12:02d779e8c4f6 18 /*!
wardm 12:02d779e8c4f6 19 * ============================================================================
wardm 12:02d779e8c4f6 20 * SX1276 Internal registers Address
wardm 12:02d779e8c4f6 21 * ============================================================================
wardm 12:02d779e8c4f6 22 */
wardm 12:02d779e8c4f6 23 #define REG_LR_FIFO 0x00
wardm 12:02d779e8c4f6 24 // Common settings
wardm 12:02d779e8c4f6 25 #define REG_LR_OPMODE 0x01
wardm 12:02d779e8c4f6 26 #define REG_LR_FRFMSB 0x06
wardm 12:02d779e8c4f6 27 #define REG_LR_FRFMID 0x07
wardm 12:02d779e8c4f6 28 #define REG_LR_FRFLSB 0x08
wardm 12:02d779e8c4f6 29 // Tx settings
wardm 12:02d779e8c4f6 30 #define REG_LR_PACONFIG 0x09
wardm 12:02d779e8c4f6 31 #define REG_LR_PARAMP 0x0A
wardm 12:02d779e8c4f6 32 #define REG_LR_OCP 0x0B
wardm 12:02d779e8c4f6 33 // Rx settings
wardm 12:02d779e8c4f6 34 #define REG_LR_LNA 0x0C
wardm 12:02d779e8c4f6 35 // LoRa registers
wardm 12:02d779e8c4f6 36 #define REG_LR_FIFOADDRPTR 0x0D
wardm 12:02d779e8c4f6 37 #define REG_LR_FIFOTXBASEADDR 0x0E
wardm 12:02d779e8c4f6 38 #define REG_LR_FIFORXBASEADDR 0x0F
wardm 12:02d779e8c4f6 39 #define REG_LR_FIFORXCURRENTADDR 0x10
wardm 12:02d779e8c4f6 40 #define REG_LR_IRQFLAGSMASK 0x11
wardm 12:02d779e8c4f6 41 #define REG_LR_IRQFLAGS 0x12
wardm 12:02d779e8c4f6 42 #define REG_LR_RXNBBYTES 0x13
wardm 12:02d779e8c4f6 43 #define REG_LR_RXHEADERCNTVALUEMSB 0x14
wardm 12:02d779e8c4f6 44 #define REG_LR_RXHEADERCNTVALUELSB 0x15
wardm 12:02d779e8c4f6 45 #define REG_LR_RXPACKETCNTVALUEMSB 0x16
wardm 12:02d779e8c4f6 46 #define REG_LR_RXPACKETCNTVALUELSB 0x17
wardm 12:02d779e8c4f6 47 #define REG_LR_MODEMSTAT 0x18
wardm 12:02d779e8c4f6 48 #define REG_LR_PKTSNRVALUE 0x19
wardm 12:02d779e8c4f6 49 #define REG_LR_PKTRSSIVALUE 0x1A
wardm 12:02d779e8c4f6 50 #define REG_LR_RSSIVALUE 0x1B
wardm 12:02d779e8c4f6 51 #define REG_LR_HOPCHANNEL 0x1C
wardm 12:02d779e8c4f6 52 #define REG_LR_MODEMCONFIG1 0x1D
wardm 12:02d779e8c4f6 53 #define REG_LR_MODEMCONFIG2 0x1E
wardm 12:02d779e8c4f6 54 #define REG_LR_SYMBTIMEOUTLSB 0x1F
wardm 12:02d779e8c4f6 55 #define REG_LR_PREAMBLEMSB 0x20
wardm 12:02d779e8c4f6 56 #define REG_LR_PREAMBLELSB 0x21
wardm 12:02d779e8c4f6 57 #define REG_LR_PAYLOADLENGTH 0x22
wardm 12:02d779e8c4f6 58 #define REG_LR_PAYLOADMAXLENGTH 0x23
wardm 12:02d779e8c4f6 59 #define REG_LR_HOPPERIOD 0x24
wardm 12:02d779e8c4f6 60 #define REG_LR_FIFORXBYTEADDR 0x25
wardm 12:02d779e8c4f6 61 #define REG_LR_MODEMCONFIG3 0x26
wardm 12:02d779e8c4f6 62 #define REG_LR_FEIMSB 0x28
wardm 12:02d779e8c4f6 63 #define REG_LR_FEIMID 0x29
wardm 12:02d779e8c4f6 64 #define REG_LR_FEILSB 0x2A
wardm 12:02d779e8c4f6 65 #define REG_LR_RSSIWIDEBAND 0x2C
wardm 12:02d779e8c4f6 66 #define REG_LR_TEST2F 0x2F
wardm 12:02d779e8c4f6 67 #define REG_LR_TEST30 0x30
wardm 12:02d779e8c4f6 68 #define REG_LR_DETECTOPTIMIZE 0x31
wardm 12:02d779e8c4f6 69 #define REG_LR_INVERTIQ 0x33
wardm 12:02d779e8c4f6 70 #define REG_LR_TEST36 0x36
wardm 12:02d779e8c4f6 71 #define REG_LR_DETECTIONTHRESHOLD 0x37
wardm 12:02d779e8c4f6 72 #define REG_LR_SYNCWORD 0x39
wardm 12:02d779e8c4f6 73 #define REG_LR_TEST3A 0x3A
wardm 12:02d779e8c4f6 74 #define REG_LR_INVERTIQ2 0x3B
wardm 12:02d779e8c4f6 75
wardm 12:02d779e8c4f6 76 // end of documented register in datasheet
wardm 12:02d779e8c4f6 77 // I/O settings
wardm 12:02d779e8c4f6 78 #define REG_LR_DIOMAPPING1 0x40
wardm 12:02d779e8c4f6 79 #define REG_LR_DIOMAPPING2 0x41
wardm 12:02d779e8c4f6 80 // Version
wardm 12:02d779e8c4f6 81 #define REG_LR_VERSION 0x42
wardm 12:02d779e8c4f6 82 // Additional settings
wardm 12:02d779e8c4f6 83 #define REG_LR_PLLHOP 0x44
wardm 12:02d779e8c4f6 84 #define REG_LR_TCXO 0x4B
wardm 12:02d779e8c4f6 85 #define REG_LR_PADAC 0x4D
wardm 12:02d779e8c4f6 86 #define REG_LR_FORMERTEMP 0x5B
wardm 12:02d779e8c4f6 87 #define REG_LR_BITRATEFRAC 0x5D
wardm 12:02d779e8c4f6 88 #define REG_LR_AGCREF 0x61
wardm 12:02d779e8c4f6 89 #define REG_LR_AGCTHRESH1 0x62
wardm 12:02d779e8c4f6 90 #define REG_LR_AGCTHRESH2 0x63
wardm 12:02d779e8c4f6 91 #define REG_LR_AGCTHRESH3 0x64
wardm 12:02d779e8c4f6 92 #define REG_LR_PLL 0x70
wardm 12:02d779e8c4f6 93
wardm 12:02d779e8c4f6 94 /*!
wardm 12:02d779e8c4f6 95 * ============================================================================
wardm 12:02d779e8c4f6 96 * SX1276 LoRa bits control definition
wardm 12:02d779e8c4f6 97 * ============================================================================
wardm 12:02d779e8c4f6 98 */
wardm 12:02d779e8c4f6 99
wardm 12:02d779e8c4f6 100 /*!
wardm 12:02d779e8c4f6 101 * RegFifo
wardm 12:02d779e8c4f6 102 */
wardm 12:02d779e8c4f6 103
wardm 12:02d779e8c4f6 104 /*!
wardm 12:02d779e8c4f6 105 * RegOpMode
wardm 12:02d779e8c4f6 106 */
wardm 12:02d779e8c4f6 107 #define RFLR_OPMODE_LONGRANGEMODE_MASK 0x7F
wardm 12:02d779e8c4f6 108 #define RFLR_OPMODE_LONGRANGEMODE_OFF 0x00 // Default
wardm 12:02d779e8c4f6 109 #define RFLR_OPMODE_LONGRANGEMODE_ON 0x80
wardm 12:02d779e8c4f6 110
wardm 12:02d779e8c4f6 111 #define RFLR_OPMODE_ACCESSSHAREDREG_MASK 0xBF
wardm 12:02d779e8c4f6 112 #define RFLR_OPMODE_ACCESSSHAREDREG_ENABLE 0x40
wardm 12:02d779e8c4f6 113 #define RFLR_OPMODE_ACCESSSHAREDREG_DISABLE 0x00 // Default
wardm 12:02d779e8c4f6 114
wardm 12:02d779e8c4f6 115 #define RFLR_OPMODE_FREQMODE_ACCESS_MASK 0xF7
wardm 12:02d779e8c4f6 116 #define RFLR_OPMODE_FREQMODE_ACCESS_LF 0x08 // Default
wardm 12:02d779e8c4f6 117 #define RFLR_OPMODE_FREQMODE_ACCESS_HF 0x00
wardm 12:02d779e8c4f6 118
wardm 12:02d779e8c4f6 119 #define RFLR_OPMODE_MASK 0xF8
wardm 12:02d779e8c4f6 120 #define RFLR_OPMODE_SLEEP 0x00
wardm 12:02d779e8c4f6 121 #define RFLR_OPMODE_STANDBY 0x01 // Default
wardm 12:02d779e8c4f6 122 #define RFLR_OPMODE_SYNTHESIZER_TX 0x02
wardm 12:02d779e8c4f6 123 #define RFLR_OPMODE_TRANSMITTER 0x03
wardm 12:02d779e8c4f6 124 #define RFLR_OPMODE_SYNTHESIZER_RX 0x04
wardm 12:02d779e8c4f6 125 #define RFLR_OPMODE_RECEIVER 0x05
wardm 12:02d779e8c4f6 126 // LoRa specific modes
wardm 12:02d779e8c4f6 127 #define RFLR_OPMODE_RECEIVER_SINGLE 0x06
wardm 12:02d779e8c4f6 128 #define RFLR_OPMODE_CAD 0x07
wardm 12:02d779e8c4f6 129
wardm 12:02d779e8c4f6 130 /*!
wardm 12:02d779e8c4f6 131 * RegFrf (MHz)
wardm 12:02d779e8c4f6 132 */
wardm 12:02d779e8c4f6 133 #define RFLR_FRFMSB_434_MHZ 0x6C // Default
wardm 12:02d779e8c4f6 134 #define RFLR_FRFMID_434_MHZ 0x80 // Default
wardm 12:02d779e8c4f6 135 #define RFLR_FRFLSB_434_MHZ 0x00 // Default
wardm 12:02d779e8c4f6 136
wardm 12:02d779e8c4f6 137 /*!
wardm 12:02d779e8c4f6 138 * RegPaConfig
wardm 12:02d779e8c4f6 139 */
wardm 12:02d779e8c4f6 140 #define RFLR_PACONFIG_PASELECT_MASK 0x7F
wardm 12:02d779e8c4f6 141 #define RFLR_PACONFIG_PASELECT_PABOOST 0x80
wardm 12:02d779e8c4f6 142 #define RFLR_PACONFIG_PASELECT_RFO 0x00 // Default
wardm 12:02d779e8c4f6 143
wardm 12:02d779e8c4f6 144 #define RFLR_PACONFIG_MAX_POWER_MASK 0x8F
wardm 12:02d779e8c4f6 145
wardm 12:02d779e8c4f6 146 #define RFLR_PACONFIG_OUTPUTPOWER_MASK 0xF0
wardm 12:02d779e8c4f6 147
wardm 12:02d779e8c4f6 148 /*!
wardm 12:02d779e8c4f6 149 * RegPaRamp
wardm 12:02d779e8c4f6 150 */
wardm 12:02d779e8c4f6 151 #define RFLR_PARAMP_TXBANDFORCE_MASK 0xEF
wardm 12:02d779e8c4f6 152 #define RFLR_PARAMP_TXBANDFORCE_BAND_SEL 0x10
wardm 12:02d779e8c4f6 153 #define RFLR_PARAMP_TXBANDFORCE_AUTO 0x00 // Default
wardm 12:02d779e8c4f6 154
wardm 12:02d779e8c4f6 155 #define RFLR_PARAMP_MASK 0xF0
wardm 12:02d779e8c4f6 156 #define RFLR_PARAMP_3400_US 0x00
wardm 12:02d779e8c4f6 157 #define RFLR_PARAMP_2000_US 0x01
wardm 12:02d779e8c4f6 158 #define RFLR_PARAMP_1000_US 0x02
wardm 12:02d779e8c4f6 159 #define RFLR_PARAMP_0500_US 0x03
wardm 12:02d779e8c4f6 160 #define RFLR_PARAMP_0250_US 0x04
wardm 12:02d779e8c4f6 161 #define RFLR_PARAMP_0125_US 0x05
wardm 12:02d779e8c4f6 162 #define RFLR_PARAMP_0100_US 0x06
wardm 12:02d779e8c4f6 163 #define RFLR_PARAMP_0062_US 0x07
wardm 12:02d779e8c4f6 164 #define RFLR_PARAMP_0050_US 0x08
wardm 12:02d779e8c4f6 165 #define RFLR_PARAMP_0040_US 0x09 // Default
wardm 12:02d779e8c4f6 166 #define RFLR_PARAMP_0031_US 0x0A
wardm 12:02d779e8c4f6 167 #define RFLR_PARAMP_0025_US 0x0B
wardm 12:02d779e8c4f6 168 #define RFLR_PARAMP_0020_US 0x0C
wardm 12:02d779e8c4f6 169 #define RFLR_PARAMP_0015_US 0x0D
wardm 12:02d779e8c4f6 170 #define RFLR_PARAMP_0012_US 0x0E
wardm 12:02d779e8c4f6 171 #define RFLR_PARAMP_0010_US 0x0F
wardm 12:02d779e8c4f6 172
wardm 12:02d779e8c4f6 173 /*!
wardm 12:02d779e8c4f6 174 * RegOcp
wardm 12:02d779e8c4f6 175 */
wardm 12:02d779e8c4f6 176 #define RFLR_OCP_MASK 0xDF
wardm 12:02d779e8c4f6 177 #define RFLR_OCP_ON 0x20 // Default
wardm 12:02d779e8c4f6 178 #define RFLR_OCP_OFF 0x00
wardm 12:02d779e8c4f6 179
wardm 12:02d779e8c4f6 180 #define RFLR_OCP_TRIM_MASK 0xE0
wardm 12:02d779e8c4f6 181 #define RFLR_OCP_TRIM_045_MA 0x00
wardm 12:02d779e8c4f6 182 #define RFLR_OCP_TRIM_050_MA 0x01
wardm 12:02d779e8c4f6 183 #define RFLR_OCP_TRIM_055_MA 0x02
wardm 12:02d779e8c4f6 184 #define RFLR_OCP_TRIM_060_MA 0x03
wardm 12:02d779e8c4f6 185 #define RFLR_OCP_TRIM_065_MA 0x04
wardm 12:02d779e8c4f6 186 #define RFLR_OCP_TRIM_070_MA 0x05
wardm 12:02d779e8c4f6 187 #define RFLR_OCP_TRIM_075_MA 0x06
wardm 12:02d779e8c4f6 188 #define RFLR_OCP_TRIM_080_MA 0x07
wardm 12:02d779e8c4f6 189 #define RFLR_OCP_TRIM_085_MA 0x08
wardm 12:02d779e8c4f6 190 #define RFLR_OCP_TRIM_090_MA 0x09
wardm 12:02d779e8c4f6 191 #define RFLR_OCP_TRIM_095_MA 0x0A
wardm 12:02d779e8c4f6 192 #define RFLR_OCP_TRIM_100_MA 0x0B // Default
wardm 12:02d779e8c4f6 193 #define RFLR_OCP_TRIM_105_MA 0x0C
wardm 12:02d779e8c4f6 194 #define RFLR_OCP_TRIM_110_MA 0x0D
wardm 12:02d779e8c4f6 195 #define RFLR_OCP_TRIM_115_MA 0x0E
wardm 12:02d779e8c4f6 196 #define RFLR_OCP_TRIM_120_MA 0x0F
wardm 12:02d779e8c4f6 197 #define RFLR_OCP_TRIM_130_MA 0x10
wardm 12:02d779e8c4f6 198 #define RFLR_OCP_TRIM_140_MA 0x11
wardm 12:02d779e8c4f6 199 #define RFLR_OCP_TRIM_150_MA 0x12
wardm 12:02d779e8c4f6 200 #define RFLR_OCP_TRIM_160_MA 0x13
wardm 12:02d779e8c4f6 201 #define RFLR_OCP_TRIM_170_MA 0x14
wardm 12:02d779e8c4f6 202 #define RFLR_OCP_TRIM_180_MA 0x15
wardm 12:02d779e8c4f6 203 #define RFLR_OCP_TRIM_190_MA 0x16
wardm 12:02d779e8c4f6 204 #define RFLR_OCP_TRIM_200_MA 0x17
wardm 12:02d779e8c4f6 205 #define RFLR_OCP_TRIM_210_MA 0x18
wardm 12:02d779e8c4f6 206 #define RFLR_OCP_TRIM_220_MA 0x19
wardm 12:02d779e8c4f6 207 #define RFLR_OCP_TRIM_230_MA 0x1A
wardm 12:02d779e8c4f6 208 #define RFLR_OCP_TRIM_240_MA 0x1B
wardm 12:02d779e8c4f6 209
wardm 12:02d779e8c4f6 210 /*!
wardm 12:02d779e8c4f6 211 * RegLna
wardm 12:02d779e8c4f6 212 */
wardm 12:02d779e8c4f6 213 #define RFLR_LNA_GAIN_MASK 0x1F
wardm 12:02d779e8c4f6 214 #define RFLR_LNA_GAIN_G1 0x20 // Default
wardm 12:02d779e8c4f6 215 #define RFLR_LNA_GAIN_G2 0x40
wardm 12:02d779e8c4f6 216 #define RFLR_LNA_GAIN_G3 0x60
wardm 12:02d779e8c4f6 217 #define RFLR_LNA_GAIN_G4 0x80
wardm 12:02d779e8c4f6 218 #define RFLR_LNA_GAIN_G5 0xA0
wardm 12:02d779e8c4f6 219 #define RFLR_LNA_GAIN_G6 0xC0
wardm 12:02d779e8c4f6 220
wardm 12:02d779e8c4f6 221 #define RFLR_LNA_BOOST_LF_MASK 0xE7
wardm 12:02d779e8c4f6 222 #define RFLR_LNA_BOOST_LF_DEFAULT 0x00 // Default
wardm 12:02d779e8c4f6 223
wardm 12:02d779e8c4f6 224 #define RFLR_LNA_BOOST_HF_MASK 0xFC
wardm 12:02d779e8c4f6 225 #define RFLR_LNA_BOOST_HF_OFF 0x00 // Default
wardm 12:02d779e8c4f6 226 #define RFLR_LNA_BOOST_HF_ON 0x03
wardm 12:02d779e8c4f6 227
wardm 12:02d779e8c4f6 228 /*!
wardm 12:02d779e8c4f6 229 * RegFifoAddrPtr
wardm 12:02d779e8c4f6 230 */
wardm 12:02d779e8c4f6 231 #define RFLR_FIFOADDRPTR 0x00 // Default
wardm 12:02d779e8c4f6 232
wardm 12:02d779e8c4f6 233 /*!
wardm 12:02d779e8c4f6 234 * RegFifoTxBaseAddr
wardm 12:02d779e8c4f6 235 */
wardm 12:02d779e8c4f6 236 #define RFLR_FIFOTXBASEADDR 0x80 // Default
wardm 12:02d779e8c4f6 237
wardm 12:02d779e8c4f6 238 /*!
wardm 12:02d779e8c4f6 239 * RegFifoTxBaseAddr
wardm 12:02d779e8c4f6 240 */
wardm 12:02d779e8c4f6 241 #define RFLR_FIFORXBASEADDR 0x00 // Default
wardm 12:02d779e8c4f6 242
wardm 12:02d779e8c4f6 243 /*!
wardm 12:02d779e8c4f6 244 * RegFifoRxCurrentAddr (Read Only)
wardm 12:02d779e8c4f6 245 */
wardm 12:02d779e8c4f6 246
wardm 12:02d779e8c4f6 247 /*!
wardm 12:02d779e8c4f6 248 * RegIrqFlagsMask
wardm 12:02d779e8c4f6 249 */
wardm 12:02d779e8c4f6 250 #define RFLR_IRQFLAGS_RXTIMEOUT_MASK 0x80
wardm 12:02d779e8c4f6 251 #define RFLR_IRQFLAGS_RXDONE_MASK 0x40
wardm 12:02d779e8c4f6 252 #define RFLR_IRQFLAGS_PAYLOADCRCERROR_MASK 0x20
wardm 12:02d779e8c4f6 253 #define RFLR_IRQFLAGS_VALIDHEADER_MASK 0x10
wardm 12:02d779e8c4f6 254 #define RFLR_IRQFLAGS_TXDONE_MASK 0x08
wardm 12:02d779e8c4f6 255 #define RFLR_IRQFLAGS_CADDONE_MASK 0x04
wardm 12:02d779e8c4f6 256 #define RFLR_IRQFLAGS_FHSSCHANGEDCHANNEL_MASK 0x02
wardm 12:02d779e8c4f6 257 #define RFLR_IRQFLAGS_CADDETECTED_MASK 0x01
wardm 12:02d779e8c4f6 258
wardm 12:02d779e8c4f6 259 /*!
wardm 12:02d779e8c4f6 260 * RegIrqFlags
wardm 12:02d779e8c4f6 261 */
wardm 12:02d779e8c4f6 262 #define RFLR_IRQFLAGS_RXTIMEOUT 0x80
wardm 12:02d779e8c4f6 263 #define RFLR_IRQFLAGS_RXDONE 0x40
wardm 12:02d779e8c4f6 264 #define RFLR_IRQFLAGS_PAYLOADCRCERROR 0x20
wardm 12:02d779e8c4f6 265 #define RFLR_IRQFLAGS_VALIDHEADER 0x10
wardm 12:02d779e8c4f6 266 #define RFLR_IRQFLAGS_TXDONE 0x08
wardm 12:02d779e8c4f6 267 #define RFLR_IRQFLAGS_CADDONE 0x04
wardm 12:02d779e8c4f6 268 #define RFLR_IRQFLAGS_FHSSCHANGEDCHANNEL 0x02
wardm 12:02d779e8c4f6 269 #define RFLR_IRQFLAGS_CADDETECTED 0x01
wardm 12:02d779e8c4f6 270
wardm 12:02d779e8c4f6 271 /*!
wardm 12:02d779e8c4f6 272 * RegFifoRxNbBytes (Read Only)
wardm 12:02d779e8c4f6 273 */
wardm 12:02d779e8c4f6 274
wardm 12:02d779e8c4f6 275 /*!
wardm 12:02d779e8c4f6 276 * RegRxHeaderCntValueMsb (Read Only)
wardm 12:02d779e8c4f6 277 */
wardm 12:02d779e8c4f6 278
wardm 12:02d779e8c4f6 279 /*!
wardm 12:02d779e8c4f6 280 * RegRxHeaderCntValueLsb (Read Only)
wardm 12:02d779e8c4f6 281 */
wardm 12:02d779e8c4f6 282
wardm 12:02d779e8c4f6 283 /*!
wardm 12:02d779e8c4f6 284 * RegRxPacketCntValueMsb (Read Only)
wardm 12:02d779e8c4f6 285 */
wardm 12:02d779e8c4f6 286
wardm 12:02d779e8c4f6 287 /*!
wardm 12:02d779e8c4f6 288 * RegRxPacketCntValueLsb (Read Only)
wardm 12:02d779e8c4f6 289 */
wardm 12:02d779e8c4f6 290
wardm 12:02d779e8c4f6 291 /*!
wardm 12:02d779e8c4f6 292 * RegModemStat (Read Only)
wardm 12:02d779e8c4f6 293 */
wardm 12:02d779e8c4f6 294 #define RFLR_MODEMSTAT_RX_CR_MASK 0x1F
wardm 12:02d779e8c4f6 295 #define RFLR_MODEMSTAT_MODEM_STATUS_MASK 0xE0
wardm 12:02d779e8c4f6 296
wardm 12:02d779e8c4f6 297 #define RFLR_MODEMSTAT_MODEM_CLEAR 0x10
wardm 12:02d779e8c4f6 298 #define RFLR_MODEMSTAT_HEADERINFO_VALID 0x08
wardm 12:02d779e8c4f6 299 #define RFLR_MODEMSTAT_RX_ONGOING 0x04
wardm 12:02d779e8c4f6 300 #define RFLR_MODEMSTAT_SIGNAL_SYNCRONIZED 0x02
wardm 12:02d779e8c4f6 301 #define RFLR_MODEMSTAT_SIGNAL_DETECTED 0x01
wardm 12:02d779e8c4f6 302
wardm 12:02d779e8c4f6 303 /*!
wardm 12:02d779e8c4f6 304 * RegPktSnrValue (Read Only)
wardm 12:02d779e8c4f6 305 */
wardm 12:02d779e8c4f6 306
wardm 12:02d779e8c4f6 307 /*!
wardm 12:02d779e8c4f6 308 * RegPktRssiValue (Read Only)
wardm 12:02d779e8c4f6 309 */
wardm 12:02d779e8c4f6 310
wardm 12:02d779e8c4f6 311 /*!
wardm 12:02d779e8c4f6 312 * RegRssiValue (Read Only)
wardm 12:02d779e8c4f6 313 */
wardm 12:02d779e8c4f6 314
wardm 12:02d779e8c4f6 315 /*!
wardm 12:02d779e8c4f6 316 * RegHopChannel (Read Only)
wardm 12:02d779e8c4f6 317 */
wardm 12:02d779e8c4f6 318 #define RFLR_HOPCHANNEL_PLL_LOCK_TIMEOUT_MASK 0x7F
wardm 12:02d779e8c4f6 319 #define RFLR_HOPCHANNEL_PLL_LOCK_FAIL 0x80
wardm 12:02d779e8c4f6 320 #define RFLR_HOPCHANNEL_PLL_LOCK_SUCCEED 0x00 // Default
wardm 12:02d779e8c4f6 321
wardm 12:02d779e8c4f6 322 #define RFLR_HOPCHANNEL_CRCONPAYLOAD_MASK 0xBF
wardm 12:02d779e8c4f6 323 #define RFLR_HOPCHANNEL_CRCONPAYLOAD_ON 0x40
wardm 12:02d779e8c4f6 324 #define RFLR_HOPCHANNEL_CRCONPAYLOAD_OFF 0x00 // Default
wardm 12:02d779e8c4f6 325
wardm 12:02d779e8c4f6 326 #define RFLR_HOPCHANNEL_CHANNEL_MASK 0x3F
wardm 12:02d779e8c4f6 327
wardm 12:02d779e8c4f6 328 /*!
wardm 12:02d779e8c4f6 329 * RegModemConfig1
wardm 12:02d779e8c4f6 330 */
wardm 12:02d779e8c4f6 331 #define RFLR_MODEMCONFIG1_BW_MASK 0x0F
wardm 12:02d779e8c4f6 332 #define RFLR_MODEMCONFIG1_BW_7_81_KHZ 0x00
wardm 12:02d779e8c4f6 333 #define RFLR_MODEMCONFIG1_BW_10_41_KHZ 0x10
wardm 12:02d779e8c4f6 334 #define RFLR_MODEMCONFIG1_BW_15_62_KHZ 0x20
wardm 12:02d779e8c4f6 335 #define RFLR_MODEMCONFIG1_BW_20_83_KHZ 0x30
wardm 12:02d779e8c4f6 336 #define RFLR_MODEMCONFIG1_BW_31_25_KHZ 0x40
wardm 12:02d779e8c4f6 337 #define RFLR_MODEMCONFIG1_BW_41_66_KHZ 0x50
wardm 12:02d779e8c4f6 338 #define RFLR_MODEMCONFIG1_BW_62_50_KHZ 0x60
wardm 12:02d779e8c4f6 339 #define RFLR_MODEMCONFIG1_BW_125_KHZ 0x70 // Default
wardm 12:02d779e8c4f6 340 #define RFLR_MODEMCONFIG1_BW_250_KHZ 0x80
wardm 12:02d779e8c4f6 341 #define RFLR_MODEMCONFIG1_BW_500_KHZ 0x90
wardm 12:02d779e8c4f6 342
wardm 12:02d779e8c4f6 343 #define RFLR_MODEMCONFIG1_CODINGRATE_MASK 0xF1
wardm 12:02d779e8c4f6 344 #define RFLR_MODEMCONFIG1_CODINGRATE_4_5 0x02
wardm 12:02d779e8c4f6 345 #define RFLR_MODEMCONFIG1_CODINGRATE_4_6 0x04 // Default
wardm 12:02d779e8c4f6 346 #define RFLR_MODEMCONFIG1_CODINGRATE_4_7 0x06
wardm 12:02d779e8c4f6 347 #define RFLR_MODEMCONFIG1_CODINGRATE_4_8 0x08
wardm 12:02d779e8c4f6 348
wardm 12:02d779e8c4f6 349 #define RFLR_MODEMCONFIG1_IMPLICITHEADER_MASK 0xFE
wardm 12:02d779e8c4f6 350 #define RFLR_MODEMCONFIG1_IMPLICITHEADER_ON 0x01
wardm 12:02d779e8c4f6 351 #define RFLR_MODEMCONFIG1_IMPLICITHEADER_OFF 0x00 // Default
wardm 12:02d779e8c4f6 352
wardm 12:02d779e8c4f6 353 /*!
wardm 12:02d779e8c4f6 354 * RegModemConfig2
wardm 12:02d779e8c4f6 355 */
wardm 12:02d779e8c4f6 356 #define RFLR_MODEMCONFIG2_SF_MASK 0x0F
wardm 12:02d779e8c4f6 357 #define RFLR_MODEMCONFIG2_SF_6 0x60
wardm 12:02d779e8c4f6 358 #define RFLR_MODEMCONFIG2_SF_7 0x70 // Default
wardm 12:02d779e8c4f6 359 #define RFLR_MODEMCONFIG2_SF_8 0x80
wardm 12:02d779e8c4f6 360 #define RFLR_MODEMCONFIG2_SF_9 0x90
wardm 12:02d779e8c4f6 361 #define RFLR_MODEMCONFIG2_SF_10 0xA0
wardm 12:02d779e8c4f6 362 #define RFLR_MODEMCONFIG2_SF_11 0xB0
wardm 12:02d779e8c4f6 363 #define RFLR_MODEMCONFIG2_SF_12 0xC0
wardm 12:02d779e8c4f6 364
wardm 12:02d779e8c4f6 365 #define RFLR_MODEMCONFIG2_TXCONTINUOUSMODE_MASK 0xF7
wardm 12:02d779e8c4f6 366 #define RFLR_MODEMCONFIG2_TXCONTINUOUSMODE_ON 0x08
wardm 12:02d779e8c4f6 367 #define RFLR_MODEMCONFIG2_TXCONTINUOUSMODE_OFF 0x00
wardm 12:02d779e8c4f6 368
wardm 12:02d779e8c4f6 369 #define RFLR_MODEMCONFIG2_RXPAYLOADCRC_MASK 0xFB
wardm 12:02d779e8c4f6 370 #define RFLR_MODEMCONFIG2_RXPAYLOADCRC_ON 0x04
wardm 12:02d779e8c4f6 371 #define RFLR_MODEMCONFIG2_RXPAYLOADCRC_OFF 0x00 // Default
wardm 12:02d779e8c4f6 372
wardm 12:02d779e8c4f6 373 #define RFLR_MODEMCONFIG2_SYMBTIMEOUTMSB_MASK 0xFC
wardm 12:02d779e8c4f6 374 #define RFLR_MODEMCONFIG2_SYMBTIMEOUTMSB 0x00 // Default
wardm 12:02d779e8c4f6 375
wardm 12:02d779e8c4f6 376 /*!
wardm 12:02d779e8c4f6 377 * RegSymbTimeoutLsb
wardm 12:02d779e8c4f6 378 */
wardm 12:02d779e8c4f6 379 #define RFLR_SYMBTIMEOUTLSB_SYMBTIMEOUT 0x64 // Default
wardm 12:02d779e8c4f6 380
wardm 12:02d779e8c4f6 381 /*!
wardm 12:02d779e8c4f6 382 * RegPreambleLengthMsb
wardm 12:02d779e8c4f6 383 */
wardm 12:02d779e8c4f6 384 #define RFLR_PREAMBLELENGTHMSB 0x00 // Default
wardm 12:02d779e8c4f6 385
wardm 12:02d779e8c4f6 386 /*!
wardm 12:02d779e8c4f6 387 * RegPreambleLengthLsb
wardm 12:02d779e8c4f6 388 */
wardm 12:02d779e8c4f6 389 #define RFLR_PREAMBLELENGTHLSB 0x08 // Default
wardm 12:02d779e8c4f6 390
wardm 12:02d779e8c4f6 391 /*!
wardm 12:02d779e8c4f6 392 * RegPayloadLength
wardm 12:02d779e8c4f6 393 */
wardm 12:02d779e8c4f6 394 #define RFLR_PAYLOADLENGTH 0x0E // Default
wardm 12:02d779e8c4f6 395
wardm 12:02d779e8c4f6 396 /*!
wardm 12:02d779e8c4f6 397 * RegPayloadMaxLength
wardm 12:02d779e8c4f6 398 */
wardm 12:02d779e8c4f6 399 #define RFLR_PAYLOADMAXLENGTH 0xFF // Default
wardm 12:02d779e8c4f6 400
wardm 12:02d779e8c4f6 401 /*!
wardm 12:02d779e8c4f6 402 * RegHopPeriod
wardm 12:02d779e8c4f6 403 */
wardm 12:02d779e8c4f6 404 #define RFLR_HOPPERIOD_FREQFOPPINGPERIOD 0x00 // Default
wardm 12:02d779e8c4f6 405
wardm 12:02d779e8c4f6 406 /*!
wardm 12:02d779e8c4f6 407 * RegFifoRxByteAddr (Read Only)
wardm 12:02d779e8c4f6 408 */
wardm 12:02d779e8c4f6 409
wardm 12:02d779e8c4f6 410 /*!
wardm 12:02d779e8c4f6 411 * RegModemConfig3
wardm 12:02d779e8c4f6 412 */
wardm 12:02d779e8c4f6 413 #define RFLR_MODEMCONFIG3_LOWDATARATEOPTIMIZE_MASK 0xF7
wardm 12:02d779e8c4f6 414 #define RFLR_MODEMCONFIG3_LOWDATARATEOPTIMIZE_ON 0x08
wardm 12:02d779e8c4f6 415 #define RFLR_MODEMCONFIG3_LOWDATARATEOPTIMIZE_OFF 0x00 // Default
wardm 12:02d779e8c4f6 416
wardm 12:02d779e8c4f6 417 #define RFLR_MODEMCONFIG3_AGCAUTO_MASK 0xFB
wardm 12:02d779e8c4f6 418 #define RFLR_MODEMCONFIG3_AGCAUTO_ON 0x04 // Default
wardm 12:02d779e8c4f6 419 #define RFLR_MODEMCONFIG3_AGCAUTO_OFF 0x00
wardm 12:02d779e8c4f6 420
wardm 12:02d779e8c4f6 421 /*!
wardm 12:02d779e8c4f6 422 * RegFeiMsb (Read Only)
wardm 12:02d779e8c4f6 423 */
wardm 12:02d779e8c4f6 424
wardm 12:02d779e8c4f6 425 /*!
wardm 12:02d779e8c4f6 426 * RegFeiMid (Read Only)
wardm 12:02d779e8c4f6 427 */
wardm 12:02d779e8c4f6 428
wardm 12:02d779e8c4f6 429 /*!
wardm 12:02d779e8c4f6 430 * RegFeiLsb (Read Only)
wardm 12:02d779e8c4f6 431 */
wardm 12:02d779e8c4f6 432
wardm 12:02d779e8c4f6 433 /*!
wardm 12:02d779e8c4f6 434 * RegRssiWideband (Read Only)
wardm 12:02d779e8c4f6 435 */
wardm 12:02d779e8c4f6 436
wardm 12:02d779e8c4f6 437 /*!
wardm 12:02d779e8c4f6 438 * RegDetectOptimize
wardm 12:02d779e8c4f6 439 */
wardm 12:02d779e8c4f6 440 #define RFLR_DETECTIONOPTIMIZE_MASK 0xF8
wardm 12:02d779e8c4f6 441 #define RFLR_DETECTIONOPTIMIZE_SF7_TO_SF12 0x03 // Default
wardm 12:02d779e8c4f6 442 #define RFLR_DETECTIONOPTIMIZE_SF6 0x05
wardm 12:02d779e8c4f6 443
wardm 12:02d779e8c4f6 444 /*!
wardm 12:02d779e8c4f6 445 * RegInvertIQ
wardm 12:02d779e8c4f6 446 */
wardm 12:02d779e8c4f6 447 #define RFLR_INVERTIQ_RX_MASK 0xBF
wardm 12:02d779e8c4f6 448 #define RFLR_INVERTIQ_RX_OFF 0x00
wardm 12:02d779e8c4f6 449 #define RFLR_INVERTIQ_RX_ON 0x40
wardm 12:02d779e8c4f6 450 #define RFLR_INVERTIQ_TX_MASK 0xFE
wardm 12:02d779e8c4f6 451 #define RFLR_INVERTIQ_TX_OFF 0x01
wardm 12:02d779e8c4f6 452 #define RFLR_INVERTIQ_TX_ON 0x00
wardm 12:02d779e8c4f6 453
wardm 12:02d779e8c4f6 454 /*!
wardm 12:02d779e8c4f6 455 * RegDetectionThreshold
wardm 12:02d779e8c4f6 456 */
wardm 12:02d779e8c4f6 457 #define RFLR_DETECTIONTHRESH_SF7_TO_SF12 0x0A // Default
wardm 12:02d779e8c4f6 458 #define RFLR_DETECTIONTHRESH_SF6 0x0C
wardm 12:02d779e8c4f6 459
wardm 12:02d779e8c4f6 460 /*!
wardm 12:02d779e8c4f6 461 * RegInvertIQ2
wardm 12:02d779e8c4f6 462 */
wardm 12:02d779e8c4f6 463 #define RFLR_INVERTIQ2_ON 0x19
wardm 12:02d779e8c4f6 464 #define RFLR_INVERTIQ2_OFF 0x1D
wardm 12:02d779e8c4f6 465
wardm 12:02d779e8c4f6 466 /*!
wardm 12:02d779e8c4f6 467 * RegDioMapping1
wardm 12:02d779e8c4f6 468 */
wardm 12:02d779e8c4f6 469 #define RFLR_DIOMAPPING1_DIO0_MASK 0x3F
wardm 12:02d779e8c4f6 470 #define RFLR_DIOMAPPING1_DIO0_00 0x00 // Default
wardm 12:02d779e8c4f6 471 #define RFLR_DIOMAPPING1_DIO0_01 0x40
wardm 12:02d779e8c4f6 472 #define RFLR_DIOMAPPING1_DIO0_10 0x80
wardm 12:02d779e8c4f6 473 #define RFLR_DIOMAPPING1_DIO0_11 0xC0
wardm 12:02d779e8c4f6 474
wardm 12:02d779e8c4f6 475 #define RFLR_DIOMAPPING1_DIO1_MASK 0xCF
wardm 12:02d779e8c4f6 476 #define RFLR_DIOMAPPING1_DIO1_00 0x00 // Default
wardm 12:02d779e8c4f6 477 #define RFLR_DIOMAPPING1_DIO1_01 0x10
wardm 12:02d779e8c4f6 478 #define RFLR_DIOMAPPING1_DIO1_10 0x20
wardm 12:02d779e8c4f6 479 #define RFLR_DIOMAPPING1_DIO1_11 0x30
wardm 12:02d779e8c4f6 480
wardm 12:02d779e8c4f6 481 #define RFLR_DIOMAPPING1_DIO2_MASK 0xF3
wardm 12:02d779e8c4f6 482 #define RFLR_DIOMAPPING1_DIO2_00 0x00 // Default
wardm 12:02d779e8c4f6 483 #define RFLR_DIOMAPPING1_DIO2_01 0x04
wardm 12:02d779e8c4f6 484 #define RFLR_DIOMAPPING1_DIO2_10 0x08
wardm 12:02d779e8c4f6 485 #define RFLR_DIOMAPPING1_DIO2_11 0x0C
wardm 12:02d779e8c4f6 486
wardm 12:02d779e8c4f6 487 #define RFLR_DIOMAPPING1_DIO3_MASK 0xFC
wardm 12:02d779e8c4f6 488 #define RFLR_DIOMAPPING1_DIO3_00 0x00 // Default
wardm 12:02d779e8c4f6 489 #define RFLR_DIOMAPPING1_DIO3_01 0x01
wardm 12:02d779e8c4f6 490 #define RFLR_DIOMAPPING1_DIO3_10 0x02
wardm 12:02d779e8c4f6 491 #define RFLR_DIOMAPPING1_DIO3_11 0x03
wardm 12:02d779e8c4f6 492
wardm 12:02d779e8c4f6 493 /*!
wardm 12:02d779e8c4f6 494 * RegDioMapping2
wardm 12:02d779e8c4f6 495 */
wardm 12:02d779e8c4f6 496 #define RFLR_DIOMAPPING2_DIO4_MASK 0x3F
wardm 12:02d779e8c4f6 497 #define RFLR_DIOMAPPING2_DIO4_00 0x00 // Default
wardm 12:02d779e8c4f6 498 #define RFLR_DIOMAPPING2_DIO4_01 0x40
wardm 12:02d779e8c4f6 499 #define RFLR_DIOMAPPING2_DIO4_10 0x80
wardm 12:02d779e8c4f6 500 #define RFLR_DIOMAPPING2_DIO4_11 0xC0
wardm 12:02d779e8c4f6 501
wardm 12:02d779e8c4f6 502 #define RFLR_DIOMAPPING2_DIO5_MASK 0xCF
wardm 12:02d779e8c4f6 503 #define RFLR_DIOMAPPING2_DIO5_00 0x00 // Default
wardm 12:02d779e8c4f6 504 #define RFLR_DIOMAPPING2_DIO5_01 0x10
wardm 12:02d779e8c4f6 505 #define RFLR_DIOMAPPING2_DIO5_10 0x20
wardm 12:02d779e8c4f6 506 #define RFLR_DIOMAPPING2_DIO5_11 0x30
wardm 12:02d779e8c4f6 507
wardm 12:02d779e8c4f6 508 #define RFLR_DIOMAPPING2_MAP_MASK 0xFE
wardm 12:02d779e8c4f6 509 #define RFLR_DIOMAPPING2_MAP_PREAMBLEDETECT 0x01
wardm 12:02d779e8c4f6 510 #define RFLR_DIOMAPPING2_MAP_RSSI 0x00 // Default
wardm 12:02d779e8c4f6 511
wardm 12:02d779e8c4f6 512 /*!
wardm 12:02d779e8c4f6 513 * RegVersion (Read Only)
wardm 12:02d779e8c4f6 514 */
wardm 12:02d779e8c4f6 515
wardm 12:02d779e8c4f6 516 /*!
wardm 12:02d779e8c4f6 517 * RegPllHop
wardm 12:02d779e8c4f6 518 */
wardm 12:02d779e8c4f6 519 #define RFLR_PLLHOP_FASTHOP_MASK 0x7F
wardm 12:02d779e8c4f6 520 #define RFLR_PLLHOP_FASTHOP_ON 0x80
wardm 12:02d779e8c4f6 521 #define RFLR_PLLHOP_FASTHOP_OFF 0x00 // Default
wardm 12:02d779e8c4f6 522
wardm 12:02d779e8c4f6 523 /*!
wardm 12:02d779e8c4f6 524 * RegTcxo
wardm 12:02d779e8c4f6 525 */
wardm 12:02d779e8c4f6 526 #define RFLR_TCXO_TCXOINPUT_MASK 0xEF
wardm 12:02d779e8c4f6 527 #define RFLR_TCXO_TCXOINPUT_ON 0x10
wardm 12:02d779e8c4f6 528 #define RFLR_TCXO_TCXOINPUT_OFF 0x00 // Default
wardm 12:02d779e8c4f6 529
wardm 12:02d779e8c4f6 530 /*!
wardm 12:02d779e8c4f6 531 * RegPaDac
wardm 12:02d779e8c4f6 532 */
wardm 12:02d779e8c4f6 533 #define RFLR_PADAC_20DBM_MASK 0xF8
wardm 12:02d779e8c4f6 534 #define RFLR_PADAC_20DBM_ON 0x07
wardm 12:02d779e8c4f6 535 #define RFLR_PADAC_20DBM_OFF 0x04 // Default
wardm 12:02d779e8c4f6 536
wardm 12:02d779e8c4f6 537 /*!
wardm 12:02d779e8c4f6 538 * RegFormerTemp
wardm 12:02d779e8c4f6 539 */
wardm 12:02d779e8c4f6 540
wardm 12:02d779e8c4f6 541 /*!
wardm 12:02d779e8c4f6 542 * RegBitrateFrac
wardm 12:02d779e8c4f6 543 */
wardm 12:02d779e8c4f6 544 #define RF_BITRATEFRAC_MASK 0xF0
wardm 12:02d779e8c4f6 545
wardm 12:02d779e8c4f6 546 /*!
wardm 12:02d779e8c4f6 547 * RegAgcRef
wardm 12:02d779e8c4f6 548 */
wardm 12:02d779e8c4f6 549
wardm 12:02d779e8c4f6 550 /*!
wardm 12:02d779e8c4f6 551 * RegAgcThresh1
wardm 12:02d779e8c4f6 552 */
wardm 12:02d779e8c4f6 553
wardm 12:02d779e8c4f6 554 /*!
wardm 12:02d779e8c4f6 555 * RegAgcThresh2
wardm 12:02d779e8c4f6 556 */
wardm 12:02d779e8c4f6 557
wardm 12:02d779e8c4f6 558 /*!
wardm 12:02d779e8c4f6 559 * RegAgcThresh3
wardm 12:02d779e8c4f6 560 */
wardm 12:02d779e8c4f6 561
wardm 12:02d779e8c4f6 562 /*!
wardm 12:02d779e8c4f6 563 * RegPll
wardm 12:02d779e8c4f6 564 */
wardm 12:02d779e8c4f6 565 #define RF_PLL_BANDWIDTH_MASK 0x3F
wardm 12:02d779e8c4f6 566 #define RF_PLL_BANDWIDTH_75 0x00
wardm 12:02d779e8c4f6 567 #define RF_PLL_BANDWIDTH_150 0x40
wardm 12:02d779e8c4f6 568 #define RF_PLL_BANDWIDTH_225 0x80
wardm 12:02d779e8c4f6 569 #define RF_PLL_BANDWIDTH_300 0xC0 // Default
wardm 12:02d779e8c4f6 570
wardm 12:02d779e8c4f6 571 #endif // __SX1276_REGS_LORA_H__