1272 driver for lorawan, which is compatible with current mbed-os

Dependents:   LoRaWAN-demo-72-bootcamp

Fork of SX1272Lib by Semtech

Committer:
mluis
Date:
Tue Jan 05 16:43:48 2016 +0000
Revision:
0:45c4f0364ca4
Child:
1:b0372ef620d0
Library creation based on SX1276Lib and https://github.com/Lora-net/LoRaMac-node

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
mluis 0:45c4f0364ca4 14 */
mluis 0:45c4f0364ca4 15 #ifndef __ENUMS_H__
mluis 0:45c4f0364ca4 16 #define __ENUMS_H__
mluis 0:45c4f0364ca4 17
mluis 0:45c4f0364ca4 18 /*!
mluis 0:45c4f0364ca4 19 * Radio driver internal state machine states definition
mluis 0:45c4f0364ca4 20 */
mluis 0:45c4f0364ca4 21 typedef enum RadioState
mluis 0:45c4f0364ca4 22 {
mluis 0:45c4f0364ca4 23 RF_IDLE = 0,
mluis 0:45c4f0364ca4 24 RF_RX_RUNNING,
mluis 0:45c4f0364ca4 25 RF_TX_RUNNING,
mluis 0:45c4f0364ca4 26 RF_CAD,
mluis 0:45c4f0364ca4 27 }RadioState_t;
mluis 0:45c4f0364ca4 28
mluis 0:45c4f0364ca4 29 /*!
mluis 0:45c4f0364ca4 30 * Type of the modem. [LORA / FSK]
mluis 0:45c4f0364ca4 31 */
mluis 0:45c4f0364ca4 32 typedef enum ModemType
mluis 0:45c4f0364ca4 33 {
mluis 0:45c4f0364ca4 34 MODEM_FSK = 0,
mluis 0:45c4f0364ca4 35 MODEM_LORA
mluis 0:45c4f0364ca4 36 }RadioModems_t;
mluis 0:45c4f0364ca4 37
mluis 0:45c4f0364ca4 38 /*!
mluis 0:45c4f0364ca4 39 * Type of the supported board. [SX1272MB1DAS / SX1272MB1DCS]
mluis 0:45c4f0364ca4 40 */
mluis 0:45c4f0364ca4 41 typedef enum BoardType
mluis 0:45c4f0364ca4 42 {
mluis 0:45c4f0364ca4 43 SX1272MB1DAS = 0,
mluis 0:45c4f0364ca4 44 SX1272MB1DCS,
mluis 0:45c4f0364ca4 45 NA_MOTE_72,
mluis 0:45c4f0364ca4 46 UNKNOWN
mluis 0:45c4f0364ca4 47 }BoardType_t;
mluis 0:45c4f0364ca4 48
mluis 0:45c4f0364ca4 49 /*!
mluis 0:45c4f0364ca4 50 * Radio FSK modem parameters
mluis 0:45c4f0364ca4 51 */
mluis 0:45c4f0364ca4 52 typedef struct
mluis 0:45c4f0364ca4 53 {
mluis 0:45c4f0364ca4 54 int8_t Power;
mluis 0:45c4f0364ca4 55 uint32_t Fdev;
mluis 0:45c4f0364ca4 56 uint32_t Bandwidth;
mluis 0:45c4f0364ca4 57 uint32_t BandwidthAfc;
mluis 0:45c4f0364ca4 58 uint32_t Datarate;
mluis 0:45c4f0364ca4 59 uint16_t PreambleLen;
mluis 0:45c4f0364ca4 60 bool FixLen;
mluis 0:45c4f0364ca4 61 uint8_t PayloadLen;
mluis 0:45c4f0364ca4 62 bool CrcOn;
mluis 0:45c4f0364ca4 63 bool IqInverted;
mluis 0:45c4f0364ca4 64 bool RxContinuous;
mluis 0:45c4f0364ca4 65 uint32_t TxTimeout;
mluis 0:45c4f0364ca4 66 }RadioFskSettings_t;
mluis 0:45c4f0364ca4 67
mluis 0:45c4f0364ca4 68 /*!
mluis 0:45c4f0364ca4 69 * Radio FSK packet handler state
mluis 0:45c4f0364ca4 70 */
mluis 0:45c4f0364ca4 71 typedef struct
mluis 0:45c4f0364ca4 72 {
mluis 0:45c4f0364ca4 73 uint8_t PreambleDetected;
mluis 0:45c4f0364ca4 74 uint8_t SyncWordDetected;
mluis 0:45c4f0364ca4 75 int8_t RssiValue;
mluis 0:45c4f0364ca4 76 int32_t AfcValue;
mluis 0:45c4f0364ca4 77 uint8_t RxGain;
mluis 0:45c4f0364ca4 78 uint16_t Size;
mluis 0:45c4f0364ca4 79 uint16_t NbBytes;
mluis 0:45c4f0364ca4 80 uint8_t FifoThresh;
mluis 0:45c4f0364ca4 81 uint8_t ChunkSize;
mluis 0:45c4f0364ca4 82 }RadioFskPacketHandler_t;
mluis 0:45c4f0364ca4 83
mluis 0:45c4f0364ca4 84 /*!
mluis 0:45c4f0364ca4 85 * Radio LoRa modem parameters
mluis 0:45c4f0364ca4 86 */
mluis 0:45c4f0364ca4 87 typedef struct
mluis 0:45c4f0364ca4 88 {
mluis 0:45c4f0364ca4 89 int8_t Power;
mluis 0:45c4f0364ca4 90 uint32_t Bandwidth;
mluis 0:45c4f0364ca4 91 uint32_t Datarate;
mluis 0:45c4f0364ca4 92 bool LowDatarateOptimize;
mluis 0:45c4f0364ca4 93 uint8_t Coderate;
mluis 0:45c4f0364ca4 94 uint16_t PreambleLen;
mluis 0:45c4f0364ca4 95 bool FixLen;
mluis 0:45c4f0364ca4 96 uint8_t PayloadLen;
mluis 0:45c4f0364ca4 97 bool CrcOn;
mluis 0:45c4f0364ca4 98 bool FreqHopOn;
mluis 0:45c4f0364ca4 99 uint8_t HopPeriod;
mluis 0:45c4f0364ca4 100 bool IqInverted;
mluis 0:45c4f0364ca4 101 bool RxContinuous;
mluis 0:45c4f0364ca4 102 uint32_t TxTimeout;
mluis 0:45c4f0364ca4 103 }RadioLoRaSettings_t;
mluis 0:45c4f0364ca4 104
mluis 0:45c4f0364ca4 105 /*!
mluis 0:45c4f0364ca4 106 * Radio LoRa packet handler state
mluis 0:45c4f0364ca4 107 */
mluis 0:45c4f0364ca4 108 typedef struct
mluis 0:45c4f0364ca4 109 {
mluis 0:45c4f0364ca4 110 int8_t SnrValue;
mluis 0:45c4f0364ca4 111 int8_t RssiValue;
mluis 0:45c4f0364ca4 112 uint8_t Size;
mluis 0:45c4f0364ca4 113 }RadioLoRaPacketHandler_t;
mluis 0:45c4f0364ca4 114
mluis 0:45c4f0364ca4 115 /*!
mluis 0:45c4f0364ca4 116 * Radio Settings
mluis 0:45c4f0364ca4 117 */
mluis 0:45c4f0364ca4 118 typedef struct
mluis 0:45c4f0364ca4 119 {
mluis 0:45c4f0364ca4 120 RadioState State;
mluis 0:45c4f0364ca4 121 ModemType Modem;
mluis 0:45c4f0364ca4 122 uint32_t Channel;
mluis 0:45c4f0364ca4 123 RadioFskSettings_t Fsk;
mluis 0:45c4f0364ca4 124 RadioFskPacketHandler_t FskPacketHandler;
mluis 0:45c4f0364ca4 125 RadioLoRaSettings_t LoRa;
mluis 0:45c4f0364ca4 126 RadioLoRaPacketHandler_t LoRaPacketHandler;
mluis 0:45c4f0364ca4 127 }RadioSettings_t;
mluis 0:45c4f0364ca4 128
mluis 0:45c4f0364ca4 129
mluis 0:45c4f0364ca4 130 #endif //__ENUMS_H__