![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Updated the code with Class C Lorawan
Dependencies: mbed LoRaWAN-lib
radio/SX1276Lib/enums/enums.h@12:813e9e5f5ff6, 2019-03-22 (annotated)
- Committer:
- amirchaudhary
- Date:
- Fri Mar 22 16:24:25 2019 +0000
- Revision:
- 12:813e9e5f5ff6
Updated the code to Class C Lorawan.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
amirchaudhary | 12:813e9e5f5ff6 | 1 | /* |
amirchaudhary | 12:813e9e5f5ff6 | 2 | / _____) _ | | |
amirchaudhary | 12:813e9e5f5ff6 | 3 | ( (____ _____ ____ _| |_ _____ ____| |__ |
amirchaudhary | 12:813e9e5f5ff6 | 4 | \____ \| ___ | (_ _) ___ |/ ___) _ \ |
amirchaudhary | 12:813e9e5f5ff6 | 5 | _____) ) ____| | | || |_| ____( (___| | | | |
amirchaudhary | 12:813e9e5f5ff6 | 6 | (______/|_____)_|_|_| \__)_____)\____)_| |_| |
amirchaudhary | 12:813e9e5f5ff6 | 7 | (C) 2014 Semtech |
amirchaudhary | 12:813e9e5f5ff6 | 8 | |
amirchaudhary | 12:813e9e5f5ff6 | 9 | Description: - |
amirchaudhary | 12:813e9e5f5ff6 | 10 | |
amirchaudhary | 12:813e9e5f5ff6 | 11 | License: Revised BSD License, see LICENSE.TXT file include in the project |
amirchaudhary | 12:813e9e5f5ff6 | 12 | |
amirchaudhary | 12:813e9e5f5ff6 | 13 | Maintainers: Miguel Luis, Gregory Cristian and Nicolas Huguenin |
amirchaudhary | 12:813e9e5f5ff6 | 14 | */ |
amirchaudhary | 12:813e9e5f5ff6 | 15 | #ifndef __ENUMS_H__ |
amirchaudhary | 12:813e9e5f5ff6 | 16 | #define __ENUMS_H__ |
amirchaudhary | 12:813e9e5f5ff6 | 17 | |
amirchaudhary | 12:813e9e5f5ff6 | 18 | /*! |
amirchaudhary | 12:813e9e5f5ff6 | 19 | * Radio driver internal state machine states definition |
amirchaudhary | 12:813e9e5f5ff6 | 20 | */ |
amirchaudhary | 12:813e9e5f5ff6 | 21 | typedef enum RadioState |
amirchaudhary | 12:813e9e5f5ff6 | 22 | { |
amirchaudhary | 12:813e9e5f5ff6 | 23 | RF_IDLE = 0, |
amirchaudhary | 12:813e9e5f5ff6 | 24 | RF_RX_RUNNING, |
amirchaudhary | 12:813e9e5f5ff6 | 25 | RF_TX_RUNNING, |
amirchaudhary | 12:813e9e5f5ff6 | 26 | RF_CAD, |
amirchaudhary | 12:813e9e5f5ff6 | 27 | }RadioState_t; |
amirchaudhary | 12:813e9e5f5ff6 | 28 | |
amirchaudhary | 12:813e9e5f5ff6 | 29 | /*! |
amirchaudhary | 12:813e9e5f5ff6 | 30 | * Type of the modem. [LORA / FSK] |
amirchaudhary | 12:813e9e5f5ff6 | 31 | */ |
amirchaudhary | 12:813e9e5f5ff6 | 32 | typedef enum ModemType |
amirchaudhary | 12:813e9e5f5ff6 | 33 | { |
amirchaudhary | 12:813e9e5f5ff6 | 34 | MODEM_FSK = 0, |
amirchaudhary | 12:813e9e5f5ff6 | 35 | MODEM_LORA |
amirchaudhary | 12:813e9e5f5ff6 | 36 | }RadioModems_t; |
amirchaudhary | 12:813e9e5f5ff6 | 37 | |
amirchaudhary | 12:813e9e5f5ff6 | 38 | /*! |
amirchaudhary | 12:813e9e5f5ff6 | 39 | * Type of the supported board. [SX1276MB1MAS / SX1276MB1LAS] |
amirchaudhary | 12:813e9e5f5ff6 | 40 | */ |
amirchaudhary | 12:813e9e5f5ff6 | 41 | typedef enum BoardType |
amirchaudhary | 12:813e9e5f5ff6 | 42 | { |
amirchaudhary | 12:813e9e5f5ff6 | 43 | SX1276MB1MAS = 0, |
amirchaudhary | 12:813e9e5f5ff6 | 44 | SX1276MB1LAS, |
amirchaudhary | 12:813e9e5f5ff6 | 45 | UNKNOWN |
amirchaudhary | 12:813e9e5f5ff6 | 46 | }BoardType_t; |
amirchaudhary | 12:813e9e5f5ff6 | 47 | |
amirchaudhary | 12:813e9e5f5ff6 | 48 | /*! |
amirchaudhary | 12:813e9e5f5ff6 | 49 | * Radio FSK modem parameters |
amirchaudhary | 12:813e9e5f5ff6 | 50 | */ |
amirchaudhary | 12:813e9e5f5ff6 | 51 | typedef struct |
amirchaudhary | 12:813e9e5f5ff6 | 52 | { |
amirchaudhary | 12:813e9e5f5ff6 | 53 | int8_t Power; |
amirchaudhary | 12:813e9e5f5ff6 | 54 | uint32_t Fdev; |
amirchaudhary | 12:813e9e5f5ff6 | 55 | uint32_t Bandwidth; |
amirchaudhary | 12:813e9e5f5ff6 | 56 | uint32_t BandwidthAfc; |
amirchaudhary | 12:813e9e5f5ff6 | 57 | uint32_t Datarate; |
amirchaudhary | 12:813e9e5f5ff6 | 58 | uint16_t PreambleLen; |
amirchaudhary | 12:813e9e5f5ff6 | 59 | bool FixLen; |
amirchaudhary | 12:813e9e5f5ff6 | 60 | uint8_t PayloadLen; |
amirchaudhary | 12:813e9e5f5ff6 | 61 | bool CrcOn; |
amirchaudhary | 12:813e9e5f5ff6 | 62 | bool IqInverted; |
amirchaudhary | 12:813e9e5f5ff6 | 63 | bool RxContinuous; |
amirchaudhary | 12:813e9e5f5ff6 | 64 | uint32_t TxTimeout; |
amirchaudhary | 12:813e9e5f5ff6 | 65 | uint32_t RxSingleTimeout; |
amirchaudhary | 12:813e9e5f5ff6 | 66 | }RadioFskSettings_t; |
amirchaudhary | 12:813e9e5f5ff6 | 67 | |
amirchaudhary | 12:813e9e5f5ff6 | 68 | /*! |
amirchaudhary | 12:813e9e5f5ff6 | 69 | * Radio FSK packet handler state |
amirchaudhary | 12:813e9e5f5ff6 | 70 | */ |
amirchaudhary | 12:813e9e5f5ff6 | 71 | typedef struct |
amirchaudhary | 12:813e9e5f5ff6 | 72 | { |
amirchaudhary | 12:813e9e5f5ff6 | 73 | uint8_t PreambleDetected; |
amirchaudhary | 12:813e9e5f5ff6 | 74 | uint8_t SyncWordDetected; |
amirchaudhary | 12:813e9e5f5ff6 | 75 | int8_t RssiValue; |
amirchaudhary | 12:813e9e5f5ff6 | 76 | int32_t AfcValue; |
amirchaudhary | 12:813e9e5f5ff6 | 77 | uint8_t RxGain; |
amirchaudhary | 12:813e9e5f5ff6 | 78 | uint16_t Size; |
amirchaudhary | 12:813e9e5f5ff6 | 79 | uint16_t NbBytes; |
amirchaudhary | 12:813e9e5f5ff6 | 80 | uint8_t FifoThresh; |
amirchaudhary | 12:813e9e5f5ff6 | 81 | uint8_t ChunkSize; |
amirchaudhary | 12:813e9e5f5ff6 | 82 | }RadioFskPacketHandler_t; |
amirchaudhary | 12:813e9e5f5ff6 | 83 | |
amirchaudhary | 12:813e9e5f5ff6 | 84 | /*! |
amirchaudhary | 12:813e9e5f5ff6 | 85 | * Radio LoRa modem parameters |
amirchaudhary | 12:813e9e5f5ff6 | 86 | */ |
amirchaudhary | 12:813e9e5f5ff6 | 87 | typedef struct |
amirchaudhary | 12:813e9e5f5ff6 | 88 | { |
amirchaudhary | 12:813e9e5f5ff6 | 89 | int8_t Power; |
amirchaudhary | 12:813e9e5f5ff6 | 90 | uint32_t Bandwidth; |
amirchaudhary | 12:813e9e5f5ff6 | 91 | uint32_t Datarate; |
amirchaudhary | 12:813e9e5f5ff6 | 92 | bool LowDatarateOptimize; |
amirchaudhary | 12:813e9e5f5ff6 | 93 | uint8_t Coderate; |
amirchaudhary | 12:813e9e5f5ff6 | 94 | uint16_t PreambleLen; |
amirchaudhary | 12:813e9e5f5ff6 | 95 | bool FixLen; |
amirchaudhary | 12:813e9e5f5ff6 | 96 | uint8_t PayloadLen; |
amirchaudhary | 12:813e9e5f5ff6 | 97 | bool CrcOn; |
amirchaudhary | 12:813e9e5f5ff6 | 98 | bool FreqHopOn; |
amirchaudhary | 12:813e9e5f5ff6 | 99 | uint8_t HopPeriod; |
amirchaudhary | 12:813e9e5f5ff6 | 100 | bool IqInverted; |
amirchaudhary | 12:813e9e5f5ff6 | 101 | bool RxContinuous; |
amirchaudhary | 12:813e9e5f5ff6 | 102 | uint32_t TxTimeout; |
amirchaudhary | 12:813e9e5f5ff6 | 103 | bool PublicNetwork; |
amirchaudhary | 12:813e9e5f5ff6 | 104 | }RadioLoRaSettings_t; |
amirchaudhary | 12:813e9e5f5ff6 | 105 | |
amirchaudhary | 12:813e9e5f5ff6 | 106 | /*! |
amirchaudhary | 12:813e9e5f5ff6 | 107 | * Radio LoRa packet handler state |
amirchaudhary | 12:813e9e5f5ff6 | 108 | */ |
amirchaudhary | 12:813e9e5f5ff6 | 109 | typedef struct |
amirchaudhary | 12:813e9e5f5ff6 | 110 | { |
amirchaudhary | 12:813e9e5f5ff6 | 111 | int8_t SnrValue; |
amirchaudhary | 12:813e9e5f5ff6 | 112 | int8_t RssiValue; |
amirchaudhary | 12:813e9e5f5ff6 | 113 | uint8_t Size; |
amirchaudhary | 12:813e9e5f5ff6 | 114 | }RadioLoRaPacketHandler_t; |
amirchaudhary | 12:813e9e5f5ff6 | 115 | |
amirchaudhary | 12:813e9e5f5ff6 | 116 | /*! |
amirchaudhary | 12:813e9e5f5ff6 | 117 | * Radio Settings |
amirchaudhary | 12:813e9e5f5ff6 | 118 | */ |
amirchaudhary | 12:813e9e5f5ff6 | 119 | typedef struct |
amirchaudhary | 12:813e9e5f5ff6 | 120 | { |
amirchaudhary | 12:813e9e5f5ff6 | 121 | RadioState State; |
amirchaudhary | 12:813e9e5f5ff6 | 122 | ModemType Modem; |
amirchaudhary | 12:813e9e5f5ff6 | 123 | uint32_t Channel; |
amirchaudhary | 12:813e9e5f5ff6 | 124 | RadioFskSettings_t Fsk; |
amirchaudhary | 12:813e9e5f5ff6 | 125 | RadioFskPacketHandler_t FskPacketHandler; |
amirchaudhary | 12:813e9e5f5ff6 | 126 | RadioLoRaSettings_t LoRa; |
amirchaudhary | 12:813e9e5f5ff6 | 127 | RadioLoRaPacketHandler_t LoRaPacketHandler; |
amirchaudhary | 12:813e9e5f5ff6 | 128 | }RadioSettings_t; |
amirchaudhary | 12:813e9e5f5ff6 | 129 | |
amirchaudhary | 12:813e9e5f5ff6 | 130 | |
amirchaudhary | 12:813e9e5f5ff6 | 131 | #endif //__ENUMS_H__ |