add rotary
Dependencies: X_NUCLEO_IKS01A1 LoRaWAN-lib SX1272Lib mbed
Fork of Canada-SX1272-LoRaWAN-Bootcamp by
LoRaWAN-SX1272-Mbed-Shield
Overview
LoRaWAN-SX1272-Mbed-Shield application demo is a LoRaWAN Class-A device example project using LoRaWAN-lib and SX1272Lib libraries that send out sensors data.
Prerequisites
1. NUCLEO_L152RE board.
2. SX1272-mbed-shield board.
3. X-NUCLEO-IKS01A1.
4. Grove Red LED.
5. Grove Button.
6. Grove Rotary Angle Sensor.
7. mbed online compiler.
8. Tera Term.
Hardware Configuration
Application 8, 9, 11
1. Connect NUCLEO_L152RE with X-NUCLEO-IKS01A1.
2. On top of X-NUCLEO-IKS01A1, connect SX1272-mbed-shield.
Application 13
1. Connect NUCLEO_L152RE with SX1272-mbed-shield.
2. Connect Grove Red LED with DIO_D6 port on SX1272-mbed-shield.
3. Connect Grove Button with DIO_D8 port on SX1272-mbed-shield.
4. Connect Grove Rotary Angle Sensor with ANA_A1 port SX1272-mbed-shield.
Software Configuration
The end-device must be configured with the following parameters:
- Commissioning.h
- Activation Type: OTA or ABP
- OTA: #define OVER_THE_AIR_ACTIVATION 1
- Network Type: Public or Private
- Public: #define LORAWAN_PUBLIC_NETWORK true
- LORAWAN_DEVICE_EUI (8 Bytes) : Fist 3 Bytes is the Organizationally Unique Identifier (OUI) followed by 5 bytes of unique ID. If not defined by user, then the firmware automatically assigns one to the end-device. (For OTA)
- #define IEEE_OUI 0x00, 0x00, 0x00
- #define LORAWAN_DEVICE_EUI { IEEE_OUI, 0x00, 0x00, 0x00, 0x00, 0x00 }
- #define IEEE_OUI 0x00, 0x00, 0x00
- LORAWAN_APPLICATION_EUI (8 Bytes) (For OTA)
- #define LORAWAN_APPLICATION_EUI { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
- LORAWAN_APPLICATION_KEY (16 Bytes) (For OTA)
- #define LORAWAN_APPLICATION_KEY { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }
- #define LORAWAN_APPLICATION_KEY { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }
- LORAWAN_DEVICE_ADDRESS (For ABP)
- #define LORAWAN_DEVICE_ADDRESS ( uint32_t )0x0
- LORAWAN_NWKSKEY (For ABP)
- #define LORAWAN_NWKSKEY { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }
- LORAWAN_APPSKEY (For ABP)
- #define LORAWAN_APPSKEY { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }
- Activation Type: OTA or ABP
- Configure.h
- Communication Type: Hybrid or FHSS
- Hybrid: #define USE_BAND_915_HYBRID
- Join request Period:
- 5 sec: #define OVER_THE_AIR_ACTIVATION_DUTYCYCLE 5000000 value in us
- TX Period:
- 5 sec: #define APP_TX_DUTYCYCLE 5000000 value in us
- Uplink message: Confirmed or Unconfirmed
- Confirmed: #define LORAWAN_CONFIRMED_MSG_ON 1
- ADR(Adaptive Data Rate): ON or OFF
- OFF: #define LORAWAN_ADR_ON 0
- Default data rate: DR_0 or DR_1 or DR_2 or DR_3 or DR_4
- DR_0: #define LORAWAN_DEFAULT_DATARATE DR_0
- Application Type: 8 (IKS01A1) or 9 (IKS01A1+Cayenne) or 11 (Push Button) or 13 (rotary+Cayenne)
- 9: #define LORAWAN_APP_PORT 9
- Tx Power: 10 to 30
- 20 dBm: #define LORAWAN_TX_POWER TX_POWER_20_DBM
- Communication Type: Hybrid or FHSS
Serial Terminal Display
- Use Tera Term to see the sending message (baud rate: 115200):
- button = 0 (if not press) button = 1 (if pressed)
- rotary = 0 ~ 300
- button = 0 (if not press) button = 1 (if pressed)
app/LoRaEventProc.cpp@17:a822234a2299, 2018-02-10 (annotated)
- Committer:
- terence304
- Date:
- Sat Feb 10 02:37:58 2018 +0000
- Revision:
- 17:a822234a2299
- Parent:
- 9:5f27b3a30027
update commissioning parameters
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ubhat | 0:6cc76d70e2a1 | 1 | /* |
ubhat | 0:6cc76d70e2a1 | 2 | / _____) _ | | |
ubhat | 0:6cc76d70e2a1 | 3 | ( (____ _____ ____ _| |_ _____ ____| |__ |
ubhat | 0:6cc76d70e2a1 | 4 | \____ \| ___ | (_ _) ___ |/ ___) _ \ |
ubhat | 0:6cc76d70e2a1 | 5 | _____) ) ____| | | || |_| ____( (___| | | | |
ubhat | 0:6cc76d70e2a1 | 6 | (______/|_____)_|_|_| \__)_____)\____)_| |_| |
ubhat | 0:6cc76d70e2a1 | 7 | (C)2015 Semtech |
ubhat | 0:6cc76d70e2a1 | 8 | |
ubhat | 0:6cc76d70e2a1 | 9 | Description: Define events during Join, Tx & Rx |
ubhat | 0:6cc76d70e2a1 | 10 | Prepare TX packet by appending with appropriate application data |
ubhat | 0:6cc76d70e2a1 | 11 | |
ubhat | 0:6cc76d70e2a1 | 12 | License: Revised BSD License, see LICENSE.TXT file include in the project |
ubhat | 0:6cc76d70e2a1 | 13 | |
ubhat | 0:6cc76d70e2a1 | 14 | Maintainer: Uttam Bhat |
ubhat | 0:6cc76d70e2a1 | 15 | */ |
ubhat | 0:6cc76d70e2a1 | 16 | |
ubhat | 0:6cc76d70e2a1 | 17 | #include "LoRaEventProc.h" |
ubhat | 0:6cc76d70e2a1 | 18 | |
ubhat | 0:6cc76d70e2a1 | 19 | /*! |
ubhat | 0:6cc76d70e2a1 | 20 | * Defines the application data transmission duty cycle |
ubhat | 0:6cc76d70e2a1 | 21 | */ |
ubhat | 0:6cc76d70e2a1 | 22 | uint32_t TxDutyCycleTime = APP_TX_DUTYCYCLE; |
ubhat | 0:6cc76d70e2a1 | 23 | |
ubhat | 0:6cc76d70e2a1 | 24 | uint8_t AppCase = 0; |
ubhat | 0:6cc76d70e2a1 | 25 | |
ubhat | 0:6cc76d70e2a1 | 26 | /*! |
ubhat | 0:6cc76d70e2a1 | 27 | * \brief Prepares the payload of the frame based on application port |
ubhat | 0:6cc76d70e2a1 | 28 | */ |
ubhat | 0:6cc76d70e2a1 | 29 | void PrepareLoRaFrame( uint8_t port ) |
ubhat | 0:6cc76d70e2a1 | 30 | { |
ubhat | 0:6cc76d70e2a1 | 31 | |
ubhat | 0:6cc76d70e2a1 | 32 | switch( port ) |
ubhat | 0:6cc76d70e2a1 | 33 | { |
ubhat | 0:6cc76d70e2a1 | 34 | case 8: |
ubhat | 0:6cc76d70e2a1 | 35 | { |
ubhat | 0:6cc76d70e2a1 | 36 | uint8_t ptrIndex = 0; |
ubhat | 0:6cc76d70e2a1 | 37 | |
ubhat | 0:6cc76d70e2a1 | 38 | //Point the pointer to position index of Tx Buffer |
ubhat | 0:6cc76d70e2a1 | 39 | LoRaApp.ApplicationPtrPos( ptrIndex ); |
ubhat | 0:6cc76d70e2a1 | 40 | |
ubhat | 0:6cc76d70e2a1 | 41 | /*! |
ubhat | 0:6cc76d70e2a1 | 42 | * Read Pressure |
ubhat | 0:6cc76d70e2a1 | 43 | * Appends 2 Bytes to TX buffer |
ubhat | 0:6cc76d70e2a1 | 44 | */ |
ubhat | 0:6cc76d70e2a1 | 45 | LoRaApp.ApplicationCall( AppPressr ); |
ubhat | 0:6cc76d70e2a1 | 46 | |
ubhat | 0:6cc76d70e2a1 | 47 | /*! |
ubhat | 0:6cc76d70e2a1 | 48 | * Read Temperature |
ubhat | 0:6cc76d70e2a1 | 49 | * Appends 1 Byte to TX buffer |
ubhat | 0:6cc76d70e2a1 | 50 | */ |
ubhat | 0:6cc76d70e2a1 | 51 | LoRaApp.ApplicationCall( AppTemp ); |
ubhat | 0:6cc76d70e2a1 | 52 | |
ubhat | 0:6cc76d70e2a1 | 53 | /*! |
ubhat | 0:6cc76d70e2a1 | 54 | * Read Humidity |
ubhat | 0:6cc76d70e2a1 | 55 | * Appends 1 Byte to TX buffer |
ubhat | 0:6cc76d70e2a1 | 56 | */ |
ubhat | 0:6cc76d70e2a1 | 57 | LoRaApp.ApplicationCall( AppHumid ); |
ubhat | 0:6cc76d70e2a1 | 58 | |
ubhat | 0:6cc76d70e2a1 | 59 | /*! |
ubhat | 0:6cc76d70e2a1 | 60 | * Read Accelerometer |
terence304 | 2:5859f5872d6c | 61 | * Appends 6 Bytes to TX buffer |
ubhat | 0:6cc76d70e2a1 | 62 | * Value Orientation |
ubhat | 0:6cc76d70e2a1 | 63 | * 0x99 0x00 horizontal + faceup |
ubhat | 0:6cc76d70e2a1 | 64 | * 0x66 0x00 horizontal + facedown |
ubhat | 0:6cc76d70e2a1 | 65 | * 0x00 0x11 vertical |
ubhat | 0:6cc76d70e2a1 | 66 | */ |
ubhat | 0:6cc76d70e2a1 | 67 | LoRaApp.ApplicationCall( AppAccl ); // Generate Accelerometer data bytes |
ubhat | 0:6cc76d70e2a1 | 68 | |
ubhat | 0:6cc76d70e2a1 | 69 | |
ubhat | 0:6cc76d70e2a1 | 70 | break; |
ubhat | 0:6cc76d70e2a1 | 71 | } |
ubhat | 0:6cc76d70e2a1 | 72 | |
ubhat | 0:6cc76d70e2a1 | 73 | // IKAS sensor using Cayenne Payload Format |
ubhat | 0:6cc76d70e2a1 | 74 | case 9: |
ubhat | 0:6cc76d70e2a1 | 75 | { |
ubhat | 0:6cc76d70e2a1 | 76 | #ifdef USE_CAYENNE_LPP |
ubhat | 0:6cc76d70e2a1 | 77 | uint8_t ptrIndex = 0; |
ubhat | 0:6cc76d70e2a1 | 78 | |
ubhat | 0:6cc76d70e2a1 | 79 | uint16_t AppSize = 0; |
ubhat | 0:6cc76d70e2a1 | 80 | |
ubhat | 0:6cc76d70e2a1 | 81 | uint8_t tmp[2] = {0}; |
ubhat | 0:6cc76d70e2a1 | 82 | |
ubhat | 0:6cc76d70e2a1 | 83 | //Point the pointer to position index of Tx Buffer |
ubhat | 0:6cc76d70e2a1 | 84 | LoRaApp.ApplicationPtrPos( ptrIndex ); |
ubhat | 0:6cc76d70e2a1 | 85 | |
ubhat | 0:6cc76d70e2a1 | 86 | AppCase = AppCase > 3 ? 0 : AppCase; |
ubhat | 0:6cc76d70e2a1 | 87 | |
ubhat | 0:6cc76d70e2a1 | 88 | while( 1 ) |
ubhat | 0:6cc76d70e2a1 | 89 | { |
ubhat | 0:6cc76d70e2a1 | 90 | switch( AppCase ) |
ubhat | 0:6cc76d70e2a1 | 91 | { |
ubhat | 0:6cc76d70e2a1 | 92 | case 0: |
ubhat | 0:6cc76d70e2a1 | 93 | { |
ubhat | 0:6cc76d70e2a1 | 94 | tmp[0] = 0; |
ubhat | 0:6cc76d70e2a1 | 95 | tmp[1] = 115; // Data Type PRESSURE: 115 |
ubhat | 0:6cc76d70e2a1 | 96 | LoRaApp.ApplicationAppendData( tmp, 2 ); |
ubhat | 0:6cc76d70e2a1 | 97 | |
ubhat | 0:6cc76d70e2a1 | 98 | /*! |
ubhat | 0:6cc76d70e2a1 | 99 | * Read Pressure |
ubhat | 0:6cc76d70e2a1 | 100 | * Appends 2 Bytes to TX buffer |
ubhat | 0:6cc76d70e2a1 | 101 | */ |
ubhat | 0:6cc76d70e2a1 | 102 | LoRaApp.ApplicationCall( AppPressr ); |
ubhat | 0:6cc76d70e2a1 | 103 | |
ubhat | 0:6cc76d70e2a1 | 104 | AppSize += maxLPPsize[AppCase]; |
ubhat | 0:6cc76d70e2a1 | 105 | |
ubhat | 0:6cc76d70e2a1 | 106 | break; |
ubhat | 0:6cc76d70e2a1 | 107 | } |
ubhat | 0:6cc76d70e2a1 | 108 | |
ubhat | 0:6cc76d70e2a1 | 109 | case 1: |
ubhat | 0:6cc76d70e2a1 | 110 | { |
ubhat | 0:6cc76d70e2a1 | 111 | tmp[0] = 1; |
ubhat | 0:6cc76d70e2a1 | 112 | tmp[1] = 103; // Data Type TEMP: 103 |
ubhat | 0:6cc76d70e2a1 | 113 | LoRaApp.ApplicationAppendData( tmp, 2 ); |
ubhat | 0:6cc76d70e2a1 | 114 | |
ubhat | 0:6cc76d70e2a1 | 115 | /*! |
ubhat | 0:6cc76d70e2a1 | 116 | * Read Temperature |
ubhat | 0:6cc76d70e2a1 | 117 | * Appends 1 Byte to TX buffer |
ubhat | 0:6cc76d70e2a1 | 118 | */ |
ubhat | 0:6cc76d70e2a1 | 119 | LoRaApp.ApplicationCall( AppTemp ); |
ubhat | 0:6cc76d70e2a1 | 120 | |
ubhat | 0:6cc76d70e2a1 | 121 | AppSize += maxLPPsize[AppCase]; |
ubhat | 0:6cc76d70e2a1 | 122 | |
ubhat | 0:6cc76d70e2a1 | 123 | break; |
ubhat | 0:6cc76d70e2a1 | 124 | } |
ubhat | 0:6cc76d70e2a1 | 125 | |
ubhat | 0:6cc76d70e2a1 | 126 | case 2: |
ubhat | 0:6cc76d70e2a1 | 127 | { |
ubhat | 0:6cc76d70e2a1 | 128 | tmp[0] = 2; |
ubhat | 0:6cc76d70e2a1 | 129 | tmp[1] = 104; // Data Type HUMIDITY: 103 |
ubhat | 0:6cc76d70e2a1 | 130 | LoRaApp.ApplicationAppendData( tmp, 2 ); |
ubhat | 0:6cc76d70e2a1 | 131 | |
ubhat | 0:6cc76d70e2a1 | 132 | /*! |
ubhat | 0:6cc76d70e2a1 | 133 | * Read Humidity |
ubhat | 0:6cc76d70e2a1 | 134 | * Appends 1 Byte to TX buffer |
ubhat | 0:6cc76d70e2a1 | 135 | */ |
ubhat | 0:6cc76d70e2a1 | 136 | LoRaApp.ApplicationCall( AppHumid ); |
ubhat | 0:6cc76d70e2a1 | 137 | |
ubhat | 0:6cc76d70e2a1 | 138 | AppSize += maxLPPsize[AppCase]; |
ubhat | 0:6cc76d70e2a1 | 139 | |
ubhat | 0:6cc76d70e2a1 | 140 | break; |
ubhat | 0:6cc76d70e2a1 | 141 | } |
ubhat | 0:6cc76d70e2a1 | 142 | |
ubhat | 0:6cc76d70e2a1 | 143 | case 3: |
ubhat | 0:6cc76d70e2a1 | 144 | { |
ubhat | 0:6cc76d70e2a1 | 145 | tmp[0] = 3; |
ubhat | 0:6cc76d70e2a1 | 146 | tmp[1] = 113; // Data Type Accl: 113 |
ubhat | 0:6cc76d70e2a1 | 147 | LoRaApp.ApplicationAppendData( tmp, 2 ); |
ubhat | 0:6cc76d70e2a1 | 148 | /*! |
ubhat | 0:6cc76d70e2a1 | 149 | * Read Accelerometer |
ubhat | 0:6cc76d70e2a1 | 150 | */ |
ubhat | 0:6cc76d70e2a1 | 151 | LoRaApp.ApplicationCall( AppAccl ); // Generate Accelerometer data bytes |
ubhat | 0:6cc76d70e2a1 | 152 | |
ubhat | 0:6cc76d70e2a1 | 153 | AppSize += maxLPPsize[AppCase]; |
ubhat | 0:6cc76d70e2a1 | 154 | |
ubhat | 0:6cc76d70e2a1 | 155 | break; |
ubhat | 0:6cc76d70e2a1 | 156 | } |
ubhat | 0:6cc76d70e2a1 | 157 | } |
ubhat | 0:6cc76d70e2a1 | 158 | |
ubhat | 0:6cc76d70e2a1 | 159 | AppCase++; |
ubhat | 0:6cc76d70e2a1 | 160 | |
ubhat | 0:6cc76d70e2a1 | 161 | if( AppSize + maxLPPsize[AppCase] > LORAWAN_APP_DATA_SIZE ) |
ubhat | 0:6cc76d70e2a1 | 162 | { |
ubhat | 0:6cc76d70e2a1 | 163 | break; |
ubhat | 0:6cc76d70e2a1 | 164 | } |
ubhat | 0:6cc76d70e2a1 | 165 | } |
ubhat | 0:6cc76d70e2a1 | 166 | |
ubhat | 0:6cc76d70e2a1 | 167 | AppDataSize = AppSize; |
ubhat | 0:6cc76d70e2a1 | 168 | #endif |
ubhat | 0:6cc76d70e2a1 | 169 | break; |
ubhat | 0:6cc76d70e2a1 | 170 | } |
ubhat | 0:6cc76d70e2a1 | 171 | |
ubhat | 0:6cc76d70e2a1 | 172 | // Push-Button Demo |
ubhat | 0:6cc76d70e2a1 | 173 | case 11: |
ubhat | 0:6cc76d70e2a1 | 174 | { |
ubhat | 0:6cc76d70e2a1 | 175 | uint8_t ptrIndex = 0; |
terence304 | 2:5859f5872d6c | 176 | |
ubhat | 0:6cc76d70e2a1 | 177 | //Point the pointer to position index of Tx Buffer |
ubhat | 0:6cc76d70e2a1 | 178 | LoRaApp.ApplicationPtrPos( ptrIndex ); |
terence304 | 2:5859f5872d6c | 179 | |
ubhat | 0:6cc76d70e2a1 | 180 | LoRaApp.ApplicationCall( AppPushButton ); // Transmit uplink counter |
ubhat | 0:6cc76d70e2a1 | 181 | |
ubhat | 0:6cc76d70e2a1 | 182 | break; |
ubhat | 0:6cc76d70e2a1 | 183 | } |
ubhat | 0:6cc76d70e2a1 | 184 | |
terence304 | 2:5859f5872d6c | 185 | case 13: |
terence304 | 2:5859f5872d6c | 186 | { |
terence304 | 2:5859f5872d6c | 187 | uint8_t ptrIndex = 0; |
terence304 | 2:5859f5872d6c | 188 | uint8_t data_header[2] = {0}; |
terence304 | 2:5859f5872d6c | 189 | |
terence304 | 2:5859f5872d6c | 190 | //Point the pointer to position index of Tx Buffer |
terence304 | 2:5859f5872d6c | 191 | LoRaApp.ApplicationPtrPos( ptrIndex ); |
terence304 | 2:5859f5872d6c | 192 | |
terence304 | 2:5859f5872d6c | 193 | data_header[0] = 0; |
terence304 | 2:5859f5872d6c | 194 | data_header[1] = 0; |
terence304 | 2:5859f5872d6c | 195 | |
terence304 | 2:5859f5872d6c | 196 | LoRaApp.ApplicationAppendData( data_header, 2 ); |
terence304 | 2:5859f5872d6c | 197 | LoRaApp.ApplicationCall( AppButton ); // Transmit uplink counter |
terence304 | 2:5859f5872d6c | 198 | data_header[0] = 1; |
terence304 | 2:5859f5872d6c | 199 | data_header[1] = 2; |
terence304 | 2:5859f5872d6c | 200 | |
terence304 | 2:5859f5872d6c | 201 | LoRaApp.ApplicationAppendData( data_header, 2 ); |
terence304 | 2:5859f5872d6c | 202 | LoRaApp.ApplicationCall( AppRotary ); // Transmit uplink counter |
terence304 | 2:5859f5872d6c | 203 | break; |
terence304 | 2:5859f5872d6c | 204 | } |
terence304 | 2:5859f5872d6c | 205 | |
ubhat | 0:6cc76d70e2a1 | 206 | default: |
ubhat | 0:6cc76d70e2a1 | 207 | break; |
ubhat | 0:6cc76d70e2a1 | 208 | } |
ubhat | 0:6cc76d70e2a1 | 209 | } |
ubhat | 0:6cc76d70e2a1 | 210 | |
ubhat | 0:6cc76d70e2a1 | 211 | |
ubhat | 0:6cc76d70e2a1 | 212 | /*! |
ubhat | 0:6cc76d70e2a1 | 213 | * \brief Sets Interrupt for next payload transmission |
ubhat | 0:6cc76d70e2a1 | 214 | */ |
ubhat | 0:6cc76d70e2a1 | 215 | void InitNextTxInterrupt( uint8_t port ) |
ubhat | 0:6cc76d70e2a1 | 216 | { |
ubhat | 0:6cc76d70e2a1 | 217 | switch( port ) |
ubhat | 0:6cc76d70e2a1 | 218 | { |
ubhat | 0:6cc76d70e2a1 | 219 | /* Push Button Demo |
ubhat | 0:6cc76d70e2a1 | 220 | Send Packet Immedietly if PC0 = GND |
ubhat | 0:6cc76d70e2a1 | 221 | */ |
ubhat | 0:6cc76d70e2a1 | 222 | case 11: |
ubhat | 0:6cc76d70e2a1 | 223 | { |
ubhat | 0:6cc76d70e2a1 | 224 | volatile bool PushButtonStatus; |
ubhat | 0:6cc76d70e2a1 | 225 | |
ubhat | 0:6cc76d70e2a1 | 226 | PushButtonStatus = UsrButton; |
ubhat | 0:6cc76d70e2a1 | 227 | |
ubhat | 0:6cc76d70e2a1 | 228 | if(PushButtonStatus == 0) |
ubhat | 0:6cc76d70e2a1 | 229 | { |
ubhat | 0:6cc76d70e2a1 | 230 | // Send Pkt immedietly if PC = GND |
ubhat | 0:6cc76d70e2a1 | 231 | DeviceState = DEVICE_STATE_SEND; |
ubhat | 0:6cc76d70e2a1 | 232 | NextTx = true; |
ubhat | 0:6cc76d70e2a1 | 233 | } |
ubhat | 0:6cc76d70e2a1 | 234 | else |
ubhat | 0:6cc76d70e2a1 | 235 | { |
ubhat | 0:6cc76d70e2a1 | 236 | // Keep polling |
ubhat | 0:6cc76d70e2a1 | 237 | IsTxIntUpdate = true; |
ubhat | 0:6cc76d70e2a1 | 238 | } |
ubhat | 0:6cc76d70e2a1 | 239 | |
ubhat | 0:6cc76d70e2a1 | 240 | break; |
ubhat | 0:6cc76d70e2a1 | 241 | } |
ubhat | 0:6cc76d70e2a1 | 242 | |
ubhat | 0:6cc76d70e2a1 | 243 | /* Compliance Test |
ubhat | 0:6cc76d70e2a1 | 244 | Set Timer interrupt for next uplink |
ubhat | 0:6cc76d70e2a1 | 245 | */ |
ubhat | 0:6cc76d70e2a1 | 246 | case 224: |
ubhat | 0:6cc76d70e2a1 | 247 | { |
ubhat | 0:6cc76d70e2a1 | 248 | // Schedule next packet transmission |
ubhat | 0:6cc76d70e2a1 | 249 | TimerSetValue( &TxNextPacketTimer, COMPLIANCE_TX_DUTYCYCLE ); |
ubhat | 0:6cc76d70e2a1 | 250 | TimerStart( &TxNextPacketTimer ); |
ubhat | 0:6cc76d70e2a1 | 251 | break; |
ubhat | 0:6cc76d70e2a1 | 252 | } |
ubhat | 0:6cc76d70e2a1 | 253 | |
ubhat | 0:6cc76d70e2a1 | 254 | default: |
ubhat | 0:6cc76d70e2a1 | 255 | { |
ubhat | 0:6cc76d70e2a1 | 256 | // Schedule next packet transmission |
ubhat | 0:6cc76d70e2a1 | 257 | TimerSetValue( &TxNextPacketTimer, TxDutyCycleTime ); |
ubhat | 0:6cc76d70e2a1 | 258 | TimerStart( &TxNextPacketTimer ); |
ubhat | 0:6cc76d70e2a1 | 259 | break; |
ubhat | 0:6cc76d70e2a1 | 260 | } |
ubhat | 0:6cc76d70e2a1 | 261 | } |
ubhat | 0:6cc76d70e2a1 | 262 | |
ubhat | 0:6cc76d70e2a1 | 263 | } |
ubhat | 0:6cc76d70e2a1 | 264 | |
ubhat | 0:6cc76d70e2a1 | 265 | /*! |
ubhat | 0:6cc76d70e2a1 | 266 | * \brief What to do during JOIN process ? blink/toggle LED etc. |
ubhat | 0:6cc76d70e2a1 | 267 | */ |
ubhat | 0:6cc76d70e2a1 | 268 | void JoinEvent( void ) |
ubhat | 0:6cc76d70e2a1 | 269 | { |
ubhat | 0:6cc76d70e2a1 | 270 | } |
ubhat | 0:6cc76d70e2a1 | 271 | |
ubhat | 0:6cc76d70e2a1 | 272 | |
ubhat | 0:6cc76d70e2a1 | 273 | /*! |
ubhat | 0:6cc76d70e2a1 | 274 | * \brief What to do during TX ? blink/toggle LED etc. |
ubhat | 0:6cc76d70e2a1 | 275 | */ |
ubhat | 0:6cc76d70e2a1 | 276 | void TxEvent( void ) |
ubhat | 0:6cc76d70e2a1 | 277 | { |
ubhat | 0:6cc76d70e2a1 | 278 | } |
ubhat | 0:6cc76d70e2a1 | 279 | |
ubhat | 0:6cc76d70e2a1 | 280 | void RxEvent() |
ubhat | 0:6cc76d70e2a1 | 281 | { |
ubhat | 0:6cc76d70e2a1 | 282 | } |
ubhat | 0:6cc76d70e2a1 | 283 |