Nucleo-f401re

Dependencies:   SX1276Lib mbed

Fork of SX1276PingPongFHSS by Semtech

Committer:
sdyoo
Date:
Tue Nov 08 05:38:09 2016 +0000
Revision:
6:cb16b23bb7eb
Parent:
4:cd44376a1408
lora ping ping test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GregCr 0:db48addeabda 1 #include "mbed.h"
GregCr 2:b03bdfedfafa 2 #include "main.h"
GregCr 1:41b10c760ff2 3 #include "sx1276-hal.h"
GregCr 2:b03bdfedfafa 4 #include "debug.h"
GregCr 0:db48addeabda 5
GregCr 0:db48addeabda 6 /* Set this flag to '1' to display debug messages on the console */
GregCr 2:b03bdfedfafa 7 #define DEBUG_MESSAGE 0
GregCr 0:db48addeabda 8
GregCr 0:db48addeabda 9 /* Set this flag to '1' to use the LoRa modulation or to '0' to use FSK modulation */
GregCr 0:db48addeabda 10 #define USE_MODEM_LORA 1
GregCr 0:db48addeabda 11 #define USE_MODEM_FSK !USE_MODEM_LORA
GregCr 0:db48addeabda 12
GregCr 0:db48addeabda 13 #define RF_FREQUENCY 915000000 // Hz
GregCr 0:db48addeabda 14 #define TX_OUTPUT_POWER 14 // 14 dBm
GregCr 0:db48addeabda 15
GregCr 0:db48addeabda 16 #if USE_MODEM_LORA == 1
GregCr 0:db48addeabda 17
GregCr 0:db48addeabda 18 #define LORA_BANDWIDTH 1 // [0: 125 kHz,
GregCr 0:db48addeabda 19 // 1: 250 kHz,
GregCr 0:db48addeabda 20 // 2: 500 kHz,
GregCr 0:db48addeabda 21 // 3: Reserved]
GregCr 0:db48addeabda 22 #define LORA_SPREADING_FACTOR 10 // [SF7..SF12]
GregCr 0:db48addeabda 23 #define LORA_CODINGRATE 1 // [1: 4/5,
GregCr 0:db48addeabda 24 // 2: 4/6,
GregCr 0:db48addeabda 25 // 3: 4/7,
GregCr 0:db48addeabda 26 // 4: 4/8]
GregCr 0:db48addeabda 27 #define LORA_PREAMBLE_LENGTH 8 // Same for Tx and Rx
GregCr 0:db48addeabda 28 #define LORA_SYMBOL_TIMEOUT 5 // Symbols
GregCr 0:db48addeabda 29 #define LORA_FIX_LENGTH_PAYLOAD_ON false
GregCr 0:db48addeabda 30 #define LORA_FHSS_ENABLED true
GregCr 0:db48addeabda 31 #define LORA_NB_SYMB_HOP 4
GregCr 0:db48addeabda 32 #define LORA_IQ_INVERSION_ON false
GregCr 0:db48addeabda 33 #define LORA_CRC_ENABLED true
GregCr 0:db48addeabda 34
GregCr 0:db48addeabda 35 #elif USE_MODEM_FSK == 1
GregCr 0:db48addeabda 36
GregCr 0:db48addeabda 37 #define FSK_FDEV 25000 // Hz
GregCr 0:db48addeabda 38 #define FSK_DATARATE 19200 // bps
GregCr 0:db48addeabda 39 #define FSK_BANDWIDTH 50000 // Hz
GregCr 0:db48addeabda 40 #define FSK_AFC_BANDWIDTH 83333 // Hz
GregCr 0:db48addeabda 41 #define FSK_PREAMBLE_LENGTH 5 // Same for Tx and Rx
GregCr 0:db48addeabda 42 #define FSK_FIX_LENGTH_PAYLOAD_ON false
GregCr 0:db48addeabda 43 #define FSK_CRC_ENABLED true
GregCr 0:db48addeabda 44
GregCr 0:db48addeabda 45 #else
GregCr 0:db48addeabda 46 #error "Please define a modem in the compiler options."
GregCr 0:db48addeabda 47 #endif
GregCr 0:db48addeabda 48
GregCr 2:b03bdfedfafa 49 #define RX_TIMEOUT_VALUE 3500000 // in us
GregCr 2:b03bdfedfafa 50 #define BUFFER_SIZE 32 // Define the payload size here [min:1 max:255]
GregCr 0:db48addeabda 51
GregCr 2:b03bdfedfafa 52 #if( defined ( TARGET_KL25Z ) || defined ( TARGET_LPC11U6X ) )
GregCr 0:db48addeabda 53 DigitalOut led(LED2);
GregCr 0:db48addeabda 54 #else
GregCr 0:db48addeabda 55 DigitalOut led(LED1);
GregCr 0:db48addeabda 56 #endif
GregCr 0:db48addeabda 57
GregCr 0:db48addeabda 58 /*
GregCr 0:db48addeabda 59 * Global variables declarations
GregCr 0:db48addeabda 60 */
mluis 4:cd44376a1408 61 typedef enum
mluis 4:cd44376a1408 62 {
mluis 4:cd44376a1408 63 LOWPOWER = 0,
mluis 4:cd44376a1408 64 IDLE,
mluis 4:cd44376a1408 65
mluis 4:cd44376a1408 66 RX,
mluis 4:cd44376a1408 67 RX_TIMEOUT,
mluis 4:cd44376a1408 68 RX_ERROR,
mluis 4:cd44376a1408 69
mluis 4:cd44376a1408 70 TX,
mluis 4:cd44376a1408 71 TX_TIMEOUT,
mluis 4:cd44376a1408 72
mluis 4:cd44376a1408 73 CAD,
mluis 4:cd44376a1408 74 CAD_DONE
mluis 4:cd44376a1408 75 }AppStates_t;
mluis 4:cd44376a1408 76
mluis 4:cd44376a1408 77 volatile AppStates_t State = LOWPOWER;
mluis 4:cd44376a1408 78
mluis 4:cd44376a1408 79 /*!
mluis 4:cd44376a1408 80 * Radio events function pointer
mluis 4:cd44376a1408 81 */
mluis 4:cd44376a1408 82 static RadioEvents_t RadioEvents;
GregCr 0:db48addeabda 83
GregCr 0:db48addeabda 84 /*
GregCr 0:db48addeabda 85 * Global variables declarations
GregCr 0:db48addeabda 86 */
mluis 4:cd44376a1408 87 SX1276MB1xAS Radio( NULL );
GregCr 0:db48addeabda 88
GregCr 0:db48addeabda 89 const uint8_t PingMsg[] = "PING";
GregCr 0:db48addeabda 90 const uint8_t PongMsg[] = "PONG";
GregCr 0:db48addeabda 91
GregCr 0:db48addeabda 92 uint16_t BufferSize = BUFFER_SIZE;
GregCr 0:db48addeabda 93 uint8_t Buffer[BUFFER_SIZE];
GregCr 0:db48addeabda 94
GregCr 0:db48addeabda 95 int16_t RssiValue = 0.0;
GregCr 0:db48addeabda 96 int8_t SnrValue = 0.0;
GregCr 0:db48addeabda 97
GregCr 0:db48addeabda 98 int main()
GregCr 0:db48addeabda 99 {
GregCr 0:db48addeabda 100 uint8_t i;
GregCr 0:db48addeabda 101 bool isMaster = true;
GregCr 0:db48addeabda 102
GregCr 2:b03bdfedfafa 103 debug( "\n\n\r SX1276 Ping Pong Demo Application \n\n\r" );
mluis 4:cd44376a1408 104
mluis 4:cd44376a1408 105 // Initialize Radio driver
mluis 4:cd44376a1408 106 RadioEvents.TxDone = OnTxDone;
mluis 4:cd44376a1408 107 RadioEvents.RxDone = OnRxDone;
mluis 4:cd44376a1408 108 RadioEvents.RxError = OnRxError;
mluis 4:cd44376a1408 109 RadioEvents.TxTimeout = OnTxTimeout;
mluis 4:cd44376a1408 110 RadioEvents.RxTimeout = OnRxTimeout;
mluis 4:cd44376a1408 111 RadioEvents.FhssChangeChannel = OnFhssChangeChannel;
mluis 4:cd44376a1408 112 Radio.Init( &RadioEvents );
GregCr 0:db48addeabda 113
GregCr 2:b03bdfedfafa 114 // verify the connection with the board
GregCr 2:b03bdfedfafa 115 while( Radio.Read( REG_VERSION ) == 0x00 )
GregCr 0:db48addeabda 116 {
GregCr 2:b03bdfedfafa 117 debug( "Radio could not be detected!\n\r", NULL );
GregCr 2:b03bdfedfafa 118 wait( 1 );
GregCr 0:db48addeabda 119 }
GregCr 2:b03bdfedfafa 120
GregCr 2:b03bdfedfafa 121 debug_if( ( DEBUG_MESSAGE & ( Radio.DetectBoardType( ) == SX1276MB1LAS ) ) , "\n\r > Board Type: SX1276MB1LAS < \n\r" );
GregCr 2:b03bdfedfafa 122 debug_if( ( DEBUG_MESSAGE & ( Radio.DetectBoardType( ) == SX1276MB1MAS ) ) , "\n\r > Board Type: SX1276MB1MAS < \n\r" );
GregCr 0:db48addeabda 123
GregCr 0:db48addeabda 124 Radio.SetChannel( HoppingFrequencies[0] );
GregCr 0:db48addeabda 125
GregCr 0:db48addeabda 126 #if USE_MODEM_LORA == 1
GregCr 0:db48addeabda 127
GregCr 2:b03bdfedfafa 128 debug_if( LORA_FHSS_ENABLED, "\n\n\r > LORA FHSS Mode < \n\n\r");
GregCr 2:b03bdfedfafa 129 debug_if( !LORA_FHSS_ENABLED, "\n\n\r > LORA Mode < \n\n\r");
GregCr 2:b03bdfedfafa 130
GregCr 0:db48addeabda 131 Radio.SetTxConfig( MODEM_LORA, TX_OUTPUT_POWER, 0, LORA_BANDWIDTH,
GregCr 0:db48addeabda 132 LORA_SPREADING_FACTOR, LORA_CODINGRATE,
GregCr 0:db48addeabda 133 LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON,
GregCr 0:db48addeabda 134 LORA_CRC_ENABLED, LORA_FHSS_ENABLED, LORA_NB_SYMB_HOP,
GregCr 0:db48addeabda 135 LORA_IQ_INVERSION_ON, 4000000 );
GregCr 0:db48addeabda 136
GregCr 0:db48addeabda 137 Radio.SetRxConfig( MODEM_LORA, LORA_BANDWIDTH, LORA_SPREADING_FACTOR,
GregCr 0:db48addeabda 138 LORA_CODINGRATE, 0, LORA_PREAMBLE_LENGTH,
mluis 3:99bd9ae6906f 139 LORA_SYMBOL_TIMEOUT, LORA_FIX_LENGTH_PAYLOAD_ON, 0,
GregCr 0:db48addeabda 140 LORA_CRC_ENABLED, LORA_FHSS_ENABLED, LORA_NB_SYMB_HOP,
GregCr 0:db48addeabda 141 LORA_IQ_INVERSION_ON, true );
GregCr 0:db48addeabda 142
GregCr 0:db48addeabda 143 #elif USE_MODEM_FSK == 1
GregCr 0:db48addeabda 144
GregCr 2:b03bdfedfafa 145 debug("\n\n\r > FSK Mode < \n\n\r");
GregCr 0:db48addeabda 146 Radio.SetTxConfig( MODEM_FSK, TX_OUTPUT_POWER, FSK_FDEV, 0,
GregCr 0:db48addeabda 147 FSK_DATARATE, 0,
GregCr 0:db48addeabda 148 FSK_PREAMBLE_LENGTH, FSK_FIX_LENGTH_PAYLOAD_ON,
GregCr 0:db48addeabda 149 FSK_CRC_ENABLED, 0, 0, 0, 3000000 );
GregCr 0:db48addeabda 150
GregCr 0:db48addeabda 151 Radio.SetRxConfig( MODEM_FSK, FSK_BANDWIDTH, FSK_DATARATE,
GregCr 0:db48addeabda 152 0, FSK_AFC_BANDWIDTH, FSK_PREAMBLE_LENGTH,
mluis 3:99bd9ae6906f 153 0, FSK_FIX_LENGTH_PAYLOAD_ON, 0, FSK_CRC_ENABLED,
GregCr 0:db48addeabda 154 0, 0, false, true );
GregCr 0:db48addeabda 155
GregCr 0:db48addeabda 156 #else
GregCr 0:db48addeabda 157
GregCr 0:db48addeabda 158 #error "Please define a modem in the compiler options."
GregCr 0:db48addeabda 159
GregCr 0:db48addeabda 160 #endif
GregCr 0:db48addeabda 161
GregCr 2:b03bdfedfafa 162 debug_if( DEBUG_MESSAGE, "Starting Ping-Pong loop\r\n" );
GregCr 0:db48addeabda 163
GregCr 0:db48addeabda 164 led = 0;
GregCr 0:db48addeabda 165
GregCr 0:db48addeabda 166 Radio.Rx( RX_TIMEOUT_VALUE );
GregCr 0:db48addeabda 167
GregCr 0:db48addeabda 168 while( 1 )
GregCr 0:db48addeabda 169 {
GregCr 0:db48addeabda 170 switch( State )
GregCr 0:db48addeabda 171 {
GregCr 0:db48addeabda 172 case RX:
GregCr 0:db48addeabda 173 if( isMaster == true )
GregCr 0:db48addeabda 174 {
GregCr 0:db48addeabda 175 if( BufferSize > 0 )
GregCr 0:db48addeabda 176 {
GregCr 0:db48addeabda 177 if( strncmp( ( const char* )Buffer, ( const char* )PongMsg, 4 ) == 0 )
GregCr 0:db48addeabda 178 {
GregCr 0:db48addeabda 179 led = !led;
GregCr 0:db48addeabda 180 debug( "...Pong\r\n" );
GregCr 0:db48addeabda 181 // Send the next PING frame
GregCr 2:b03bdfedfafa 182 strcpy( ( char* )Buffer, ( char* )PingMsg );
GregCr 0:db48addeabda 183 // We fill the buffer with numbers for the payload
GregCr 0:db48addeabda 184 for( i = 4; i < BufferSize; i++ )
GregCr 0:db48addeabda 185 {
GregCr 0:db48addeabda 186 Buffer[i] = i - 4;
GregCr 0:db48addeabda 187 }
GregCr 0:db48addeabda 188 wait_ms( 10 );
GregCr 0:db48addeabda 189 Radio.Send( Buffer, BufferSize );
GregCr 0:db48addeabda 190 }
GregCr 0:db48addeabda 191 else if( strncmp( ( const char* )Buffer, ( const char* )PingMsg, 4 ) == 0 )
GregCr 0:db48addeabda 192 { // A master already exists then become a slave
GregCr 0:db48addeabda 193 debug( "...Ping\r\n" );
GregCr 0:db48addeabda 194 led = !led;
GregCr 0:db48addeabda 195 isMaster = false;
GregCr 2:b03bdfedfafa 196 // Send the next PONG frame
GregCr 2:b03bdfedfafa 197 strcpy( ( char* )Buffer, ( char* )PongMsg );
GregCr 0:db48addeabda 198 // We fill the buffer with numbers for the payload
GregCr 0:db48addeabda 199 for( i = 4; i < BufferSize; i++ )
GregCr 0:db48addeabda 200 {
GregCr 0:db48addeabda 201 Buffer[i] = i - 4;
GregCr 0:db48addeabda 202 }
GregCr 0:db48addeabda 203 wait_ms( 10 );
GregCr 0:db48addeabda 204 Radio.Send( Buffer, BufferSize );
GregCr 0:db48addeabda 205 }
GregCr 0:db48addeabda 206 else // valid reception but neither a PING or a PONG message
GregCr 0:db48addeabda 207 { // Set device as master ans start again
GregCr 0:db48addeabda 208 isMaster = true;
GregCr 0:db48addeabda 209 Radio.Rx( RX_TIMEOUT_VALUE );
GregCr 0:db48addeabda 210 }
GregCr 0:db48addeabda 211 }
GregCr 0:db48addeabda 212 }
GregCr 0:db48addeabda 213 else
GregCr 0:db48addeabda 214 {
GregCr 0:db48addeabda 215 if( BufferSize > 0 )
GregCr 0:db48addeabda 216 {
GregCr 0:db48addeabda 217 if( strncmp( ( const char* )Buffer, ( const char* )PingMsg, 4 ) == 0 )
GregCr 0:db48addeabda 218 {
GregCr 0:db48addeabda 219 led = !led;
GregCr 0:db48addeabda 220 debug( "...Ping\r\n" );
GregCr 0:db48addeabda 221 // Send the reply to the PING string
GregCr 2:b03bdfedfafa 222 strcpy( ( char* )Buffer, ( char* )PongMsg );
GregCr 0:db48addeabda 223 // We fill the buffer with numbers for the payload
GregCr 0:db48addeabda 224 for( i = 4; i < BufferSize; i++ )
GregCr 0:db48addeabda 225 {
GregCr 0:db48addeabda 226 Buffer[i] = i - 4;
GregCr 0:db48addeabda 227 }
GregCr 0:db48addeabda 228 wait_ms( 10 );
GregCr 0:db48addeabda 229 Radio.Send( Buffer, BufferSize );
GregCr 0:db48addeabda 230 }
GregCr 0:db48addeabda 231 else // valid reception but not a PING as expected
GregCr 0:db48addeabda 232 { // Set device as master and start again
GregCr 0:db48addeabda 233 isMaster = true;
GregCr 0:db48addeabda 234 Radio.Rx( RX_TIMEOUT_VALUE );
GregCr 0:db48addeabda 235 }
GregCr 0:db48addeabda 236 }
GregCr 0:db48addeabda 237 }
GregCr 0:db48addeabda 238 State = LOWPOWER;
GregCr 0:db48addeabda 239 break;
GregCr 0:db48addeabda 240 case TX:
GregCr 0:db48addeabda 241 led = !led;
GregCr 0:db48addeabda 242 if( isMaster == true )
GregCr 0:db48addeabda 243 {
GregCr 0:db48addeabda 244 debug( "Ping...\r\n" );
GregCr 0:db48addeabda 245 }
GregCr 0:db48addeabda 246 else
GregCr 0:db48addeabda 247 {
GregCr 0:db48addeabda 248 debug( "Pong...\r\n" );
GregCr 0:db48addeabda 249 }
GregCr 0:db48addeabda 250 Radio.Rx( RX_TIMEOUT_VALUE );
GregCr 0:db48addeabda 251 State = LOWPOWER;
GregCr 0:db48addeabda 252 break;
GregCr 0:db48addeabda 253 case RX_TIMEOUT:
GregCr 0:db48addeabda 254 if( isMaster == true )
GregCr 0:db48addeabda 255 {
GregCr 0:db48addeabda 256 // Send the next PING frame
GregCr 2:b03bdfedfafa 257 strcpy( ( char* )Buffer, ( char* )PingMsg );
GregCr 0:db48addeabda 258 for( i = 4; i < BufferSize; i++ )
GregCr 0:db48addeabda 259 {
GregCr 0:db48addeabda 260 Buffer[i] = i - 4;
GregCr 0:db48addeabda 261 }
GregCr 0:db48addeabda 262 wait_ms( 10 );
GregCr 0:db48addeabda 263 Radio.Send( Buffer, BufferSize );
GregCr 0:db48addeabda 264 }
GregCr 0:db48addeabda 265 else
GregCr 0:db48addeabda 266 {
GregCr 0:db48addeabda 267 Radio.Rx( RX_TIMEOUT_VALUE );
GregCr 0:db48addeabda 268 }
GregCr 0:db48addeabda 269 State = LOWPOWER;
GregCr 0:db48addeabda 270 break;
GregCr 0:db48addeabda 271 case RX_ERROR:
GregCr 2:b03bdfedfafa 272 // We have received a Packet with a CRC error, send reply as if packet was correct
GregCr 0:db48addeabda 273 if( isMaster == true )
GregCr 0:db48addeabda 274 {
GregCr 0:db48addeabda 275 // Send the next PING frame
GregCr 2:b03bdfedfafa 276 strcpy( ( char* )Buffer, ( char* )PingMsg );
GregCr 0:db48addeabda 277 for( i = 4; i < BufferSize; i++ )
GregCr 0:db48addeabda 278 {
GregCr 0:db48addeabda 279 Buffer[i] = i - 4;
GregCr 0:db48addeabda 280 }
GregCr 0:db48addeabda 281 wait_ms( 10 );
GregCr 0:db48addeabda 282 Radio.Send( Buffer, BufferSize );
GregCr 0:db48addeabda 283 }
GregCr 0:db48addeabda 284 else
GregCr 0:db48addeabda 285 {
GregCr 0:db48addeabda 286 // Send the next PONG frame
GregCr 2:b03bdfedfafa 287 strcpy( ( char* )Buffer, ( char* )PongMsg );
GregCr 0:db48addeabda 288 for( i = 4; i < BufferSize; i++ )
GregCr 0:db48addeabda 289 {
GregCr 0:db48addeabda 290 Buffer[i] = i - 4;
GregCr 0:db48addeabda 291 }
GregCr 0:db48addeabda 292 wait_ms( 10 );
GregCr 0:db48addeabda 293 Radio.Send( Buffer, BufferSize );
GregCr 0:db48addeabda 294 }
GregCr 0:db48addeabda 295 State = LOWPOWER;
GregCr 0:db48addeabda 296 break;
GregCr 0:db48addeabda 297 case TX_TIMEOUT:
GregCr 0:db48addeabda 298 Radio.Rx( RX_TIMEOUT_VALUE );
GregCr 0:db48addeabda 299 State = LOWPOWER;
GregCr 0:db48addeabda 300 break;
GregCr 0:db48addeabda 301 case LOWPOWER:
GregCr 0:db48addeabda 302 break;
GregCr 0:db48addeabda 303 default:
GregCr 0:db48addeabda 304 State = LOWPOWER;
GregCr 0:db48addeabda 305 break;
GregCr 0:db48addeabda 306 }
GregCr 0:db48addeabda 307 }
GregCr 0:db48addeabda 308 }
GregCr 0:db48addeabda 309
GregCr 0:db48addeabda 310 void OnTxDone( void )
GregCr 0:db48addeabda 311 {
GregCr 0:db48addeabda 312 Radio.SetChannel( HoppingFrequencies[0] );
GregCr 0:db48addeabda 313 Radio.Sleep( );
GregCr 0:db48addeabda 314 State = TX;
GregCr 2:b03bdfedfafa 315 debug_if( DEBUG_MESSAGE, "> OnTxDone\n\r" );
GregCr 0:db48addeabda 316 }
GregCr 0:db48addeabda 317
GregCr 0:db48addeabda 318 void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr)
GregCr 0:db48addeabda 319 {
GregCr 0:db48addeabda 320 Radio.SetChannel( HoppingFrequencies[0] );
GregCr 0:db48addeabda 321 Radio.Sleep( );
GregCr 0:db48addeabda 322 BufferSize = size;
GregCr 0:db48addeabda 323 memcpy( Buffer, payload, BufferSize );
GregCr 0:db48addeabda 324 RssiValue = rssi;
GregCr 0:db48addeabda 325 SnrValue = snr;
GregCr 0:db48addeabda 326 State = RX;
GregCr 2:b03bdfedfafa 327 debug_if( DEBUG_MESSAGE, "> OnRxDone\n\r" );
GregCr 0:db48addeabda 328 }
GregCr 0:db48addeabda 329
GregCr 0:db48addeabda 330 void OnTxTimeout( void )
GregCr 0:db48addeabda 331 {
GregCr 0:db48addeabda 332 Radio.SetChannel( HoppingFrequencies[0] );
GregCr 0:db48addeabda 333 Radio.Sleep( );
GregCr 0:db48addeabda 334 State = TX_TIMEOUT;
GregCr 2:b03bdfedfafa 335 debug_if( DEBUG_MESSAGE, "> OnTxTimeout\n\r" );
GregCr 0:db48addeabda 336 }
GregCr 0:db48addeabda 337
GregCr 0:db48addeabda 338 void OnRxTimeout( void )
GregCr 0:db48addeabda 339 {
GregCr 0:db48addeabda 340 Radio.SetChannel( HoppingFrequencies[0] );
GregCr 0:db48addeabda 341 Radio.Sleep( );
GregCr 0:db48addeabda 342 Buffer[ BufferSize ] = 0;
GregCr 0:db48addeabda 343 State = RX_TIMEOUT;
GregCr 2:b03bdfedfafa 344 debug_if( DEBUG_MESSAGE, "> OnRxTimeout\n\r" );
GregCr 0:db48addeabda 345 }
GregCr 0:db48addeabda 346
GregCr 0:db48addeabda 347 void OnRxError( void )
GregCr 0:db48addeabda 348 {
GregCr 0:db48addeabda 349 Radio.SetChannel( HoppingFrequencies[0] );
GregCr 0:db48addeabda 350 Radio.Sleep( );
GregCr 0:db48addeabda 351 State = RX_ERROR;
GregCr 2:b03bdfedfafa 352 debug_if( DEBUG_MESSAGE, "> OnRxError\n\r" );
GregCr 0:db48addeabda 353 }
GregCr 0:db48addeabda 354
GregCr 0:db48addeabda 355 void OnFhssChangeChannel( uint8_t channelIndex )
GregCr 0:db48addeabda 356 {
GregCr 0:db48addeabda 357 Radio.SetChannel( HoppingFrequencies[channelIndex] );
GregCr 1:41b10c760ff2 358 debug_if( DEBUG_MESSAGE, "F%d-", channelIndex);
GregCr 0:db48addeabda 359 }