LoRa on Multitech with Semtech mote

Dependencies:   LoRaWAN-lib SX1272Lib lib_gps lib_mma8451q lib_mpl3115a2 mbed

Fork of LoRaWAN-NAMote72-Application-Demo_Multitech by Nagaraj Krishnamurthy

Committer:
ubhat
Date:
Tue May 17 00:21:55 2016 +0000
Revision:
0:69f2e28d12c1
Child:
6:f8194e691dd4
Project for LoRa Bootcamp

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ubhat 0:69f2e28d12c1 1 /*
ubhat 0:69f2e28d12c1 2 / _____) _ | |
ubhat 0:69f2e28d12c1 3 ( (____ _____ ____ _| |_ _____ ____| |__
ubhat 0:69f2e28d12c1 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
ubhat 0:69f2e28d12c1 5 _____) ) ____| | | || |_| ____( (___| | | |
ubhat 0:69f2e28d12c1 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
ubhat 0:69f2e28d12c1 7 (C)2015 Semtech
ubhat 0:69f2e28d12c1 8
ubhat 0:69f2e28d12c1 9 Description: User-defined applications such as GPS, Temp, Accelerometer, LED indications etc.
ubhat 0:69f2e28d12c1 10 Event based actions such as LED blink on Tx, LED toggle on downlink etc
ubhat 0:69f2e28d12c1 11
ubhat 0:69f2e28d12c1 12 License: Revised BSD License, see LICENSE.TXT file include in the project
ubhat 0:69f2e28d12c1 13
ubhat 0:69f2e28d12c1 14 Maintainer: Uttam Bhat
ubhat 0:69f2e28d12c1 15 */
ubhat 0:69f2e28d12c1 16
ubhat 0:69f2e28d12c1 17 #include "LoRaApp.h"
ubhat 0:69f2e28d12c1 18
ubhat 0:69f2e28d12c1 19 /*!
ubhat 0:69f2e28d12c1 20 * Red LED timer event
ubhat 0:69f2e28d12c1 21 */
ubhat 0:69f2e28d12c1 22 TimerLed RedLedTimer( Red );
ubhat 0:69f2e28d12c1 23
ubhat 0:69f2e28d12c1 24 /*!
ubhat 0:69f2e28d12c1 25 * Yellow LED timer event
ubhat 0:69f2e28d12c1 26 */
ubhat 0:69f2e28d12c1 27 TimerLed YellowLedTimer( Yellow );
ubhat 0:69f2e28d12c1 28
ubhat 0:69f2e28d12c1 29 /*!
ubhat 0:69f2e28d12c1 30 * Green LED timer event
ubhat 0:69f2e28d12c1 31 */
ubhat 0:69f2e28d12c1 32 TimerLed GreenLedTimer( Green );
ubhat 0:69f2e28d12c1 33
ubhat 0:69f2e28d12c1 34 Application::Application( uint8_t * memptr )
ubhat 0:69f2e28d12c1 35 {
ubhat 0:69f2e28d12c1 36 BuffAddr = memptr;
ubhat 0:69f2e28d12c1 37 memset( BuffAddr, 0, LORAWAN_APP_DATA_MAX_SIZE );
ubhat 0:69f2e28d12c1 38 BuffPtr = 0;
ubhat 0:69f2e28d12c1 39 }
ubhat 0:69f2e28d12c1 40
ubhat 0:69f2e28d12c1 41 Application::~Application( )
ubhat 0:69f2e28d12c1 42 {
ubhat 0:69f2e28d12c1 43 }
ubhat 0:69f2e28d12c1 44
ubhat 0:69f2e28d12c1 45 void Application::ApplicationAppendData( uint8_t *pData, uint8_t len )
ubhat 0:69f2e28d12c1 46 {
ubhat 0:69f2e28d12c1 47 memcpy( BuffAddr + BuffPtr, pData, len );
ubhat 0:69f2e28d12c1 48 BuffPtr += len;
ubhat 0:69f2e28d12c1 49 }
ubhat 0:69f2e28d12c1 50
ubhat 0:69f2e28d12c1 51 void Application::ApplicationPtrPos( uint8_t ptrPos )
ubhat 0:69f2e28d12c1 52 {
ubhat 0:69f2e28d12c1 53 BuffPtr = ptrPos;
ubhat 0:69f2e28d12c1 54 }
ubhat 0:69f2e28d12c1 55
ubhat 0:69f2e28d12c1 56 void Application::ApplicationCall( eAppType App )
ubhat 0:69f2e28d12c1 57 {
ubhat 0:69f2e28d12c1 58 switch( App )
ubhat 0:69f2e28d12c1 59 {
ubhat 0:69f2e28d12c1 60 // Appends 8 Bytes (3 bytes longitude, 3 bytes latitude, 2 bytes altitude) to TX buffer
ubhat 0:69f2e28d12c1 61 case AppGps:
ubhat 0:69f2e28d12c1 62 {
ubhat 0:69f2e28d12c1 63 Gps.service( );
ubhat 0:69f2e28d12c1 64
ubhat 0:69f2e28d12c1 65 uint16_t altitudeGps = atoi( Gps.NmeaGpsData.NmeaAltitude );
ubhat 0:69f2e28d12c1 66
ubhat 0:69f2e28d12c1 67 if( ( BuffPtr + 8 ) <= LORAWAN_APP_DATA_SIZE )
ubhat 0:69f2e28d12c1 68 {
ubhat 0:69f2e28d12c1 69 BuffAddr[BuffPtr++] = ( Gps.LatitudeBinary >> 16 ) & 0xFF;
ubhat 0:69f2e28d12c1 70 BuffAddr[BuffPtr++] = ( Gps.LatitudeBinary >> 8 ) & 0xFF;
ubhat 0:69f2e28d12c1 71 BuffAddr[BuffPtr++] = Gps.LatitudeBinary & 0xFF;
ubhat 0:69f2e28d12c1 72 BuffAddr[BuffPtr++] = ( Gps.LongitudeBinary >> 16 ) & 0xFF;
ubhat 0:69f2e28d12c1 73 BuffAddr[BuffPtr++] = ( Gps.LongitudeBinary >> 8 ) & 0xFF;
ubhat 0:69f2e28d12c1 74 BuffAddr[BuffPtr++] = Gps.LongitudeBinary & 0xFF;
ubhat 0:69f2e28d12c1 75 BuffAddr[BuffPtr++] = ( altitudeGps >> 8 ) & 0xFF;
ubhat 0:69f2e28d12c1 76 BuffAddr[BuffPtr++] = altitudeGps & 0xFF;
ubhat 0:69f2e28d12c1 77 }
ubhat 0:69f2e28d12c1 78 break;
ubhat 0:69f2e28d12c1 79 }
ubhat 0:69f2e28d12c1 80
ubhat 0:69f2e28d12c1 81 // Appends 1 Byte to TX buffer
ubhat 0:69f2e28d12c1 82 case AppTemp:
ubhat 0:69f2e28d12c1 83 {
ubhat 0:69f2e28d12c1 84 Mpl3115a2.ReadTemperature( );
ubhat 0:69f2e28d12c1 85 if( ( BuffPtr + 1 ) <= LORAWAN_APP_DATA_SIZE )
ubhat 0:69f2e28d12c1 86 {
ubhat 0:69f2e28d12c1 87 BuffAddr[BuffPtr++] = ( int32_t )Mpl3115a2.Temperature; // Signed degrees Celcius in half degree units. So, +/-63 °C
ubhat 0:69f2e28d12c1 88 }
ubhat 0:69f2e28d12c1 89 break;
ubhat 0:69f2e28d12c1 90 }
ubhat 0:69f2e28d12c1 91
ubhat 0:69f2e28d12c1 92 // Appends 1 Byte to TX buffer
ubhat 0:69f2e28d12c1 93 case AppBat:
ubhat 0:69f2e28d12c1 94 {
ubhat 0:69f2e28d12c1 95 if( ( BuffPtr + 1 ) <= LORAWAN_APP_DATA_SIZE )
ubhat 0:69f2e28d12c1 96 {
ubhat 0:69f2e28d12c1 97 BuffAddr[BuffPtr++] = BoardGetBatteryLevel( ); // Per LoRaWAN spec; 0 = Charging; 1...254 = level, 255 = N/A
ubhat 0:69f2e28d12c1 98 }
ubhat 0:69f2e28d12c1 99 break;
ubhat 0:69f2e28d12c1 100 }
ubhat 0:69f2e28d12c1 101
ubhat 0:69f2e28d12c1 102 // Appends incremental values of 1 Byte each to TX buffer until Full
ubhat 0:69f2e28d12c1 103 case AppRamp:
ubhat 0:69f2e28d12c1 104 {
ubhat 0:69f2e28d12c1 105 int32_t i, j;
ubhat 0:69f2e28d12c1 106
ubhat 0:69f2e28d12c1 107 // Populate Tx Buffer with increasing byte values starting from 0x00, 0x01, 0x02 ...
ubhat 0:69f2e28d12c1 108 for( i = BuffPtr, j = 0; i < LORAWAN_APP_DATA_SIZE; i++ )
ubhat 0:69f2e28d12c1 109 {
ubhat 0:69f2e28d12c1 110 BuffAddr[i] = j++;
ubhat 0:69f2e28d12c1 111 }
ubhat 0:69f2e28d12c1 112 BuffPtr = LORAWAN_APP_DATA_SIZE;
ubhat 0:69f2e28d12c1 113 break;
ubhat 0:69f2e28d12c1 114 }
ubhat 0:69f2e28d12c1 115
ubhat 0:69f2e28d12c1 116 // Appends 2 Bytes to TX buffer
ubhat 0:69f2e28d12c1 117 case AppAccl:
ubhat 0:69f2e28d12c1 118 {
ubhat 0:69f2e28d12c1 119 uint8_t statusReg;
ubhat 0:69f2e28d12c1 120
ubhat 0:69f2e28d12c1 121 // Read the PS_STATUS register
ubhat 0:69f2e28d12c1 122 statusReg = Mma8451q.read_single( MMA8451_PL_STATUS );
ubhat 0:69f2e28d12c1 123
ubhat 0:69f2e28d12c1 124 /* Display Orientation of NAMote on Serial Port */
ubhat 0:69f2e28d12c1 125 SerialAcclMetrDisplay( statusReg );
ubhat 0:69f2e28d12c1 126
ubhat 0:69f2e28d12c1 127 // If Orientation of the Mote changed then let Green LED ON
ubhat 0:69f2e28d12c1 128 if( ( statusReg & 0x80 ) != 0 )
ubhat 0:69f2e28d12c1 129 {
ubhat 0:69f2e28d12c1 130 AppLed = 1;
ubhat 0:69f2e28d12c1 131 CtrlLED( Green, LED_ON );
ubhat 0:69f2e28d12c1 132 }
ubhat 0:69f2e28d12c1 133
ubhat 0:69f2e28d12c1 134 // Read and populate device orientation in Tx Buffer
ubhat 0:69f2e28d12c1 135 if( ( BuffPtr + 2 ) <= LORAWAN_APP_DATA_SIZE )
ubhat 0:69f2e28d12c1 136 {
ubhat 0:69f2e28d12c1 137 if( statusReg & 0x40 )
ubhat 0:69f2e28d12c1 138 {
ubhat 0:69f2e28d12c1 139 if( statusReg & 0x01 )
ubhat 0:69f2e28d12c1 140 {
ubhat 0:69f2e28d12c1 141 BuffAddr[BuffPtr++] = 0x66; // horizontal + faceup
ubhat 0:69f2e28d12c1 142 }
ubhat 0:69f2e28d12c1 143 else
ubhat 0:69f2e28d12c1 144 {
ubhat 0:69f2e28d12c1 145 BuffAddr[BuffPtr++] = 0x99; // horizontal + facedown
ubhat 0:69f2e28d12c1 146 }
ubhat 0:69f2e28d12c1 147
ubhat 0:69f2e28d12c1 148 BuffAddr[BuffPtr++] = 0; // vertical = false
ubhat 0:69f2e28d12c1 149 }
ubhat 0:69f2e28d12c1 150 else
ubhat 0:69f2e28d12c1 151 {
ubhat 0:69f2e28d12c1 152 BuffAddr[BuffPtr++] = 0; // horizontal = false
ubhat 0:69f2e28d12c1 153 BuffAddr[BuffPtr++] = 0x11; // vertical = true
ubhat 0:69f2e28d12c1 154 }
ubhat 0:69f2e28d12c1 155 }
ubhat 0:69f2e28d12c1 156
ubhat 0:69f2e28d12c1 157 break;
ubhat 0:69f2e28d12c1 158 }
ubhat 0:69f2e28d12c1 159
ubhat 0:69f2e28d12c1 160 case AppAcclSenet:
ubhat 0:69f2e28d12c1 161 {
ubhat 0:69f2e28d12c1 162 uint8_t statusReg;
ubhat 0:69f2e28d12c1 163
ubhat 0:69f2e28d12c1 164 // Read the PS_STATUS register
ubhat 0:69f2e28d12c1 165 statusReg = Mma8451q.read_single( MMA8451_PL_STATUS );
ubhat 0:69f2e28d12c1 166
ubhat 0:69f2e28d12c1 167 /* Display Orientation of NAMote on Serial Port */
ubhat 0:69f2e28d12c1 168 SerialAcclMetrDisplay( statusReg );
ubhat 0:69f2e28d12c1 169
ubhat 0:69f2e28d12c1 170 // If Orientation of the Mote changed then populate Upper Nibble of 0th Byte of Tx Buffer
ubhat 0:69f2e28d12c1 171 if( ( statusReg & 0x40 ) != 0 )
ubhat 0:69f2e28d12c1 172 {
ubhat 0:69f2e28d12c1 173 AppLed = 0;
ubhat 0:69f2e28d12c1 174 CtrlLED( Green, LED_OFF );
ubhat 0:69f2e28d12c1 175 BuffAddr[BuffPtr++] = 0; // horizontal
ubhat 0:69f2e28d12c1 176 }
ubhat 0:69f2e28d12c1 177 else
ubhat 0:69f2e28d12c1 178 {
ubhat 0:69f2e28d12c1 179 AppLed = 1;
ubhat 0:69f2e28d12c1 180 CtrlLED( Green, LED_ON );
ubhat 0:69f2e28d12c1 181 BuffAddr[BuffPtr++] = 10; // vertical
ubhat 0:69f2e28d12c1 182 }
ubhat 0:69f2e28d12c1 183
ubhat 0:69f2e28d12c1 184 break;
ubhat 0:69f2e28d12c1 185 }
ubhat 0:69f2e28d12c1 186
ubhat 0:69f2e28d12c1 187 default:
ubhat 0:69f2e28d12c1 188 {
ubhat 0:69f2e28d12c1 189 break;
ubhat 0:69f2e28d12c1 190 }
ubhat 0:69f2e28d12c1 191 }
ubhat 0:69f2e28d12c1 192 }
ubhat 0:69f2e28d12c1 193
ubhat 0:69f2e28d12c1 194 static void OnRedLedTimerEvent( void )
ubhat 0:69f2e28d12c1 195 {
ubhat 0:69f2e28d12c1 196 TimerStop( &RedLedTimer.LedTimer );
ubhat 0:69f2e28d12c1 197
ubhat 0:69f2e28d12c1 198 if( RedLed == LED_OFF )
ubhat 0:69f2e28d12c1 199 {
ubhat 0:69f2e28d12c1 200 RedLed = LED_ON;
ubhat 0:69f2e28d12c1 201 }
ubhat 0:69f2e28d12c1 202 else
ubhat 0:69f2e28d12c1 203 {
ubhat 0:69f2e28d12c1 204 RedLed = LED_OFF;
ubhat 0:69f2e28d12c1 205 }
ubhat 0:69f2e28d12c1 206 }
ubhat 0:69f2e28d12c1 207
ubhat 0:69f2e28d12c1 208 static void OnYellowLedTimerEvent( void )
ubhat 0:69f2e28d12c1 209 {
ubhat 0:69f2e28d12c1 210 TimerStop( &YellowLedTimer.LedTimer );
ubhat 0:69f2e28d12c1 211
ubhat 0:69f2e28d12c1 212 if( YellowLed == LED_OFF )
ubhat 0:69f2e28d12c1 213 {
ubhat 0:69f2e28d12c1 214 YellowLed = LED_ON;
ubhat 0:69f2e28d12c1 215 }
ubhat 0:69f2e28d12c1 216 else
ubhat 0:69f2e28d12c1 217 {
ubhat 0:69f2e28d12c1 218 YellowLed = LED_OFF;
ubhat 0:69f2e28d12c1 219 }
ubhat 0:69f2e28d12c1 220 }
ubhat 0:69f2e28d12c1 221
ubhat 0:69f2e28d12c1 222 static void OnGreenLedTimerEvent( void )
ubhat 0:69f2e28d12c1 223 {
ubhat 0:69f2e28d12c1 224 TimerStop( &GreenLedTimer.LedTimer );
ubhat 0:69f2e28d12c1 225
ubhat 0:69f2e28d12c1 226 if( GreenLed == LED_OFF )
ubhat 0:69f2e28d12c1 227 {
ubhat 0:69f2e28d12c1 228 GreenLed = LED_ON;
ubhat 0:69f2e28d12c1 229 }
ubhat 0:69f2e28d12c1 230 else
ubhat 0:69f2e28d12c1 231 {
ubhat 0:69f2e28d12c1 232 GreenLed = LED_OFF;
ubhat 0:69f2e28d12c1 233 }
ubhat 0:69f2e28d12c1 234 }
ubhat 0:69f2e28d12c1 235
ubhat 0:69f2e28d12c1 236 TimerLed::TimerLed( eLedType led )
ubhat 0:69f2e28d12c1 237 {
ubhat 0:69f2e28d12c1 238 switch( led )
ubhat 0:69f2e28d12c1 239 {
ubhat 0:69f2e28d12c1 240 case Red:
ubhat 0:69f2e28d12c1 241 {
ubhat 0:69f2e28d12c1 242 TimerInit( &LedTimer, OnRedLedTimerEvent );
ubhat 0:69f2e28d12c1 243 break;
ubhat 0:69f2e28d12c1 244 }
ubhat 0:69f2e28d12c1 245
ubhat 0:69f2e28d12c1 246 case Yellow:
ubhat 0:69f2e28d12c1 247 {
ubhat 0:69f2e28d12c1 248 TimerInit( &LedTimer, OnYellowLedTimerEvent );
ubhat 0:69f2e28d12c1 249 break;
ubhat 0:69f2e28d12c1 250 }
ubhat 0:69f2e28d12c1 251
ubhat 0:69f2e28d12c1 252 case Green:
ubhat 0:69f2e28d12c1 253 {
ubhat 0:69f2e28d12c1 254 TimerInit( &LedTimer, OnGreenLedTimerEvent );
ubhat 0:69f2e28d12c1 255 break;
ubhat 0:69f2e28d12c1 256 }
ubhat 0:69f2e28d12c1 257 }
ubhat 0:69f2e28d12c1 258
ubhat 0:69f2e28d12c1 259 }
ubhat 0:69f2e28d12c1 260
ubhat 0:69f2e28d12c1 261 TimerLed::~TimerLed( )
ubhat 0:69f2e28d12c1 262 {
ubhat 0:69f2e28d12c1 263 }
ubhat 0:69f2e28d12c1 264
ubhat 0:69f2e28d12c1 265 void BlinkLED( eLedType led, uint32_t time )
ubhat 0:69f2e28d12c1 266 {
ubhat 0:69f2e28d12c1 267 switch( led )
ubhat 0:69f2e28d12c1 268 {
ubhat 0:69f2e28d12c1 269 case Red:
ubhat 0:69f2e28d12c1 270 {
ubhat 0:69f2e28d12c1 271 TimerSetValue( &RedLedTimer.LedTimer, time );
ubhat 0:69f2e28d12c1 272 TimerStart( &RedLedTimer.LedTimer );
ubhat 0:69f2e28d12c1 273 RedLed = LED_ON;
ubhat 0:69f2e28d12c1 274 break;
ubhat 0:69f2e28d12c1 275 }
ubhat 0:69f2e28d12c1 276
ubhat 0:69f2e28d12c1 277 case Yellow:
ubhat 0:69f2e28d12c1 278 {
ubhat 0:69f2e28d12c1 279 TimerSetValue( &YellowLedTimer.LedTimer, time );
ubhat 0:69f2e28d12c1 280 TimerStart( &YellowLedTimer.LedTimer );
ubhat 0:69f2e28d12c1 281 YellowLed = LED_ON;
ubhat 0:69f2e28d12c1 282 break;
ubhat 0:69f2e28d12c1 283 }
ubhat 0:69f2e28d12c1 284
ubhat 0:69f2e28d12c1 285 case Green:
ubhat 0:69f2e28d12c1 286 {
ubhat 0:69f2e28d12c1 287 TimerSetValue( &GreenLedTimer.LedTimer, time );
ubhat 0:69f2e28d12c1 288 TimerStart( &GreenLedTimer.LedTimer );
ubhat 0:69f2e28d12c1 289 GreenLed = LED_ON;
ubhat 0:69f2e28d12c1 290 break;
ubhat 0:69f2e28d12c1 291 }
ubhat 0:69f2e28d12c1 292 }
ubhat 0:69f2e28d12c1 293 }
ubhat 0:69f2e28d12c1 294
ubhat 0:69f2e28d12c1 295 void ToggleLED( eLedType led )
ubhat 0:69f2e28d12c1 296 {
ubhat 0:69f2e28d12c1 297 switch( led )
ubhat 0:69f2e28d12c1 298 {
ubhat 0:69f2e28d12c1 299 case Red:
ubhat 0:69f2e28d12c1 300 {
ubhat 0:69f2e28d12c1 301 if( RedLed == LED_OFF )
ubhat 0:69f2e28d12c1 302 {
ubhat 0:69f2e28d12c1 303 RedLed = LED_ON;
ubhat 0:69f2e28d12c1 304 }
ubhat 0:69f2e28d12c1 305 else
ubhat 0:69f2e28d12c1 306 {
ubhat 0:69f2e28d12c1 307 RedLed = LED_OFF;
ubhat 0:69f2e28d12c1 308 }
ubhat 0:69f2e28d12c1 309 break;
ubhat 0:69f2e28d12c1 310 }
ubhat 0:69f2e28d12c1 311
ubhat 0:69f2e28d12c1 312 case Yellow:
ubhat 0:69f2e28d12c1 313 {
ubhat 0:69f2e28d12c1 314 if( YellowLed == LED_OFF )
ubhat 0:69f2e28d12c1 315 {
ubhat 0:69f2e28d12c1 316 YellowLed = LED_ON;
ubhat 0:69f2e28d12c1 317 }
ubhat 0:69f2e28d12c1 318 else
ubhat 0:69f2e28d12c1 319 {
ubhat 0:69f2e28d12c1 320 YellowLed = LED_OFF;
ubhat 0:69f2e28d12c1 321 }
ubhat 0:69f2e28d12c1 322 break;
ubhat 0:69f2e28d12c1 323 }
ubhat 0:69f2e28d12c1 324
ubhat 0:69f2e28d12c1 325 case Green:
ubhat 0:69f2e28d12c1 326 {
ubhat 0:69f2e28d12c1 327 if( GreenLed == LED_OFF )
ubhat 0:69f2e28d12c1 328 {
ubhat 0:69f2e28d12c1 329 GreenLed = LED_ON;
ubhat 0:69f2e28d12c1 330 }
ubhat 0:69f2e28d12c1 331 else
ubhat 0:69f2e28d12c1 332 {
ubhat 0:69f2e28d12c1 333 GreenLed = LED_OFF;
ubhat 0:69f2e28d12c1 334 }
ubhat 0:69f2e28d12c1 335 break;
ubhat 0:69f2e28d12c1 336 }
ubhat 0:69f2e28d12c1 337 }
ubhat 0:69f2e28d12c1 338 }
ubhat 0:69f2e28d12c1 339
ubhat 0:69f2e28d12c1 340 void CtrlLED( eLedType led, uint8_t state )
ubhat 0:69f2e28d12c1 341 {
ubhat 0:69f2e28d12c1 342 switch( led )
ubhat 0:69f2e28d12c1 343 {
ubhat 0:69f2e28d12c1 344 case Red:
ubhat 0:69f2e28d12c1 345 {
ubhat 0:69f2e28d12c1 346 RedLed = state;
ubhat 0:69f2e28d12c1 347 break;
ubhat 0:69f2e28d12c1 348 }
ubhat 0:69f2e28d12c1 349
ubhat 0:69f2e28d12c1 350 case Yellow:
ubhat 0:69f2e28d12c1 351 {
ubhat 0:69f2e28d12c1 352 YellowLed = state;
ubhat 0:69f2e28d12c1 353 break;
ubhat 0:69f2e28d12c1 354 }
ubhat 0:69f2e28d12c1 355
ubhat 0:69f2e28d12c1 356 case Green:
ubhat 0:69f2e28d12c1 357 {
ubhat 0:69f2e28d12c1 358 GreenLed = state;
ubhat 0:69f2e28d12c1 359 break;
ubhat 0:69f2e28d12c1 360 }
ubhat 0:69f2e28d12c1 361
ubhat 0:69f2e28d12c1 362 case Usr:
ubhat 0:69f2e28d12c1 363 {
ubhat 0:69f2e28d12c1 364 if( state )
ubhat 0:69f2e28d12c1 365 {
ubhat 0:69f2e28d12c1 366 UsrLed = LED_ON;
ubhat 0:69f2e28d12c1 367 }
ubhat 0:69f2e28d12c1 368 else
ubhat 0:69f2e28d12c1 369 {
ubhat 0:69f2e28d12c1 370 UsrLed = LED_OFF;
ubhat 0:69f2e28d12c1 371 }
ubhat 0:69f2e28d12c1 372 break;
ubhat 0:69f2e28d12c1 373 }
ubhat 0:69f2e28d12c1 374 }
ubhat 0:69f2e28d12c1 375 }