1272 driver for lorawan, which is compatible with current mbed-os
Dependents: LoRaWAN-demo-72-bootcamp
Fork of SX1272Lib by
enums/enums.h@7:b988b60083a1, 2017-04-24 (annotated)
- Committer:
- mluis
- Date:
- Mon Apr 24 09:26:08 2017 +0000
- Revision:
- 7:b988b60083a1
- Parent:
- 2:cd1093b6676f
WARNING: Radio API timings changed from micro-seconds to milliseconds; ; Synchronized with https://github.com/Lora-net/LoRaMac-node git revision e506c246652fa44c3f24cecb89d0707b49ece739
Who changed what in which revision?
User | Revision | Line number | New 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 | /*! |
GregCr | 2:cd1093b6676f | 39 | * Type of the supported board. |
mluis | 0:45c4f0364ca4 | 40 | */ |
mluis | 0:45c4f0364ca4 | 41 | typedef enum BoardType |
mluis | 0:45c4f0364ca4 | 42 | { |
GregCr | 2:cd1093b6676f | 43 | SX1272MB2XAS = 0, |
mluis | 0:45c4f0364ca4 | 44 | SX1272MB1DCS, |
mluis | 0:45c4f0364ca4 | 45 | NA_MOTE_72, |
dudmuck | 1:b0372ef620d0 | 46 | MDOT_F411RE, |
mluis | 0:45c4f0364ca4 | 47 | UNKNOWN |
mluis | 0:45c4f0364ca4 | 48 | }BoardType_t; |
mluis | 0:45c4f0364ca4 | 49 | |
mluis | 0:45c4f0364ca4 | 50 | /*! |
mluis | 0:45c4f0364ca4 | 51 | * Radio FSK modem parameters |
mluis | 0:45c4f0364ca4 | 52 | */ |
mluis | 0:45c4f0364ca4 | 53 | typedef struct |
mluis | 0:45c4f0364ca4 | 54 | { |
mluis | 0:45c4f0364ca4 | 55 | int8_t Power; |
mluis | 0:45c4f0364ca4 | 56 | uint32_t Fdev; |
mluis | 0:45c4f0364ca4 | 57 | uint32_t Bandwidth; |
mluis | 0:45c4f0364ca4 | 58 | uint32_t BandwidthAfc; |
mluis | 0:45c4f0364ca4 | 59 | uint32_t Datarate; |
mluis | 0:45c4f0364ca4 | 60 | uint16_t PreambleLen; |
mluis | 0:45c4f0364ca4 | 61 | bool FixLen; |
mluis | 0:45c4f0364ca4 | 62 | uint8_t PayloadLen; |
mluis | 0:45c4f0364ca4 | 63 | bool CrcOn; |
mluis | 0:45c4f0364ca4 | 64 | bool IqInverted; |
mluis | 0:45c4f0364ca4 | 65 | bool RxContinuous; |
mluis | 0:45c4f0364ca4 | 66 | uint32_t TxTimeout; |
mluis | 7:b988b60083a1 | 67 | uint32_t RxSingleTimeout; |
mluis | 0:45c4f0364ca4 | 68 | }RadioFskSettings_t; |
mluis | 0:45c4f0364ca4 | 69 | |
mluis | 0:45c4f0364ca4 | 70 | /*! |
mluis | 0:45c4f0364ca4 | 71 | * Radio FSK packet handler state |
mluis | 0:45c4f0364ca4 | 72 | */ |
mluis | 0:45c4f0364ca4 | 73 | typedef struct |
mluis | 0:45c4f0364ca4 | 74 | { |
mluis | 0:45c4f0364ca4 | 75 | uint8_t PreambleDetected; |
mluis | 0:45c4f0364ca4 | 76 | uint8_t SyncWordDetected; |
mluis | 0:45c4f0364ca4 | 77 | int8_t RssiValue; |
mluis | 0:45c4f0364ca4 | 78 | int32_t AfcValue; |
mluis | 0:45c4f0364ca4 | 79 | uint8_t RxGain; |
mluis | 0:45c4f0364ca4 | 80 | uint16_t Size; |
mluis | 0:45c4f0364ca4 | 81 | uint16_t NbBytes; |
mluis | 0:45c4f0364ca4 | 82 | uint8_t FifoThresh; |
mluis | 0:45c4f0364ca4 | 83 | uint8_t ChunkSize; |
mluis | 0:45c4f0364ca4 | 84 | }RadioFskPacketHandler_t; |
mluis | 0:45c4f0364ca4 | 85 | |
mluis | 0:45c4f0364ca4 | 86 | /*! |
mluis | 0:45c4f0364ca4 | 87 | * Radio LoRa modem parameters |
mluis | 0:45c4f0364ca4 | 88 | */ |
mluis | 0:45c4f0364ca4 | 89 | typedef struct |
mluis | 0:45c4f0364ca4 | 90 | { |
mluis | 0:45c4f0364ca4 | 91 | int8_t Power; |
mluis | 0:45c4f0364ca4 | 92 | uint32_t Bandwidth; |
mluis | 0:45c4f0364ca4 | 93 | uint32_t Datarate; |
mluis | 0:45c4f0364ca4 | 94 | bool LowDatarateOptimize; |
mluis | 0:45c4f0364ca4 | 95 | uint8_t Coderate; |
mluis | 0:45c4f0364ca4 | 96 | uint16_t PreambleLen; |
mluis | 0:45c4f0364ca4 | 97 | bool FixLen; |
mluis | 0:45c4f0364ca4 | 98 | uint8_t PayloadLen; |
mluis | 0:45c4f0364ca4 | 99 | bool CrcOn; |
mluis | 0:45c4f0364ca4 | 100 | bool FreqHopOn; |
mluis | 0:45c4f0364ca4 | 101 | uint8_t HopPeriod; |
mluis | 0:45c4f0364ca4 | 102 | bool IqInverted; |
mluis | 0:45c4f0364ca4 | 103 | bool RxContinuous; |
mluis | 0:45c4f0364ca4 | 104 | uint32_t TxTimeout; |
mluis | 7:b988b60083a1 | 105 | bool PublicNetwork; |
mluis | 0:45c4f0364ca4 | 106 | }RadioLoRaSettings_t; |
mluis | 0:45c4f0364ca4 | 107 | |
mluis | 0:45c4f0364ca4 | 108 | /*! |
mluis | 0:45c4f0364ca4 | 109 | * Radio LoRa packet handler state |
mluis | 0:45c4f0364ca4 | 110 | */ |
mluis | 0:45c4f0364ca4 | 111 | typedef struct |
mluis | 0:45c4f0364ca4 | 112 | { |
mluis | 0:45c4f0364ca4 | 113 | int8_t SnrValue; |
mluis | 0:45c4f0364ca4 | 114 | int8_t RssiValue; |
mluis | 0:45c4f0364ca4 | 115 | uint8_t Size; |
mluis | 0:45c4f0364ca4 | 116 | }RadioLoRaPacketHandler_t; |
mluis | 0:45c4f0364ca4 | 117 | |
mluis | 0:45c4f0364ca4 | 118 | /*! |
mluis | 0:45c4f0364ca4 | 119 | * Radio Settings |
mluis | 0:45c4f0364ca4 | 120 | */ |
mluis | 0:45c4f0364ca4 | 121 | typedef struct |
mluis | 0:45c4f0364ca4 | 122 | { |
mluis | 0:45c4f0364ca4 | 123 | RadioState State; |
mluis | 0:45c4f0364ca4 | 124 | ModemType Modem; |
mluis | 0:45c4f0364ca4 | 125 | uint32_t Channel; |
mluis | 0:45c4f0364ca4 | 126 | RadioFskSettings_t Fsk; |
mluis | 0:45c4f0364ca4 | 127 | RadioFskPacketHandler_t FskPacketHandler; |
mluis | 0:45c4f0364ca4 | 128 | RadioLoRaSettings_t LoRa; |
mluis | 0:45c4f0364ca4 | 129 | RadioLoRaPacketHandler_t LoRaPacketHandler; |
mluis | 0:45c4f0364ca4 | 130 | }RadioSettings_t; |
mluis | 0:45c4f0364ca4 | 131 | |
mluis | 0:45c4f0364ca4 | 132 | |
mluis | 0:45c4f0364ca4 | 133 | #endif //__ENUMS_H__ |