SHARE
TWEET

Untitled

a guest Jun 23rd, 2013 277 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. while(1) {
  2.     RX_POWERUP;
  3.     mirf_CSN_lo; // Pull down chip select
  4.     SPI.transfer(FLUSH_RX);  // Write cmd to flush rx fifo
  5.     mirf_CSN_hi; // Pull up chip select
  6.     mirf_CE_hi; // Start listening
  7.  
  8.     // Wait for incoming requests
  9.     Serial.println("Scanning");
  10.  
  11.     int rfchannel = 0;
  12.     while (1) {
  13.       mirf_config_register(RF_CH, rfchannel);
  14.      
  15.       // Or focus on a specific channel
  16.       //mirf_config_register(RF_CH, 2);
  17.      
  18.       mirf_CE_lo;
  19.  
  20.       mirf_CSN_lo; // Pull down chip select
  21.       SPI.transfer(FLUSH_RX);  // Write cmd to flush rx fifo
  22.       mirf_CSN_hi; // Pull up chip select
  23.  
  24.       mirf_CE_hi; // Start listening
  25.  
  26.       Serial.print("Channel = ");
  27.       Serial.print(rfchannel, DEC);
  28.  
  29.       int delaytime = 0;
  30.       int rpdcount = 0;
  31.       while (delaytime < 32000) {
  32.         delaytime++;
  33.         if (rpd_status() == 1) {
  34.           rpdcount++;
  35.         }
  36.       }
  37.  
  38.       Serial.print("  RPD = ");
  39.       Serial.println(rpdcount, DEC);
  40.  
  41.       rfchannel++;
  42.       if (rfchannel >= 125) {
  43.         rfchannel = 0;
  44.       }
  45.  
  46.  
  47.     }
  48.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top