Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while(1) {
- RX_POWERUP;
- mirf_CSN_lo; // Pull down chip select
- SPI.transfer(FLUSH_RX); // Write cmd to flush rx fifo
- mirf_CSN_hi; // Pull up chip select
- mirf_CE_hi; // Start listening
- // Wait for incoming requests
- Serial.println("Scanning");
- int rfchannel = 0;
- while (1) {
- mirf_config_register(RF_CH, rfchannel);
- // Or focus on a specific channel
- //mirf_config_register(RF_CH, 2);
- mirf_CE_lo;
- mirf_CSN_lo; // Pull down chip select
- SPI.transfer(FLUSH_RX); // Write cmd to flush rx fifo
- mirf_CSN_hi; // Pull up chip select
- mirf_CE_hi; // Start listening
- Serial.print("Channel = ");
- Serial.print(rfchannel, DEC);
- int delaytime = 0;
- int rpdcount = 0;
- while (delaytime < 32000) {
- delaytime++;
- if (rpd_status() == 1) {
- rpdcount++;
- }
- }
- Serial.print(" RPD = ");
- Serial.println(rpdcount, DEC);
- rfchannel++;
- if (rfchannel >= 125) {
- rfchannel = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement