SX1276Lib

Fork of SX1276Lib by Semtech

Committer:
GregCr
Date:
Fri Sep 19 14:16:35 2014 +0000
Revision:
7:2b555111463f
Parent:
6:e7f02929cd3d
Child:
13:618826a997e2
Added support for CAD; Changed Rssi into an int16_t

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GregCr 0:e6ceb13d2d05 1 /*
GregCr 0:e6ceb13d2d05 2 / _____) _ | |
GregCr 0:e6ceb13d2d05 3 ( (____ _____ ____ _| |_ _____ ____| |__
GregCr 0:e6ceb13d2d05 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
GregCr 0:e6ceb13d2d05 5 _____) ) ____| | | || |_| ____( (___| | | |
GregCr 0:e6ceb13d2d05 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
GregCr 0:e6ceb13d2d05 7 ( C )2014 Semtech
GregCr 0:e6ceb13d2d05 8
GregCr 0:e6ceb13d2d05 9 Description: -
GregCr 0:e6ceb13d2d05 10
GregCr 0:e6ceb13d2d05 11 License: Revised BSD License, see LICENSE.TXT file include in the project
GregCr 0:e6ceb13d2d05 12
GregCr 0:e6ceb13d2d05 13 Maintainers: Miguel Luis, Gregory Cristian and Nicolas Huguenin
GregCr 0:e6ceb13d2d05 14 */
GregCr 0:e6ceb13d2d05 15 #ifndef __ENUMS_H__
GregCr 0:e6ceb13d2d05 16 #define __ENUMS_H__
GregCr 0:e6ceb13d2d05 17
GregCr 0:e6ceb13d2d05 18 /*!
GregCr 0:e6ceb13d2d05 19 * State of the radio:
GregCr 0:e6ceb13d2d05 20 * [IDLE,
GregCr 0:e6ceb13d2d05 21 * RX_RUNNING, RX_TIMEOUT, RX_ERROR,
GregCr 7:2b555111463f 22 * TX_RUNNING, TX_TIMEOUT,
GregCr 7:2b555111463f 23 CAD]
GregCr 0:e6ceb13d2d05 24 */
GregCr 0:e6ceb13d2d05 25 enum RadioState
GregCr 0:e6ceb13d2d05 26 {
GregCr 3:ca84be1f3fac 27 LOWPOWER = 0,
GregCr 0:e6ceb13d2d05 28 IDLE,
GregCr 0:e6ceb13d2d05 29
GregCr 0:e6ceb13d2d05 30 RX,
GregCr 0:e6ceb13d2d05 31 RX_TIMEOUT,
GregCr 0:e6ceb13d2d05 32 RX_ERROR,
GregCr 0:e6ceb13d2d05 33
GregCr 0:e6ceb13d2d05 34 TX,
GregCr 7:2b555111463f 35 TX_TIMEOUT,
GregCr 7:2b555111463f 36
GregCr 7:2b555111463f 37 CAD,
GregCr 7:2b555111463f 38 CAD_DONE
GregCr 0:e6ceb13d2d05 39 };
GregCr 0:e6ceb13d2d05 40
GregCr 0:e6ceb13d2d05 41 /*!
GregCr 0:e6ceb13d2d05 42 * Type of the modem. [LORA / FSK]
GregCr 0:e6ceb13d2d05 43 */
GregCr 0:e6ceb13d2d05 44 enum ModemType
GregCr 0:e6ceb13d2d05 45 {
GregCr 3:ca84be1f3fac 46 MODEM_FSK = 0,
GregCr 0:e6ceb13d2d05 47 MODEM_LORA
GregCr 0:e6ceb13d2d05 48 };
GregCr 0:e6ceb13d2d05 49
GregCr 2:5eb3066446dd 50 /*!
GregCr 2:5eb3066446dd 51 * Type of the supported board. [SX1276MB1MAS / SX1276MB1LAS]
GregCr 2:5eb3066446dd 52 */
GregCr 2:5eb3066446dd 53 enum BoardType
GregCr 2:5eb3066446dd 54 {
GregCr 3:ca84be1f3fac 55 SX1276MB1MAS = 0,
GregCr 5:11ec8a6ba4f0 56 SX1276MB1LAS,
GregCr 5:11ec8a6ba4f0 57 UNKNOWN
GregCr 2:5eb3066446dd 58 };
GregCr 0:e6ceb13d2d05 59 /*!
GregCr 0:e6ceb13d2d05 60 * Radio FSK modem parameters
GregCr 0:e6ceb13d2d05 61 */
GregCr 0:e6ceb13d2d05 62 typedef struct
GregCr 0:e6ceb13d2d05 63 {
GregCr 0:e6ceb13d2d05 64 int8_t Power;
GregCr 0:e6ceb13d2d05 65 uint32_t Fdev;
GregCr 0:e6ceb13d2d05 66 uint32_t Bandwidth;
GregCr 0:e6ceb13d2d05 67 uint32_t BandwidthAfc;
GregCr 0:e6ceb13d2d05 68 uint32_t Datarate;
GregCr 0:e6ceb13d2d05 69 uint16_t PreambleLen;
GregCr 0:e6ceb13d2d05 70 bool FixLen;
GregCr 0:e6ceb13d2d05 71 bool CrcOn;
GregCr 0:e6ceb13d2d05 72 bool IqInverted;
GregCr 0:e6ceb13d2d05 73 bool RxContinuous;
GregCr 0:e6ceb13d2d05 74 uint32_t TxTimeout;
GregCr 0:e6ceb13d2d05 75 }RadioFskSettings_t;
GregCr 0:e6ceb13d2d05 76
GregCr 0:e6ceb13d2d05 77 /*!
GregCr 0:e6ceb13d2d05 78 * Radio FSK packet handler state
GregCr 0:e6ceb13d2d05 79 */
GregCr 0:e6ceb13d2d05 80 typedef struct
GregCr 0:e6ceb13d2d05 81 {
GregCr 0:e6ceb13d2d05 82 uint8_t PreambleDetected;
GregCr 0:e6ceb13d2d05 83 uint8_t SyncWordDetected;
GregCr 0:e6ceb13d2d05 84 int8_t RssiValue;
GregCr 0:e6ceb13d2d05 85 int32_t AfcValue;
GregCr 0:e6ceb13d2d05 86 uint8_t RxGain;
GregCr 0:e6ceb13d2d05 87 uint16_t Size;
GregCr 0:e6ceb13d2d05 88 uint16_t NbBytes;
GregCr 0:e6ceb13d2d05 89 uint8_t FifoThresh;
GregCr 0:e6ceb13d2d05 90 uint8_t ChunkSize;
GregCr 0:e6ceb13d2d05 91 }RadioFskPacketHandler_t;
GregCr 0:e6ceb13d2d05 92
GregCr 0:e6ceb13d2d05 93 /*!
GregCr 0:e6ceb13d2d05 94 * Radio LoRa modem parameters
GregCr 0:e6ceb13d2d05 95 */
GregCr 0:e6ceb13d2d05 96 typedef struct
GregCr 0:e6ceb13d2d05 97 {
GregCr 0:e6ceb13d2d05 98 int8_t Power;
GregCr 0:e6ceb13d2d05 99 uint32_t Bandwidth;
GregCr 0:e6ceb13d2d05 100 uint32_t Datarate;
GregCr 0:e6ceb13d2d05 101 bool LowDatarateOptimize;
GregCr 0:e6ceb13d2d05 102 uint8_t Coderate;
GregCr 0:e6ceb13d2d05 103 uint16_t PreambleLen;
GregCr 0:e6ceb13d2d05 104 bool FixLen;
GregCr 0:e6ceb13d2d05 105 bool CrcOn;
GregCr 6:e7f02929cd3d 106 bool FreqHopOn;
GregCr 6:e7f02929cd3d 107 uint8_t HopPeriod;
GregCr 0:e6ceb13d2d05 108 bool IqInverted;
GregCr 0:e6ceb13d2d05 109 bool RxContinuous;
GregCr 0:e6ceb13d2d05 110 uint32_t TxTimeout;
GregCr 0:e6ceb13d2d05 111 }RadioLoRaSettings_t;
GregCr 0:e6ceb13d2d05 112
GregCr 0:e6ceb13d2d05 113 /*!
GregCr 0:e6ceb13d2d05 114 * Radio LoRa packet handler state
GregCr 0:e6ceb13d2d05 115 */
GregCr 0:e6ceb13d2d05 116 typedef struct
GregCr 0:e6ceb13d2d05 117 {
GregCr 0:e6ceb13d2d05 118 int8_t SnrValue;
GregCr 0:e6ceb13d2d05 119 int8_t RssiValue;
GregCr 0:e6ceb13d2d05 120 uint8_t Size;
GregCr 0:e6ceb13d2d05 121 }RadioLoRaPacketHandler_t;
GregCr 0:e6ceb13d2d05 122
GregCr 0:e6ceb13d2d05 123 /*!
GregCr 0:e6ceb13d2d05 124 * Radio Settings
GregCr 0:e6ceb13d2d05 125 */
GregCr 0:e6ceb13d2d05 126 typedef struct
GregCr 0:e6ceb13d2d05 127 {
GregCr 5:11ec8a6ba4f0 128 RadioState State;
GregCr 0:e6ceb13d2d05 129 ModemType Modem;
GregCr 0:e6ceb13d2d05 130 uint32_t Channel;
GregCr 0:e6ceb13d2d05 131 RadioFskSettings_t Fsk;
GregCr 0:e6ceb13d2d05 132 RadioFskPacketHandler_t FskPacketHandler;
GregCr 0:e6ceb13d2d05 133 RadioLoRaSettings_t LoRa;
GregCr 0:e6ceb13d2d05 134 RadioLoRaPacketHandler_t LoRaPacketHandler;
GregCr 0:e6ceb13d2d05 135 }RadioSettings_t;
GregCr 0:e6ceb13d2d05 136
GregCr 0:e6ceb13d2d05 137
GregCr 0:e6ceb13d2d05 138 #endif //__ENUMS_H__
GregCr 0:e6ceb13d2d05 139