Driver for the SX1272 RF Transceiver

Dependents:   LoRaWAN_mbed_lmic_agriculture_app

Fork of SX1272Lib by Semtech

Committer:
GTsapparellas
Date:
Mon Apr 02 12:06:02 2018 +0000
Revision:
8:60c42278731e
Parent:
7:b988b60083a1
SX1272MB2xAS LoRa shield attached on FRDM-K64F ARM mbed board.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mluis 0:45c4f0364ca4 1 /*
mluis 0:45c4f0364ca4 2 / _____) _ | |
mluis 0:45c4f0364ca4 3 ( (____ _____ ____ _| |_ _____ ____| |__
mluis 0:45c4f0364ca4 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
mluis 0:45c4f0364ca4 5 _____) ) ____| | | || |_| ____( (___| | | |
mluis 0:45c4f0364ca4 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
mluis 0:45c4f0364ca4 7 ( C )2015 Semtech
mluis 0:45c4f0364ca4 8
mluis 0:45c4f0364ca4 9 Description: -
mluis 0:45c4f0364ca4 10
mluis 0:45c4f0364ca4 11 License: Revised BSD License, see LICENSE.TXT file include in the project
mluis 0:45c4f0364ca4 12
mluis 0:45c4f0364ca4 13 Maintainers: Miguel Luis, Gregory Cristian and Nicolas Huguenin
GTsapparellas 8:60c42278731e 14 /////////////////////////////////////////////////////////////////////////////
GTsapparellas 8:60c42278731e 15
GTsapparellas 8:60c42278731e 16 Used by Giorgos Tsapparellas for Internet of Things (IoT) smart monitoring
GTsapparellas 8:60c42278731e 17 device for agriculture using LoRaWAN technology.
GTsapparellas 8:60c42278731e 18
GTsapparellas 8:60c42278731e 19 Date of issued copy: 20 January 2018
GTsapparellas 8:60c42278731e 20
GTsapparellas 8:60c42278731e 21 Modifications:
GTsapparellas 8:60c42278731e 22 - No external modifications of the existing "AS IT IS" software.
mluis 0:45c4f0364ca4 23 */
mluis 0:45c4f0364ca4 24 #ifndef __ENUMS_H__
mluis 0:45c4f0364ca4 25 #define __ENUMS_H__
mluis 0:45c4f0364ca4 26
mluis 0:45c4f0364ca4 27 /*!
mluis 0:45c4f0364ca4 28 * Radio driver internal state machine states definition
mluis 0:45c4f0364ca4 29 */
mluis 0:45c4f0364ca4 30 typedef enum RadioState
mluis 0:45c4f0364ca4 31 {
mluis 0:45c4f0364ca4 32 RF_IDLE = 0,
mluis 0:45c4f0364ca4 33 RF_RX_RUNNING,
mluis 0:45c4f0364ca4 34 RF_TX_RUNNING,
mluis 0:45c4f0364ca4 35 RF_CAD,
mluis 0:45c4f0364ca4 36 }RadioState_t;
mluis 0:45c4f0364ca4 37
mluis 0:45c4f0364ca4 38 /*!
mluis 0:45c4f0364ca4 39 * Type of the modem. [LORA / FSK]
mluis 0:45c4f0364ca4 40 */
mluis 0:45c4f0364ca4 41 typedef enum ModemType
mluis 0:45c4f0364ca4 42 {
mluis 0:45c4f0364ca4 43 MODEM_FSK = 0,
mluis 0:45c4f0364ca4 44 MODEM_LORA
mluis 0:45c4f0364ca4 45 }RadioModems_t;
mluis 0:45c4f0364ca4 46
mluis 0:45c4f0364ca4 47 /*!
GregCr 2:cd1093b6676f 48 * Type of the supported board.
mluis 0:45c4f0364ca4 49 */
mluis 0:45c4f0364ca4 50 typedef enum BoardType
mluis 0:45c4f0364ca4 51 {
GregCr 2:cd1093b6676f 52 SX1272MB2XAS = 0,
mluis 0:45c4f0364ca4 53 SX1272MB1DCS,
mluis 0:45c4f0364ca4 54 NA_MOTE_72,
dudmuck 1:b0372ef620d0 55 MDOT_F411RE,
mluis 0:45c4f0364ca4 56 UNKNOWN
mluis 0:45c4f0364ca4 57 }BoardType_t;
mluis 0:45c4f0364ca4 58
mluis 0:45c4f0364ca4 59 /*!
mluis 0:45c4f0364ca4 60 * Radio FSK modem parameters
mluis 0:45c4f0364ca4 61 */
mluis 0:45c4f0364ca4 62 typedef struct
mluis 0:45c4f0364ca4 63 {
mluis 0:45c4f0364ca4 64 int8_t Power;
mluis 0:45c4f0364ca4 65 uint32_t Fdev;
mluis 0:45c4f0364ca4 66 uint32_t Bandwidth;
mluis 0:45c4f0364ca4 67 uint32_t BandwidthAfc;
mluis 0:45c4f0364ca4 68 uint32_t Datarate;
mluis 0:45c4f0364ca4 69 uint16_t PreambleLen;
mluis 0:45c4f0364ca4 70 bool FixLen;
mluis 0:45c4f0364ca4 71 uint8_t PayloadLen;
mluis 0:45c4f0364ca4 72 bool CrcOn;
mluis 0:45c4f0364ca4 73 bool IqInverted;
mluis 0:45c4f0364ca4 74 bool RxContinuous;
mluis 0:45c4f0364ca4 75 uint32_t TxTimeout;
mluis 7:b988b60083a1 76 uint32_t RxSingleTimeout;
mluis 0:45c4f0364ca4 77 }RadioFskSettings_t;
mluis 0:45c4f0364ca4 78
mluis 0:45c4f0364ca4 79 /*!
mluis 0:45c4f0364ca4 80 * Radio FSK packet handler state
mluis 0:45c4f0364ca4 81 */
mluis 0:45c4f0364ca4 82 typedef struct
mluis 0:45c4f0364ca4 83 {
mluis 0:45c4f0364ca4 84 uint8_t PreambleDetected;
mluis 0:45c4f0364ca4 85 uint8_t SyncWordDetected;
mluis 0:45c4f0364ca4 86 int8_t RssiValue;
mluis 0:45c4f0364ca4 87 int32_t AfcValue;
mluis 0:45c4f0364ca4 88 uint8_t RxGain;
mluis 0:45c4f0364ca4 89 uint16_t Size;
mluis 0:45c4f0364ca4 90 uint16_t NbBytes;
mluis 0:45c4f0364ca4 91 uint8_t FifoThresh;
mluis 0:45c4f0364ca4 92 uint8_t ChunkSize;
mluis 0:45c4f0364ca4 93 }RadioFskPacketHandler_t;
mluis 0:45c4f0364ca4 94
mluis 0:45c4f0364ca4 95 /*!
mluis 0:45c4f0364ca4 96 * Radio LoRa modem parameters
mluis 0:45c4f0364ca4 97 */
mluis 0:45c4f0364ca4 98 typedef struct
mluis 0:45c4f0364ca4 99 {
mluis 0:45c4f0364ca4 100 int8_t Power;
mluis 0:45c4f0364ca4 101 uint32_t Bandwidth;
mluis 0:45c4f0364ca4 102 uint32_t Datarate;
mluis 0:45c4f0364ca4 103 bool LowDatarateOptimize;
mluis 0:45c4f0364ca4 104 uint8_t Coderate;
mluis 0:45c4f0364ca4 105 uint16_t PreambleLen;
mluis 0:45c4f0364ca4 106 bool FixLen;
mluis 0:45c4f0364ca4 107 uint8_t PayloadLen;
mluis 0:45c4f0364ca4 108 bool CrcOn;
mluis 0:45c4f0364ca4 109 bool FreqHopOn;
mluis 0:45c4f0364ca4 110 uint8_t HopPeriod;
mluis 0:45c4f0364ca4 111 bool IqInverted;
mluis 0:45c4f0364ca4 112 bool RxContinuous;
mluis 0:45c4f0364ca4 113 uint32_t TxTimeout;
mluis 7:b988b60083a1 114 bool PublicNetwork;
mluis 0:45c4f0364ca4 115 }RadioLoRaSettings_t;
mluis 0:45c4f0364ca4 116
mluis 0:45c4f0364ca4 117 /*!
mluis 0:45c4f0364ca4 118 * Radio LoRa packet handler state
mluis 0:45c4f0364ca4 119 */
mluis 0:45c4f0364ca4 120 typedef struct
mluis 0:45c4f0364ca4 121 {
mluis 0:45c4f0364ca4 122 int8_t SnrValue;
mluis 0:45c4f0364ca4 123 int8_t RssiValue;
mluis 0:45c4f0364ca4 124 uint8_t Size;
mluis 0:45c4f0364ca4 125 }RadioLoRaPacketHandler_t;
mluis 0:45c4f0364ca4 126
mluis 0:45c4f0364ca4 127 /*!
mluis 0:45c4f0364ca4 128 * Radio Settings
mluis 0:45c4f0364ca4 129 */
mluis 0:45c4f0364ca4 130 typedef struct
mluis 0:45c4f0364ca4 131 {
mluis 0:45c4f0364ca4 132 RadioState State;
mluis 0:45c4f0364ca4 133 ModemType Modem;
mluis 0:45c4f0364ca4 134 uint32_t Channel;
mluis 0:45c4f0364ca4 135 RadioFskSettings_t Fsk;
mluis 0:45c4f0364ca4 136 RadioFskPacketHandler_t FskPacketHandler;
mluis 0:45c4f0364ca4 137 RadioLoRaSettings_t LoRa;
mluis 0:45c4f0364ca4 138 RadioLoRaPacketHandler_t LoRaPacketHandler;
mluis 0:45c4f0364ca4 139 }RadioSettings_t;
mluis 0:45c4f0364ca4 140
mluis 0:45c4f0364ca4 141
mluis 0:45c4f0364ca4 142 #endif //__ENUMS_H__