SX1276 library for modtronix inair9. Edited for use with NRF51DK board.

Dependents:   InAir9_PingPong

Fork of SX1276Lib_modtronix by modtronix H

Committer:
modtronix
Date:
Wed May 13 11:38:38 2015 +1000
Revision:
23:2da0dcafe430
Parent:
22:20db480143c9
Child:
25:72381be1b0ce
Added back original BoardType enum

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 /*!
modtronix 23:2da0dcafe430 51 * Type of the supported board. [SX1276MB1MAS / SX1276MB1LAS]
modtronix 23:2da0dcafe430 52 */
modtronix 23:2da0dcafe430 53 enum BoardType
modtronix 23:2da0dcafe430 54 {
modtronix 23:2da0dcafe430 55 SX1276MB1MAS = 0,
modtronix 23:2da0dcafe430 56 SX1276MB1LAS,
modtronix 23:2da0dcafe430 57 UNKNOWN
modtronix 23:2da0dcafe430 58 };
modtronix 23:2da0dcafe430 59
modtronix 23:2da0dcafe430 60 /*!
modtronix 22:20db480143c9 61 * Type of the supported board. [BOARD_INAIR4 / BOARD_INAIR9]
GregCr 2:5eb3066446dd 62 */
modtronix 23:2da0dcafe430 63 enum BoardTypeInAir
GregCr 2:5eb3066446dd 64 {
modtronix 22:20db480143c9 65 BOARD_INAIR4 = 0,
modtronix 22:20db480143c9 66 BOARD_INAIR9,
modtronix 22:20db480143c9 67 BOARD_INAIR9B,
modtronix 22:20db480143c9 68 BOARD_UNKNOWN
GregCr 2:5eb3066446dd 69 };
GregCr 0:e6ceb13d2d05 70 /*!
GregCr 0:e6ceb13d2d05 71 * Radio FSK modem parameters
GregCr 0:e6ceb13d2d05 72 */
GregCr 0:e6ceb13d2d05 73 typedef struct
GregCr 0:e6ceb13d2d05 74 {
GregCr 0:e6ceb13d2d05 75 int8_t Power;
GregCr 0:e6ceb13d2d05 76 uint32_t Fdev;
GregCr 0:e6ceb13d2d05 77 uint32_t Bandwidth;
GregCr 0:e6ceb13d2d05 78 uint32_t BandwidthAfc;
GregCr 0:e6ceb13d2d05 79 uint32_t Datarate;
GregCr 0:e6ceb13d2d05 80 uint16_t PreambleLen;
GregCr 0:e6ceb13d2d05 81 bool FixLen;
mluis 13:618826a997e2 82 uint8_t PayloadLen;
GregCr 0:e6ceb13d2d05 83 bool CrcOn;
GregCr 0:e6ceb13d2d05 84 bool IqInverted;
GregCr 0:e6ceb13d2d05 85 bool RxContinuous;
GregCr 0:e6ceb13d2d05 86 uint32_t TxTimeout;
GregCr 0:e6ceb13d2d05 87 }RadioFskSettings_t;
GregCr 0:e6ceb13d2d05 88
GregCr 0:e6ceb13d2d05 89 /*!
GregCr 0:e6ceb13d2d05 90 * Radio FSK packet handler state
GregCr 0:e6ceb13d2d05 91 */
GregCr 0:e6ceb13d2d05 92 typedef struct
GregCr 0:e6ceb13d2d05 93 {
GregCr 0:e6ceb13d2d05 94 uint8_t PreambleDetected;
GregCr 0:e6ceb13d2d05 95 uint8_t SyncWordDetected;
GregCr 0:e6ceb13d2d05 96 int8_t RssiValue;
GregCr 0:e6ceb13d2d05 97 int32_t AfcValue;
GregCr 0:e6ceb13d2d05 98 uint8_t RxGain;
GregCr 0:e6ceb13d2d05 99 uint16_t Size;
GregCr 0:e6ceb13d2d05 100 uint16_t NbBytes;
GregCr 0:e6ceb13d2d05 101 uint8_t FifoThresh;
GregCr 0:e6ceb13d2d05 102 uint8_t ChunkSize;
GregCr 0:e6ceb13d2d05 103 }RadioFskPacketHandler_t;
GregCr 0:e6ceb13d2d05 104
GregCr 0:e6ceb13d2d05 105 /*!
GregCr 0:e6ceb13d2d05 106 * Radio LoRa modem parameters
GregCr 0:e6ceb13d2d05 107 */
GregCr 0:e6ceb13d2d05 108 typedef struct
GregCr 0:e6ceb13d2d05 109 {
GregCr 0:e6ceb13d2d05 110 int8_t Power;
GregCr 0:e6ceb13d2d05 111 uint32_t Bandwidth;
GregCr 0:e6ceb13d2d05 112 uint32_t Datarate;
GregCr 0:e6ceb13d2d05 113 bool LowDatarateOptimize;
GregCr 0:e6ceb13d2d05 114 uint8_t Coderate;
GregCr 0:e6ceb13d2d05 115 uint16_t PreambleLen;
GregCr 0:e6ceb13d2d05 116 bool FixLen;
mluis 13:618826a997e2 117 uint8_t PayloadLen;
GregCr 0:e6ceb13d2d05 118 bool CrcOn;
mluis 13:618826a997e2 119 bool FreqHopOn;
GregCr 6:e7f02929cd3d 120 uint8_t HopPeriod;
GregCr 0:e6ceb13d2d05 121 bool IqInverted;
GregCr 0:e6ceb13d2d05 122 bool RxContinuous;
GregCr 0:e6ceb13d2d05 123 uint32_t TxTimeout;
GregCr 0:e6ceb13d2d05 124 }RadioLoRaSettings_t;
GregCr 0:e6ceb13d2d05 125
GregCr 0:e6ceb13d2d05 126 /*!
GregCr 0:e6ceb13d2d05 127 * Radio LoRa packet handler state
GregCr 0:e6ceb13d2d05 128 */
GregCr 0:e6ceb13d2d05 129 typedef struct
GregCr 0:e6ceb13d2d05 130 {
GregCr 0:e6ceb13d2d05 131 int8_t SnrValue;
GregCr 0:e6ceb13d2d05 132 int8_t RssiValue;
GregCr 0:e6ceb13d2d05 133 uint8_t Size;
GregCr 0:e6ceb13d2d05 134 }RadioLoRaPacketHandler_t;
GregCr 0:e6ceb13d2d05 135
GregCr 0:e6ceb13d2d05 136 /*!
GregCr 0:e6ceb13d2d05 137 * Radio Settings
GregCr 0:e6ceb13d2d05 138 */
GregCr 0:e6ceb13d2d05 139 typedef struct
GregCr 0:e6ceb13d2d05 140 {
mluis 13:618826a997e2 141 RadioState State;
mluis 13:618826a997e2 142 ModemType Modem;
GregCr 0:e6ceb13d2d05 143 uint32_t Channel;
GregCr 0:e6ceb13d2d05 144 RadioFskSettings_t Fsk;
GregCr 0:e6ceb13d2d05 145 RadioFskPacketHandler_t FskPacketHandler;
GregCr 0:e6ceb13d2d05 146 RadioLoRaSettings_t LoRa;
GregCr 0:e6ceb13d2d05 147 RadioLoRaPacketHandler_t LoRaPacketHandler;
GregCr 0:e6ceb13d2d05 148 }RadioSettings_t;
GregCr 0:e6ceb13d2d05 149
GregCr 0:e6ceb13d2d05 150
GregCr 0:e6ceb13d2d05 151 #endif //__ENUMS_H__
GregCr 0:e6ceb13d2d05 152