sanfan-lora

Fork of SX1276Lib by lzbp li

Committer:
mluis
Date:
Tue Dec 16 10:02:45 2014 +0000
Revision:
13:618826a997e2
Parent:
7:2b555111463f
Child:
21:2e496deb7858
Cosmetics; Added LICENSE text.; Added the possibility to specify the payload length for receiving fixed length frames.; Added SetModem function to radio interface.; Added LoRa syncword register definition

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 /*!
mluis 13:618826a997e2 19 * State of the radio:
mluis 13:618826a997e2 20 * [IDLE,
mluis 13:618826a997e2 21 * RX_RUNNING, RX_TIMEOUT, RX_ERROR,
mluis 13:618826a997e2 22 * TX_RUNNING, TX_TIMEOUT,
mluis 13:618826a997e2 23 CAD]
GregCr 0:e6ceb13d2d05 24 */
GregCr 0:e6ceb13d2d05 25 enum RadioState
GregCr 0:e6ceb13d2d05 26 {
mluis 13:618826a997e2 27 LOWPOWER = 0,
mluis 13:618826a997e2 28 IDLE,
mluis 13:618826a997e2 29
mluis 13:618826a997e2 30 RX,
mluis 13:618826a997e2 31 RX_TIMEOUT,
mluis 13:618826a997e2 32 RX_ERROR,
mluis 13:618826a997e2 33
mluis 13:618826a997e2 34 TX,
mluis 13:618826a997e2 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 /*!
mluis 13:618826a997e2 42 * Type of the modem. [LORA / FSK]
GregCr 0:e6ceb13d2d05 43 */
GregCr 0:e6ceb13d2d05 44 enum ModemType
GregCr 0:e6ceb13d2d05 45 {
mluis 13:618826a997e2 46 MODEM_FSK = 0,
mluis 13:618826a997e2 47 MODEM_LORA
GregCr 0:e6ceb13d2d05 48 };
GregCr 0:e6ceb13d2d05 49
GregCr 2:5eb3066446dd 50 /*!
mluis 13:618826a997e2 51 * Type of the supported board. [SX1276MB1MAS / SX1276MB1LAS]
GregCr 2:5eb3066446dd 52 */
GregCr 2:5eb3066446dd 53 enum BoardType
GregCr 2:5eb3066446dd 54 {
mluis 13:618826a997e2 55 SX1276MB1MAS = 0,
mluis 13:618826a997e2 56 SX1276MB1LAS,
mluis 13:618826a997e2 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;
mluis 13:618826a997e2 71 uint8_t PayloadLen;
GregCr 0:e6ceb13d2d05 72 bool CrcOn;
GregCr 0:e6ceb13d2d05 73 bool IqInverted;
GregCr 0:e6ceb13d2d05 74 bool RxContinuous;
GregCr 0:e6ceb13d2d05 75 uint32_t TxTimeout;
GregCr 0:e6ceb13d2d05 76 }RadioFskSettings_t;
GregCr 0:e6ceb13d2d05 77
GregCr 0:e6ceb13d2d05 78 /*!
GregCr 0:e6ceb13d2d05 79 * Radio FSK packet handler state
GregCr 0:e6ceb13d2d05 80 */
GregCr 0:e6ceb13d2d05 81 typedef struct
GregCr 0:e6ceb13d2d05 82 {
GregCr 0:e6ceb13d2d05 83 uint8_t PreambleDetected;
GregCr 0:e6ceb13d2d05 84 uint8_t SyncWordDetected;
GregCr 0:e6ceb13d2d05 85 int8_t RssiValue;
GregCr 0:e6ceb13d2d05 86 int32_t AfcValue;
GregCr 0:e6ceb13d2d05 87 uint8_t RxGain;
GregCr 0:e6ceb13d2d05 88 uint16_t Size;
GregCr 0:e6ceb13d2d05 89 uint16_t NbBytes;
GregCr 0:e6ceb13d2d05 90 uint8_t FifoThresh;
GregCr 0:e6ceb13d2d05 91 uint8_t ChunkSize;
GregCr 0:e6ceb13d2d05 92 }RadioFskPacketHandler_t;
GregCr 0:e6ceb13d2d05 93
GregCr 0:e6ceb13d2d05 94 /*!
GregCr 0:e6ceb13d2d05 95 * Radio LoRa modem parameters
GregCr 0:e6ceb13d2d05 96 */
GregCr 0:e6ceb13d2d05 97 typedef struct
GregCr 0:e6ceb13d2d05 98 {
GregCr 0:e6ceb13d2d05 99 int8_t Power;
GregCr 0:e6ceb13d2d05 100 uint32_t Bandwidth;
GregCr 0:e6ceb13d2d05 101 uint32_t Datarate;
GregCr 0:e6ceb13d2d05 102 bool LowDatarateOptimize;
GregCr 0:e6ceb13d2d05 103 uint8_t Coderate;
GregCr 0:e6ceb13d2d05 104 uint16_t PreambleLen;
GregCr 0:e6ceb13d2d05 105 bool FixLen;
mluis 13:618826a997e2 106 uint8_t PayloadLen;
GregCr 0:e6ceb13d2d05 107 bool CrcOn;
mluis 13:618826a997e2 108 bool FreqHopOn;
GregCr 6:e7f02929cd3d 109 uint8_t HopPeriod;
GregCr 0:e6ceb13d2d05 110 bool IqInverted;
GregCr 0:e6ceb13d2d05 111 bool RxContinuous;
GregCr 0:e6ceb13d2d05 112 uint32_t TxTimeout;
GregCr 0:e6ceb13d2d05 113 }RadioLoRaSettings_t;
GregCr 0:e6ceb13d2d05 114
GregCr 0:e6ceb13d2d05 115 /*!
GregCr 0:e6ceb13d2d05 116 * Radio LoRa packet handler state
GregCr 0:e6ceb13d2d05 117 */
GregCr 0:e6ceb13d2d05 118 typedef struct
GregCr 0:e6ceb13d2d05 119 {
GregCr 0:e6ceb13d2d05 120 int8_t SnrValue;
GregCr 0:e6ceb13d2d05 121 int8_t RssiValue;
GregCr 0:e6ceb13d2d05 122 uint8_t Size;
GregCr 0:e6ceb13d2d05 123 }RadioLoRaPacketHandler_t;
GregCr 0:e6ceb13d2d05 124
GregCr 0:e6ceb13d2d05 125 /*!
GregCr 0:e6ceb13d2d05 126 * Radio Settings
GregCr 0:e6ceb13d2d05 127 */
GregCr 0:e6ceb13d2d05 128 typedef struct
GregCr 0:e6ceb13d2d05 129 {
mluis 13:618826a997e2 130 RadioState State;
mluis 13:618826a997e2 131 ModemType Modem;
GregCr 0:e6ceb13d2d05 132 uint32_t Channel;
GregCr 0:e6ceb13d2d05 133 RadioFskSettings_t Fsk;
GregCr 0:e6ceb13d2d05 134 RadioFskPacketHandler_t FskPacketHandler;
GregCr 0:e6ceb13d2d05 135 RadioLoRaSettings_t LoRa;
GregCr 0:e6ceb13d2d05 136 RadioLoRaPacketHandler_t LoRaPacketHandler;
GregCr 0:e6ceb13d2d05 137 }RadioSettings_t;
GregCr 0:e6ceb13d2d05 138
GregCr 0:e6ceb13d2d05 139
GregCr 0:e6ceb13d2d05 140 #endif //__ENUMS_H__
GregCr 0:e6ceb13d2d05 141