this is avaiable project

Dependents:   LoRaWAN_MBED

Fork of LoRaMacLib by LoRa All

Committer:
pzheng
Date:
Mon Nov 30 10:00:41 2015 +0000
Revision:
9:b3ddbad8c5e3
Parent:
8:19a3b4a82c69
Child:
10:66e623be7f8a
This is a available project using 433MHz frequency made by pzheng in semtech 20151130

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GregCr 0:9be122c18509 1 /*
GregCr 0:9be122c18509 2 / _____) _ | |
GregCr 0:9be122c18509 3 ( (____ _____ ____ _| |_ _____ ____| |__
GregCr 0:9be122c18509 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
GregCr 0:9be122c18509 5 _____) ) ____| | | || |_| ____( (___| | | |
GregCr 0:9be122c18509 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
GregCr 0:9be122c18509 7 (C)2013 Semtech
GregCr 0:9be122c18509 8
GregCr 0:9be122c18509 9 Description: LoRa MAC layer board dependent definitions
GregCr 0:9be122c18509 10
GregCr 0:9be122c18509 11 License: Revised BSD License, see LICENSE.TXT file include in the project
GregCr 0:9be122c18509 12
GregCr 0:9be122c18509 13 Maintainer: Miguel Luis and Gregory Cristian
GregCr 0:9be122c18509 14 */
GregCr 0:9be122c18509 15 #ifndef __LORAMAC_BOARD_H__
GregCr 0:9be122c18509 16 #define __LORAMAC_BOARD_H__
GregCr 0:9be122c18509 17
GregCr 0:9be122c18509 18 /*!
GregCr 0:9be122c18509 19 * LoRaMac maximum number of channels
GregCr 0:9be122c18509 20 */
GregCr 0:9be122c18509 21 #define LORA_MAX_NB_CHANNELS 16
GregCr 0:9be122c18509 22
GregCr 0:9be122c18509 23 /*!
GregCr 0:9be122c18509 24 * Minimal datarate that can be used by the node
GregCr 0:9be122c18509 25 */
GregCr 0:9be122c18509 26 #define LORAMAC_MIN_DATARATE DR_0
GregCr 0:9be122c18509 27
GregCr 0:9be122c18509 28 /*!
GregCr 0:9be122c18509 29 * Minimal datarate that can be used by the node
GregCr 0:9be122c18509 30 */
GregCr 0:9be122c18509 31 #define LORAMAC_MAX_DATARATE DR_7
GregCr 0:9be122c18509 32
GregCr 0:9be122c18509 33 /*!
GregCr 0:9be122c18509 34 * Default datarate used by the node
GregCr 0:9be122c18509 35 */
pzheng 9:b3ddbad8c5e3 36 #define LORAMAC_DEFAULT_DATARATE DR_0
GregCr 0:9be122c18509 37
GregCr 0:9be122c18509 38 /*!
GregCr 0:9be122c18509 39 * Minimal Tx output power that can be used by the node
GregCr 0:9be122c18509 40 */
GregCr 0:9be122c18509 41 #define LORAMAC_MIN_TX_POWER TX_POWER_02_DBM
GregCr 0:9be122c18509 42
GregCr 0:9be122c18509 43 /*!
GregCr 0:9be122c18509 44 * Minimal Tx output power that can be used by the node
GregCr 0:9be122c18509 45 */
GregCr 0:9be122c18509 46 #define LORAMAC_MAX_TX_POWER TX_POWER_20_DBM
GregCr 0:9be122c18509 47
GregCr 0:9be122c18509 48 /*!
GregCr 0:9be122c18509 49 * Default Tx output power used by the node
GregCr 0:9be122c18509 50 */
GregCr 0:9be122c18509 51 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM
GregCr 0:9be122c18509 52
GregCr 0:9be122c18509 53 /*!
GregCr 0:9be122c18509 54 * Returns individual channel mask
GregCr 0:9be122c18509 55 *
GregCr 0:9be122c18509 56 * \param[IN] channelIndex Channel index 1 based
GregCr 0:9be122c18509 57 * \retval channelMask
GregCr 0:9be122c18509 58 */
GregCr 0:9be122c18509 59 #define LC( channelIndex ) ( uint16_t )( 1 << ( channelIndex - 1 ) )
GregCr 0:9be122c18509 60
GregCr 0:9be122c18509 61 /*!
GregCr 0:9be122c18509 62 * LoRaMac TxPower definition
GregCr 0:9be122c18509 63 */
GregCr 0:9be122c18509 64 #define TX_POWER_20_DBM 0
GregCr 0:9be122c18509 65 #define TX_POWER_14_DBM 1
GregCr 0:9be122c18509 66 #define TX_POWER_11_DBM 2
GregCr 0:9be122c18509 67 #define TX_POWER_08_DBM 3
GregCr 0:9be122c18509 68 #define TX_POWER_05_DBM 4
GregCr 0:9be122c18509 69 #define TX_POWER_02_DBM 5
GregCr 0:9be122c18509 70
GregCr 0:9be122c18509 71 /*!
GregCr 0:9be122c18509 72 * LoRaMac datarates definition
GregCr 0:9be122c18509 73 */
GregCr 0:9be122c18509 74 #define DR_0 0 // SF12 - BW125
GregCr 0:9be122c18509 75 #define DR_1 1 // SF11 - BW125
GregCr 0:9be122c18509 76 #define DR_2 2 // SF10 - BW125
GregCr 0:9be122c18509 77 #define DR_3 3 // SF9 - BW125
GregCr 0:9be122c18509 78 #define DR_4 4 // SF8 - BW125
GregCr 0:9be122c18509 79 #define DR_5 5 // SF7 - BW125
GregCr 0:9be122c18509 80 #define DR_6 6 // SF7 - BW250
GregCr 0:9be122c18509 81 #define DR_7 7 // FSK
GregCr 0:9be122c18509 82
GregCr 0:9be122c18509 83 /*!
GregCr 0:9be122c18509 84 * LoRaMac default channels definition
GregCr 0:9be122c18509 85 */
GregCr 0:9be122c18509 86 #if defined( USE_BAND_868 )
GregCr 0:9be122c18509 87
GregCr 0:9be122c18509 88 /*!
GregCr 0:9be122c18509 89 * Second reception window channel definition.
GregCr 0:9be122c18509 90 */
GregCr 0:9be122c18509 91 // Channel = { Frequency [Hz], Datarate }
GregCr 0:9be122c18509 92 #define RX_WND_2_CHANNEL { 869525000, DR_3 }
GregCr 0:9be122c18509 93
GregCr 0:9be122c18509 94 /*!
GregCr 0:9be122c18509 95 * LoRaMac maximum number of bands
GregCr 0:9be122c18509 96 */
GregCr 0:9be122c18509 97 #define LORA_MAX_NB_BANDS 5
GregCr 0:9be122c18509 98
GregCr 0:9be122c18509 99 /*!
GregCr 0:9be122c18509 100 * LoRaMac EU868 default bands
GregCr 0:9be122c18509 101 */
GregCr 0:9be122c18509 102 typedef enum
GregCr 0:9be122c18509 103 {
GregCr 0:9be122c18509 104 BAND_G1_0,
GregCr 0:9be122c18509 105 BAND_G1_1,
GregCr 0:9be122c18509 106 BAND_G1_2,
GregCr 0:9be122c18509 107 BAND_G1_3,
GregCr 0:9be122c18509 108 BAND_G1_4,
GregCr 0:9be122c18509 109 }BandId_t;
GregCr 0:9be122c18509 110
GregCr 0:9be122c18509 111 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
Alliance 4:c1d2d1319c8f 112 #define BAND0 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
Alliance 4:c1d2d1319c8f 113 #define BAND1 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
Alliance 4:c1d2d1319c8f 114 #define BAND2 { 1000, TX_POWER_14_DBM, 0, 0 } // 0.1 %
Alliance 4:c1d2d1319c8f 115 #define BAND3 { 10 , TX_POWER_14_DBM, 0, 0 } // 10.0 %
Alliance 4:c1d2d1319c8f 116 #define BAND4 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
GregCr 0:9be122c18509 117
GregCr 0:9be122c18509 118 /*!
GregCr 0:9be122c18509 119 * LoRaMac default channels
GregCr 0:9be122c18509 120 */
GregCr 0:9be122c18509 121 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
GregCr 0:9be122c18509 122 #define LC1 { 868100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 }
GregCr 0:9be122c18509 123 #define LC2 { 868300000, { ( ( DR_6 << 4 ) | DR_0 ) }, 1 }
GregCr 0:9be122c18509 124 #define LC3 { 868500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 }
Alliance 8:19a3b4a82c69 125 #define LC4 { 868850000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
Alliance 8:19a3b4a82c69 126 #define LC5 { 869050000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
Alliance 8:19a3b4a82c69 127 #define LC6 { 869525000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
Alliance 8:19a3b4a82c69 128 /*#define LC7 { 867700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
GregCr 0:9be122c18509 129 #define LC8 { 867900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
GregCr 0:9be122c18509 130 #define LC9 { 868800000, { ( ( DR_7 << 4 ) | DR_7 ) }, 2 }
Alliance 8:19a3b4a82c69 131 */
GregCr 0:9be122c18509 132 #elif defined( USE_BAND_915 )
GregCr 0:9be122c18509 133
GregCr 0:9be122c18509 134 /*!
GregCr 0:9be122c18509 135 * Second reception window channel definition.
GregCr 0:9be122c18509 136 */
GregCr 0:9be122c18509 137 // Channel = { Frequency [Hz], Datarate }
GregCr 0:9be122c18509 138 #define RX_WND_2_CHANNEL { 923300000, DR_2 }
GregCr 0:9be122c18509 139
GregCr 0:9be122c18509 140 /*!
GregCr 0:9be122c18509 141 * LoRaMac maximum number of bands
GregCr 0:9be122c18509 142 */
GregCr 0:9be122c18509 143 #define LORA_MAX_NB_BANDS 1
GregCr 0:9be122c18509 144
GregCr 0:9be122c18509 145 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
GregCr 0:9be122c18509 146 #define BAND0 { 1, TX_POWER_14_DBM, 0, 0 } // 100.0 %
GregCr 0:9be122c18509 147
GregCr 0:9be122c18509 148 /*!
GregCr 0:9be122c18509 149 * LoRaMac default channels
GregCr 0:9be122c18509 150 */
GregCr 0:9be122c18509 151 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
pzheng 9:b3ddbad8c5e3 152 #define LC1 { 902300000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
pzheng 9:b3ddbad8c5e3 153 #define LC2 { 902500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
pzheng 9:b3ddbad8c5e3 154 #define LC3 { 902700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
pzheng 9:b3ddbad8c5e3 155
pzheng 9:b3ddbad8c5e3 156 #elif defined( USE_BAND_433 )
pzheng 9:b3ddbad8c5e3 157
pzheng 9:b3ddbad8c5e3 158 /*!
pzheng 9:b3ddbad8c5e3 159 * Second reception window channel definition.
pzheng 9:b3ddbad8c5e3 160 */
pzheng 9:b3ddbad8c5e3 161 // Channel = { Frequency [Hz], Datarate }
pzheng 9:b3ddbad8c5e3 162 #define RX_WND_2_CHANNEL { 434900000, DR_3 }
pzheng 9:b3ddbad8c5e3 163
pzheng 9:b3ddbad8c5e3 164 /*!
pzheng 9:b3ddbad8c5e3 165 * LoRaMac maximum number of bands
pzheng 9:b3ddbad8c5e3 166 */
pzheng 9:b3ddbad8c5e3 167 #define LORA_MAX_NB_BANDS 1
pzheng 9:b3ddbad8c5e3 168
pzheng 9:b3ddbad8c5e3 169 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
pzheng 9:b3ddbad8c5e3 170 #define BAND0 { 1, TX_POWER_14_DBM, 0, 0 } // 100.0 %
pzheng 9:b3ddbad8c5e3 171
pzheng 9:b3ddbad8c5e3 172 /*!
pzheng 9:b3ddbad8c5e3 173 * LoRaMac default channels
pzheng 9:b3ddbad8c5e3 174 */
pzheng 9:b3ddbad8c5e3 175 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
pzheng 9:b3ddbad8c5e3 176 #define LC1 { 433300000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
pzheng 9:b3ddbad8c5e3 177 #define LC2 { 433500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
pzheng 9:b3ddbad8c5e3 178 #define LC3 { 433700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
pzheng 9:b3ddbad8c5e3 179 #define LC4 { 433900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
pzheng 9:b3ddbad8c5e3 180 #define LC5 { 434100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
pzheng 9:b3ddbad8c5e3 181 #define LC6 { 434300000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
pzheng 9:b3ddbad8c5e3 182 #define LC7 { 434500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
pzheng 9:b3ddbad8c5e3 183 #define LC8 { 434700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
pzheng 9:b3ddbad8c5e3 184 #define LC9 { 000000000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
GregCr 0:9be122c18509 185
GregCr 0:9be122c18509 186 #else
GregCr 0:9be122c18509 187 #error "Please define a frequency band in the compiler options."
GregCr 0:9be122c18509 188 #endif
GregCr 0:9be122c18509 189
GregCr 0:9be122c18509 190 #endif // __LORAMAC_BOARD_H__