Added carrier detect and auto-ack disable, and an example to use it
This commit is contained in:
parent
f3369a552c
commit
bee284f9c5
19
RF24.cpp
19
RF24.cpp
|
@ -331,7 +331,7 @@ void RF24::startListening(void)
|
||||||
ce(HIGH);
|
ce(HIGH);
|
||||||
|
|
||||||
// wait for the radio to come up (130us actually only needed)
|
// wait for the radio to come up (130us actually only needed)
|
||||||
delay(1);
|
delayMicroseconds(130);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
@ -591,5 +591,22 @@ boolean RF24::isAckPayloadAvailable(void)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************/
|
||||||
|
|
||||||
|
void RF24::setAutoAck(bool enable)
|
||||||
|
{
|
||||||
|
if ( enable )
|
||||||
|
write_register(EN_AA, B111111);
|
||||||
|
else
|
||||||
|
write_register(EN_AA, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************/
|
||||||
|
|
||||||
|
boolean RF24::testCarrier(void)
|
||||||
|
{
|
||||||
|
return ( read_register(CD) & 1 );
|
||||||
|
}
|
||||||
|
|
||||||
// vim:ai:cin:sts=2 sw=2 ft=cpp
|
// vim:ai:cin:sts=2 sw=2 ft=cpp
|
||||||
|
|
||||||
|
|
21
RF24.h
21
RF24.h
|
@ -399,6 +399,27 @@ public:
|
||||||
* @return True if an ack payload is available.
|
* @return True if an ack payload is available.
|
||||||
*/
|
*/
|
||||||
boolean isAckPayloadAvailable(void);
|
boolean isAckPayloadAvailable(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable or disable auto-acknowlede packets
|
||||||
|
*
|
||||||
|
* This is enabled by default, so it's only needed if you want to turn
|
||||||
|
* it off for some reason.
|
||||||
|
*
|
||||||
|
* @param enable Whether to enable (true) or disable (false) auto-acks
|
||||||
|
*/
|
||||||
|
void setAutoAck(bool enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether there was a carrier on the line for the
|
||||||
|
* previous listening period.
|
||||||
|
*
|
||||||
|
* Useful to check for interference on the current channel.
|
||||||
|
*
|
||||||
|
* @return true if was carrier, false if not
|
||||||
|
*/
|
||||||
|
|
||||||
|
boolean testCarrier(void);
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,305 @@
|
||||||
|
# Arduino Makefile
|
||||||
|
# Arduino adaptation by mellis, eighthave, oli.keller
|
||||||
|
# Modified by Kerry Wong to support NetBeans
|
||||||
|
# Modified by Rob Gray (Graynomad) for use with Windows and no IDE
|
||||||
|
# This works in my environment and I use it to program two different
|
||||||
|
# 328-based boards and a Mega2560. It's not necessarily robust and
|
||||||
|
# I may have broken something in the original file that I don't use.
|
||||||
|
#
|
||||||
|
# This makefile allows you to build sketches from the command line
|
||||||
|
# without the Arduino environment.
|
||||||
|
#
|
||||||
|
# Instructions for using the makefile:
|
||||||
|
#
|
||||||
|
# 1. Copy this file into the folder with your sketch. The project code file
|
||||||
|
# should have a .c extension however the file gets copied to a .cpp before
|
||||||
|
# compilation so you still write in C++.
|
||||||
|
#
|
||||||
|
# 2. Modify the lines between the double ### rows to set the paths
|
||||||
|
# comm ports etc for your system. EG. c:/progra~1/arduino/arduino-00
|
||||||
|
# for the Arduino IDE, Note the use of short folder name, don't use
|
||||||
|
# "Program files" because spaces will break the build.
|
||||||
|
#
|
||||||
|
# Set the line containing "MCU" to match your board's processor.
|
||||||
|
# Typically ATmega328 or ATmega2560. If you're using a LilyPad Arduino,
|
||||||
|
# change F_CPU to 8000000.
|
||||||
|
#
|
||||||
|
# 3. At the command line, change to the directory containing your
|
||||||
|
# program's file and the makefile.
|
||||||
|
#
|
||||||
|
# 4. Type "make" and press enter to compile/verify your program.
|
||||||
|
# The default make target will also perform the uplode using avrdude.
|
||||||
|
#
|
||||||
|
# The first time this is done all required libraries will be built
|
||||||
|
# and a core.a file will be created in the output folder.
|
||||||
|
#
|
||||||
|
# NOTES:
|
||||||
|
# All output goes into a folder called "output" underneath the working folder.
|
||||||
|
# The default all: target creates symbol (.sym) and expanded assembly
|
||||||
|
# (.lss) files and uploads the program.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
##########################################################
|
||||||
|
##########################################################
|
||||||
|
# Select processor here
|
||||||
|
MCU = atmega328p
|
||||||
|
#MCU = atmega2560
|
||||||
|
|
||||||
|
ifeq ($(MCU),atmega2560)
|
||||||
|
UPLOAD_RATE = 115200
|
||||||
|
AVRDUDE_PROTOCOL = stk500v2
|
||||||
|
COM = 39
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(MCU),atmega328p)
|
||||||
|
UPLOAD_RATE = 57600
|
||||||
|
AVRDUDE_PROTOCOL = stk500v1
|
||||||
|
COM = 33
|
||||||
|
endif
|
||||||
|
|
||||||
|
UNAME := $(shell uname)
|
||||||
|
|
||||||
|
ifeq ($(UNAME),Darwin)
|
||||||
|
ARDUINO_VERSION = 21
|
||||||
|
ARDUINO_DIR = /opt/arduino-00$(ARDUINO_VERSION)
|
||||||
|
AVR_TOOLS_PATH = $(ARDUINO_DIR)/hardware/tools/avr/bin
|
||||||
|
AVRDUDECONFIG_PATH = $(ARDUINO_DIR)/hardware/tools/avr/etc
|
||||||
|
PORT = /dev/tty.usbserial-A600eHIs
|
||||||
|
PORT2 = /dev/tty.usbserial-A9007LmI
|
||||||
|
PORT3 = /dev/tty.usbserial-A40081RP
|
||||||
|
else
|
||||||
|
ARDUINO_VERSION = 22
|
||||||
|
ARDUINO_DIR = /opt/arduino-00$(ARDUINO_VERSION)
|
||||||
|
AVR_TOOLS_PATH = /usr/bin
|
||||||
|
AVRDUDECONFIG_PATH = $(ARDUINO_DIR)/hardware/tools
|
||||||
|
PORT = /dev/ttyUSB0
|
||||||
|
PORT2 = /dev/ttyUSB1
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Temporary testing of github Arduino environment
|
||||||
|
OLD_DIR = /opt/arduino-00$(ARDUINO_VERSION)
|
||||||
|
AVR_TOOLS_PATH = $(OLD_DIR)/hardware/tools/avr/bin
|
||||||
|
AVRDUDECONFIG_PATH = $(OLD_DIR)/hardware/tools/avr/etc
|
||||||
|
ARDUINO_DIR = /opt/Arduino
|
||||||
|
|
||||||
|
PROJECT_NAME = $(notdir $(PWD))
|
||||||
|
PROJECT_DIR = .
|
||||||
|
ARDUINO_CORE = $(ARDUINO_DIR)/hardware/arduino/cores/arduino
|
||||||
|
ARDUINO_AVR = $(ARDUINO_DIR)/hardware/tools/avr/avr/include/avr
|
||||||
|
ARDUINO_LIB = $(ARDUINO_DIR)/libraries
|
||||||
|
F_CPU = 16000000
|
||||||
|
|
||||||
|
##########################################################
|
||||||
|
##########################################################
|
||||||
|
|
||||||
|
# Note that if your program has dependencies other than those
|
||||||
|
# already listed below, you will need to add them accordingly.
|
||||||
|
C_MODULES = \
|
||||||
|
$(ARDUINO_CORE)/wiring_pulse.c \
|
||||||
|
$(ARDUINO_CORE)/wiring_analog.c \
|
||||||
|
$(ARDUINO_CORE)/pins_arduino.c \
|
||||||
|
$(ARDUINO_CORE)/wiring.c \
|
||||||
|
$(ARDUINO_CORE)/wiring_digital.c \
|
||||||
|
$(ARDUINO_CORE)/WInterrupts.c \
|
||||||
|
$(ARDUINO_CORE)/wiring_shift.c \
|
||||||
|
|
||||||
|
CXX_MODULES = \
|
||||||
|
$(ARDUINO_CORE)/Tone.cpp \
|
||||||
|
$(ARDUINO_CORE)/main.cpp \
|
||||||
|
$(ARDUINO_CORE)/WMath.cpp \
|
||||||
|
$(ARDUINO_CORE)/Print.cpp \
|
||||||
|
$(ARDUINO_CORE)/HardwareSerial.cpp \
|
||||||
|
$(ARDUINO_LIB)/SPI/SPI.cpp \
|
||||||
|
$(ARDUINO_LIB)/EEPROM/EEPROM.cpp \
|
||||||
|
../../RF24.cpp
|
||||||
|
|
||||||
|
CXX_APP = output/$(PROJECT_NAME).cpp
|
||||||
|
MODULES = $(C_MODULES) $(CXX_MODULES)
|
||||||
|
SRC = $(C_MODULES)
|
||||||
|
CXXSRC = $(CXX_MODULES) $(CXX_APP)
|
||||||
|
FORMAT = ihex
|
||||||
|
|
||||||
|
# Name of this Makefile (used for "make depend").
|
||||||
|
MAKEFILE = Makefile
|
||||||
|
|
||||||
|
# Debugging format.
|
||||||
|
# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
|
||||||
|
# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
|
||||||
|
#DEBUG = stabs
|
||||||
|
DEBUG =
|
||||||
|
|
||||||
|
OPT = s
|
||||||
|
|
||||||
|
# Place -D or -U options here
|
||||||
|
CDEFS = -DF_CPU=$(F_CPU)L -DARDUINO=$(ARDUINO_VERSION)
|
||||||
|
CXXDEFS = -DF_CPU=$(F_CPU)L -DARDUINO=$(ARDUINO_VERSION)
|
||||||
|
|
||||||
|
# Place -I options here
|
||||||
|
CINCS = -I$(ARDUINO_LIB)/EEPROM -I$(ARDUINO_CORE) -I$(ARDUINO_LIB) -I$(PROJECT_DIR) -I$(ARDUINO_AVR) -I$(ARDUINO_LIB)/SPI -I../..
|
||||||
|
|
||||||
|
CXXINCS = -I$(ARDUINO_CORE) -I$(ARDUINO_LIB)
|
||||||
|
|
||||||
|
# Compiler flag to set the C Standard level.
|
||||||
|
# c89 - "ANSI" C
|
||||||
|
# gnu89 - c89 plus GCC extensions
|
||||||
|
# c99 - ISO C99 standard (not yet fully implemented)
|
||||||
|
# gnu99 - c99 plus GCC extensions
|
||||||
|
#CSTANDARD = -std=gnu99
|
||||||
|
CDEBUG = -g$(DEBUG)
|
||||||
|
#CWARN = -Wall -Wstrict-prototypes
|
||||||
|
CWARN = -Wall # show all warnings
|
||||||
|
#CWARN = -w # suppress all warnings
|
||||||
|
CMAP = -Wl,-Map,output.map
|
||||||
|
####CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
|
||||||
|
CTUNING = -ffunction-sections -fdata-sections
|
||||||
|
CXXTUNING = -fno-exceptions -ffunction-sections -fdata-sections
|
||||||
|
#CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
|
||||||
|
MMCU = -mmcu=$(MCU)
|
||||||
|
|
||||||
|
CFLAGS = $(CDEBUG) -O$(OPT) $(CMAP) $(CWARN) $(CTUNING) $(MMCU) $(CDEFS) $(CINCS) $(CSTANDARD) $(CEXTRA)
|
||||||
|
CXXFLAGS = $(CDEBUG) -O$(OPT) $(CWARN) $(CXXTUNING) $(CDEFS) $(CINCS)
|
||||||
|
#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
|
||||||
|
LDFLAGS = -O$(OPT) -lm -Wl,--gc-sections
|
||||||
|
#LDFLAGS = -O$(OPT) -lm -Wl,-Map,output/$(PROJECT_NAME).map
|
||||||
|
|
||||||
|
# Programming support using avrdude. Settings and variables.
|
||||||
|
AVRDUDE_PORT = $(PORT)
|
||||||
|
AVRDUDE_WRITE_FLASH = -U flash:w:output/$(PROJECT_NAME).hex:i
|
||||||
|
|
||||||
|
AVRDUDE_FLAGS = -V -F -D -C $(AVRDUDECONFIG_PATH)/avrdude.conf \
|
||||||
|
-p $(MCU) -c $(AVRDUDE_PROTOCOL) -b $(UPLOAD_RATE)
|
||||||
|
|
||||||
|
# Program settings
|
||||||
|
CC = $(AVR_TOOLS_PATH)/avr-gcc
|
||||||
|
CXX = $(AVR_TOOLS_PATH)/avr-g++
|
||||||
|
LD = $(AVR_TOOLS_PATH)/avr-gcc
|
||||||
|
OBJCOPY = $(AVR_TOOLS_PATH)/avr-objcopy
|
||||||
|
OBJDUMP = $(AVR_TOOLS_PATH)/avr-objdump
|
||||||
|
AR = $(AVR_TOOLS_PATH)/avr-ar
|
||||||
|
SIZE = $(AVR_TOOLS_PATH)/avr-size
|
||||||
|
NM = $(AVR_TOOLS_PATH)/avr-nm
|
||||||
|
AVRDUDE = $(AVR_TOOLS_PATH)/avrdude
|
||||||
|
REMOVE = rm -f
|
||||||
|
MV = mv -f
|
||||||
|
|
||||||
|
# Define all object files.
|
||||||
|
OBJ = $(SRC:.c=.o) $(CXXSRC:.cpp=.o) $(ASRC:.S=.o)
|
||||||
|
OBJ_MODULES = $(C_MODULES:.c=.o) $(CXX_MODULES:.cpp=.o)
|
||||||
|
|
||||||
|
# Define all listing files.
|
||||||
|
LST = $(ASRC:.S=.lst) $(CXXSRC:.cpp=.lst) $(SRC:.c=.lst)
|
||||||
|
|
||||||
|
# Combine all necessary flags and optional flags.
|
||||||
|
# Add target processor to flags.
|
||||||
|
ALL_CFLAGS = $(CFLAGS) -mmcu=$(MCU)
|
||||||
|
ALL_CXXFLAGS = $(CXXFLAGS) -mmcu=$(MCU)
|
||||||
|
ALL_ASFLAGS = -x assembler-with-cpp $(ASFLAGS) -mmcu=$(MCU)
|
||||||
|
ALL_LDFLAGS = $(LDFLAGS) -mmcu=$(MCU)
|
||||||
|
|
||||||
|
# Default target.
|
||||||
|
# This is th etarget that gets executed with a make command
|
||||||
|
# that has no parameters, ie "make".
|
||||||
|
all: applet_files build sym lss size upload
|
||||||
|
|
||||||
|
build: elf hex
|
||||||
|
|
||||||
|
output/$(PROJECT_NAME).cpp: $(PROJECT_NAME).pde
|
||||||
|
test -d output || mkdir output
|
||||||
|
echo "#include <WProgram.h>" > $@
|
||||||
|
echo "#line 1 \"$<\"" >> $@
|
||||||
|
cat $< >> $@
|
||||||
|
|
||||||
|
elf: output/$(PROJECT_NAME).elf
|
||||||
|
hex: output/$(PROJECT_NAME).hex
|
||||||
|
eep: output/$(PROJECT_NAME).eep
|
||||||
|
lss: output/$(PROJECT_NAME).lss
|
||||||
|
#sym: output/$(PROJECT_NAME).sym
|
||||||
|
|
||||||
|
# Upload HEX file to Arduino
|
||||||
|
upload: upload1 upload2
|
||||||
|
|
||||||
|
upload1: output/$(PROJECT_NAME).hex
|
||||||
|
$(AVRDUDE) $(AVRDUDE_FLAGS) -P $(PORT) $(AVRDUDE_WRITE_FLASH)
|
||||||
|
|
||||||
|
upload2: output/$(PROJECT_NAME).hex
|
||||||
|
$(AVRDUDE) $(AVRDUDE_FLAGS) -P $(PORT2) $(AVRDUDE_WRITE_FLASH)
|
||||||
|
|
||||||
|
upload3: output/$(PROJECT_NAME).hex
|
||||||
|
$(AVRDUDE) $(AVRDUDE_FLAGS) -P $(PORT3) $(AVRDUDE_WRITE_FLASH)
|
||||||
|
|
||||||
|
sym:
|
||||||
|
$(NM) -n -C --format=posix output/$(PROJECT_NAME).elf > output/$(PROJECT_NAME).sym
|
||||||
|
|
||||||
|
# Display size of file.
|
||||||
|
size:
|
||||||
|
$(SIZE) output/$(PROJECT_NAME).elf
|
||||||
|
|
||||||
|
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
|
||||||
|
COFFCONVERT=$(OBJCOPY) --debugging \
|
||||||
|
--change-section-address .data-0x800000 \
|
||||||
|
--change-section-address .bss-0x800000 \
|
||||||
|
--change-section-address .noinit-0x800000 \
|
||||||
|
--change-section-address .eeprom-0x810000
|
||||||
|
|
||||||
|
coff: output/$(PROJECT_NAME).elf
|
||||||
|
$(COFFCONVERT) -O coff-avr output/$(PROJECT_NAME).elf $(PROJECT_NAME).cof
|
||||||
|
|
||||||
|
extcoff: $(PROJECT_NAME).elf
|
||||||
|
$(COFFCONVERT) -O coff-ext-avr output/$(PROJECT_NAME).elf $(PROJECT_NAME).cof
|
||||||
|
|
||||||
|
.SUFFIXES: .elf .hex .eep .lss .sym
|
||||||
|
|
||||||
|
.elf.hex:
|
||||||
|
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
|
||||||
|
|
||||||
|
.elf.eep:
|
||||||
|
$(OBJCOPY) -O $(FORMAT) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
||||||
|
--no-change-warnings \
|
||||||
|
--change-section-lma .eeprom=0 $< $@
|
||||||
|
|
||||||
|
# Create extended listing file from ELF output file.
|
||||||
|
.elf.lss:
|
||||||
|
$(OBJDUMP) -h -S $< > $@
|
||||||
|
|
||||||
|
# Link: create ELF output file from library.
|
||||||
|
#output/$(PROJECT_NAME).elf: $(PROJECT_NAME).c output/core.a
|
||||||
|
output/$(PROJECT_NAME).elf: output/$(PROJECT_NAME).o output/core.a
|
||||||
|
$(LD) $(ALL_LDFLAGS) -o $@ output/$(PROJECT_NAME).o output/core.a
|
||||||
|
|
||||||
|
output/core.a: $(OBJ_MODULES)
|
||||||
|
@for i in $(OBJ_MODULES); do echo $(AR) rcs output/core.a $$i; $(AR) rcs output/core.a $$i; done
|
||||||
|
|
||||||
|
# Compile: create object files from C++ source files.
|
||||||
|
.cpp.o:
|
||||||
|
$(CXX) -c $(ALL_CXXFLAGS) $< -o $@
|
||||||
|
|
||||||
|
# Compile: create object files from C source files.
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
# Compile: create assembler files from C source files.
|
||||||
|
.c.s:
|
||||||
|
$(CC) -S $(ALL_CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
# Assemble: create object files from assembler source files.
|
||||||
|
.S.o:
|
||||||
|
$(CC) -c $(ALL_ASFLAGS) $< -o $@
|
||||||
|
|
||||||
|
# Automatic dependencies
|
||||||
|
%.d: %.c
|
||||||
|
$(CC) -M $(ALL_CFLAGS) $< | sed "s;$(notdir $*).o:;$*.o $*.d:;" > $@
|
||||||
|
|
||||||
|
%.d: %.cpp
|
||||||
|
$(CXX) -M $(ALL_CXXFLAGS) $< | sed "s;$(notdir $*).o:;$*.o $*.d:;" > $@
|
||||||
|
|
||||||
|
# Target: clean project.
|
||||||
|
clean:
|
||||||
|
$(REMOVE) output/$(PROJECT_NAME).hex output/$(PROJECT_NAME).eep output/$(PROJECT_NAME).cof output/$(PROJECT_NAME).elf \
|
||||||
|
output/$(PROJECT_NAME).map output/$(PROJECT_NAME).sym output/$(PROJECT_NAME).lss output/core.a \
|
||||||
|
$(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d)
|
||||||
|
|
||||||
|
#.PHONY: all build elf hex eep lss sym program coff extcoff clean applet_files sizebefore sizeafter
|
||||||
|
.PHONY: all build elf hex eep lss sym program coff extcoff applet_files sizebefore sizeafter
|
||||||
|
|
||||||
|
#include $(SRC:.c=.d)
|
||||||
|
#include $(CXXSRC:.cpp=.d)
|
Binary file not shown.
|
@ -0,0 +1,128 @@
|
||||||
|
#include <WProgram.h>
|
||||||
|
#line 1 "scanner.pde"
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
version 2 as published by the Free Software Foundation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Channel scanner
|
||||||
|
*
|
||||||
|
* Example to detect interference on the various channels available.
|
||||||
|
* This is a good diagnostic tool to check whether you're picking a
|
||||||
|
* good channel for your application.
|
||||||
|
*
|
||||||
|
* Inspired by cpixip.
|
||||||
|
* See http://arduino.cc/forum/index.php/topic,54795.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <SPI.h>
|
||||||
|
#include "nRF24L01.h"
|
||||||
|
#include "RF24.h"
|
||||||
|
#include "printf.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hardware configuration
|
||||||
|
//
|
||||||
|
|
||||||
|
// Set up nRF24L01 radio on SPI bus plus pins 8 & 9
|
||||||
|
|
||||||
|
RF24 radio(8,9);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Channel info
|
||||||
|
//
|
||||||
|
|
||||||
|
const short num_channels = 128;
|
||||||
|
short values[num_channels];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setup
|
||||||
|
//
|
||||||
|
|
||||||
|
void setup(void)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Print preamble
|
||||||
|
//
|
||||||
|
|
||||||
|
Serial.begin(57600);
|
||||||
|
printf_begin();
|
||||||
|
printf("\n\rRF24/examples/scanner/\n\r");
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setup and configure rf radio
|
||||||
|
//
|
||||||
|
|
||||||
|
radio.begin();
|
||||||
|
radio.setAutoAck(false);
|
||||||
|
|
||||||
|
// Get into standby mode
|
||||||
|
radio.startListening();
|
||||||
|
radio.stopListening();
|
||||||
|
|
||||||
|
// Print out header, high then low digit
|
||||||
|
int i = 0;
|
||||||
|
while ( i < num_channels )
|
||||||
|
{
|
||||||
|
printf("%x",i>>4);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
printf("\n\r");
|
||||||
|
i = 0;
|
||||||
|
while ( i < num_channels )
|
||||||
|
{
|
||||||
|
printf("%x",i&0xf);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
printf("\n\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Loop
|
||||||
|
//
|
||||||
|
|
||||||
|
const short num_reps = 100;
|
||||||
|
|
||||||
|
void loop(void)
|
||||||
|
{
|
||||||
|
// Clear measurement values
|
||||||
|
memset(values,0,num_channels);
|
||||||
|
|
||||||
|
// Scan all channels num_reps times
|
||||||
|
int rep_counter = num_reps;
|
||||||
|
while (rep_counter--)
|
||||||
|
{
|
||||||
|
int i = num_channels;
|
||||||
|
while (i--)
|
||||||
|
{
|
||||||
|
// Select this channel
|
||||||
|
radio.setChannel(i);
|
||||||
|
|
||||||
|
// Listen for a little
|
||||||
|
radio.startListening();
|
||||||
|
delayMicroseconds(128);
|
||||||
|
radio.stopListening();
|
||||||
|
|
||||||
|
// Did we get a carrier?
|
||||||
|
if ( radio.testCarrier() )
|
||||||
|
++values[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print out channel measurements, clamped to a single hex digit
|
||||||
|
int i = 0;
|
||||||
|
while ( i < num_channels )
|
||||||
|
{
|
||||||
|
printf("%x",min(0xf,values[i]&0xf));
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
printf("\n\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// vim:ai:cin:sts=2 sw=2 ft=cpp
|
Binary file not shown.
|
@ -0,0 +1,325 @@
|
||||||
|
:100000000C9463000C948B000C948B000C948B006C
|
||||||
|
:100010000C948B000C948B000C948B000C948B0034
|
||||||
|
:100020000C948B000C948B000C948B000C948B0024
|
||||||
|
:100030000C948B000C948B000C948B000C948B0014
|
||||||
|
:100040000C948F050C948B000C9423060C948B005D
|
||||||
|
:100050000C948B000C948B000C948B000C948B00F4
|
||||||
|
:100060000C948B000C948B000000000024002700EF
|
||||||
|
:100070002A0000000000250028002B0000000000DE
|
||||||
|
:1000800023002600290004040404040404040202DA
|
||||||
|
:100090000202020203030303030301020408102007
|
||||||
|
:1000A0004080010204081020010204081020000012
|
||||||
|
:1000B0000007000201000003040600000000000029
|
||||||
|
:1000C000000090043B0711241FBECFEFD8E0DEBF35
|
||||||
|
:1000D000CDBF11E0A0E0B1E0E6EFF3E102C0059092
|
||||||
|
:1000E0000D92AA33B107D9F712E0AAE3B1E001C03B
|
||||||
|
:1000F0001D92A13FB107E1F710E0C6ECD0E004C0CB
|
||||||
|
:100100002297FE010E94F509C23CD107C9F70E945F
|
||||||
|
:100110001C060C94F9090C9400000F931F93CF93C5
|
||||||
|
:10012000DF938C01EB01009731F46115710519F42F
|
||||||
|
:1001300020E030E038C081E090E06EE070E00E94A6
|
||||||
|
:10014000CB02FC019C01009771F180E8838320972A
|
||||||
|
:1001500071F0D387C28781E883838091E702909111
|
||||||
|
:10016000E802892B21F4F093E802E093E7020115FD
|
||||||
|
:100170001105C9F011870087838182608383809194
|
||||||
|
:10018000E9029091EA02892B71F4F093EA02E0937C
|
||||||
|
:10019000E9028091EB029091EC02892B21F4F0931B
|
||||||
|
:1001A000EC02E093EB02C901DF91CF911F910F9117
|
||||||
|
:1001B0000895A0E0B0E0EFEDF0E00C94CC09FE0172
|
||||||
|
:1001C0003596619171918091E9029091EA02AF01B7
|
||||||
|
:1001D0000E94EE002096E2E00C94E809ABE0B0E06B
|
||||||
|
:1001E000E4EFF0E00C94BC093C012B015A01FC0146
|
||||||
|
:1001F00017821682838181FD03C06FEF7FEFC6C136
|
||||||
|
:100200009AE0892E1E010894211C311CF3012381E0
|
||||||
|
:10021000F20123FD859123FF81912F01882309F4A9
|
||||||
|
:10022000B2C1853239F423FD859123FF81912F01DD
|
||||||
|
:10023000853229F490E0B3010E940604E7CF982F9D
|
||||||
|
:10024000FF24EE249924FFE1FF15D0F09B3269F0E2
|
||||||
|
:100250009C3228F4903259F0933291F40EC09D32C2
|
||||||
|
:1002600049F0903369F441E024C052E0F52A84E07B
|
||||||
|
:10027000F82A28C098E0F92A25C0E0E1FE2A22C029
|
||||||
|
:10028000F7FC29C0892F80538A3070F4F6FE05C030
|
||||||
|
:10029000989C902C1124980E15C0E89CE02C1124F9
|
||||||
|
:1002A000E80EF0E2FF2A0EC09E3229F4F6FC6BC184
|
||||||
|
:1002B00040E4F42A07C09C3619F450E8F52A02C03D
|
||||||
|
:1002C000983649F4F20123FD959123FF91912F0176
|
||||||
|
:1002D000992309F0B8CF892F8554833018F08052C4
|
||||||
|
:1002E000833038F444E050E0A40EB51E5FE3598338
|
||||||
|
:1002F0000FC0933631F0933779F0933509F056C03B
|
||||||
|
:1003000020C0F5018081898342E050E0A40EB51E33
|
||||||
|
:10031000610101E010E012C0F501C080D180F6FC5F
|
||||||
|
:1003200003C06FEF7FEF02C0692D70E042E050E044
|
||||||
|
:10033000A40EB51EC6010E94FB038C015FE7F522E7
|
||||||
|
:1003400014C0F501C080D180F6FC03C06FEF7FEFD1
|
||||||
|
:1003500002C0692D70E042E050E0A40EB51EC60157
|
||||||
|
:100360000E94E9038C0150E8F52AF3FE07C01AC089
|
||||||
|
:1003700080E290E0B3010E940604EA948E2D90E0A2
|
||||||
|
:1003800008171907A8F30EC0F601F7FC8591F7FED0
|
||||||
|
:1003900081916F0190E0B3010E940604E110EA949C
|
||||||
|
:1003A000015010400115110579F7EAC0943611F09B
|
||||||
|
:1003B000993669F5F7FE08C0F50120813181428147
|
||||||
|
:1003C000538184E090E00AC0F501808191819C0115
|
||||||
|
:1003D000442737FD4095542F82E090E0A80EB91EC7
|
||||||
|
:1003E0009FE6F92257FF09C0509540953095219519
|
||||||
|
:1003F0003F4F4F4F5F4FE0E8FE2ACA01B901A1010C
|
||||||
|
:100400002AE030E00E943204D82ED21840C095373E
|
||||||
|
:1004100029F41F2D1F7E2AE030E01DC01F2D197FFB
|
||||||
|
:100420009F3661F0903720F4983509F0ACC00FC0CA
|
||||||
|
:10043000903739F0983709F0A6C004C028E030E0C2
|
||||||
|
:100440000AC0106114FD146020E130E004C014FD06
|
||||||
|
:10045000166020E132E017FF08C0F501608171816C
|
||||||
|
:100460008281938144E050E008C0F5018081918150
|
||||||
|
:10047000BC0180E090E042E050E0A40EB51EA10176
|
||||||
|
:100480000E943204D82ED2188FE7F82EF122F6FE01
|
||||||
|
:100490000BC05EEFF522D91438F4F4FE07C0F2FC6D
|
||||||
|
:1004A00005C08FEEF82202C01D2D01C0192DF4FEEB
|
||||||
|
:1004B0000DC0FE01ED0DF11D8081803319F499EE20
|
||||||
|
:1004C000F92208C01F5FF2FE05C003C08F2D867899
|
||||||
|
:1004D00009F01F5F0F2DF3FC14C0F0FE0FC01E15B6
|
||||||
|
:1004E00010F09D2C0BC09D2C9E0C911A1E2D06C049
|
||||||
|
:1004F00080E290E0B3010E9406041F5F1E15C0F366
|
||||||
|
:1005000004C01E1510F4E11A01C0EE2404FF0FC050
|
||||||
|
:1005100080E390E0B3010E94060402FF1DC001FDCC
|
||||||
|
:1005200003C088E790E00EC088E590E00BC0802F04
|
||||||
|
:10053000867891F001FF02C08BE201C080E2F7FCF7
|
||||||
|
:100540008DE290E0B3010E94060406C080E390E0D3
|
||||||
|
:10055000B3010E9406049A94D914C0F3DA94F1010D
|
||||||
|
:10056000ED0DF11D808190E0B3010E940604DD20B5
|
||||||
|
:10057000A9F706C080E290E0B3010E940604EA9465
|
||||||
|
:10058000EE20C1F743CEF30166817781CB012B9634
|
||||||
|
:10059000E2E10C94D8090F931F93CF93DF93689FE8
|
||||||
|
:1005A0008001699F100D789F100D1124C8010E94D1
|
||||||
|
:1005B000E702EC01009729F060E070E0A8010E94DA
|
||||||
|
:1005C000F403CE01DF91CF911F910F910895CF9346
|
||||||
|
:1005D000DF93BC018230910510F462E070E0A091DD
|
||||||
|
:1005E000EF02B091F002ED01E0E0F0E040E050E019
|
||||||
|
:1005F00021C0888199818617970769F48A819B8138
|
||||||
|
:10060000309719F09383828304C09093F002809313
|
||||||
|
:10061000EF02FE0134C06817790738F4411551051F
|
||||||
|
:1006200019F08417950708F4AC01FE018A819B81BB
|
||||||
|
:100630009C01E9012097E9F641155105A9F1CA018C
|
||||||
|
:10064000861B970B049708F4BA01E0E0F0E02AC09B
|
||||||
|
:100650008D919C91119784179507F9F4641775078C
|
||||||
|
:1006600081F412968D919C911397309719F0938392
|
||||||
|
:10067000828304C09093F0028093EF02FD013296D2
|
||||||
|
:100680004CC0CA01861B970BFD01E80FF91F61934F
|
||||||
|
:10069000719302978D939C9340C0FD018281938159
|
||||||
|
:1006A0009C01D9011097A1F68091ED029091EE0284
|
||||||
|
:1006B000892B41F480912301909124019093EE02C3
|
||||||
|
:1006C0008093ED024091250150912601411551057D
|
||||||
|
:1006D00041F44DB75EB78091210190912201481BF2
|
||||||
|
:1006E000590B2091ED023091EE02CA01821B930B4F
|
||||||
|
:1006F0008617970780F0AB014E5F5F4F8417950711
|
||||||
|
:1007000050F0420F531F5093EE024093ED02F90157
|
||||||
|
:100710006193719302C0E0E0F0E0CF01DF91CF91EF
|
||||||
|
:100720000895CF93DF93009709F450C0EC0122970E
|
||||||
|
:100730001B821A82A091EF02B091F002109709F18A
|
||||||
|
:1007400040E050E0AC17BD0708F1BB83AA83FE016F
|
||||||
|
:1007500021913191E20FF31FAE17BF0779F48D910C
|
||||||
|
:100760009C911197280F391F2E5F3F4F39832883A3
|
||||||
|
:1007700012968D919C9113979B838A834115510505
|
||||||
|
:1007800071F4D093F002C093EF0220C012968D91C5
|
||||||
|
:100790009C911397AD01009711F0DC01D3CFFA01C2
|
||||||
|
:1007A000D383C28321913191E20FF31FCE17DF076C
|
||||||
|
:1007B00069F488819981280F391F2E5F3F4FFA0114
|
||||||
|
:1007C000318320838A819B8193838283DF91CF91C0
|
||||||
|
:1007D0000895FC010590615070400110D8F7809594
|
||||||
|
:1007E00090958E0F9F1F0895DC0101C06D934150BD
|
||||||
|
:1007F0005040E0F70895FC016150704001900110F5
|
||||||
|
:10080000D8F7809590958E0F9F1F08950F931F9393
|
||||||
|
:10081000CF93DF938C01EB018B8181FF1BC082FFA3
|
||||||
|
:100820000DC02E813F818C819D812817390764F48A
|
||||||
|
:10083000E881F9810193F983E88306C0E885F985A9
|
||||||
|
:10084000802F0995892B31F48E819F8101969F839A
|
||||||
|
:100850008E8302C00FEF1FEFC801DF91CF911F9170
|
||||||
|
:100860000F910895FA01AA27283051F1203181F122
|
||||||
|
:10087000E8946F936E7F6E5F7F4F8F4F9F4FAF4FA8
|
||||||
|
:10088000B1E03ED0B4E03CD0670F781F891F9A1FBB
|
||||||
|
:10089000A11D680F791F8A1F911DA11D6A0F711D6F
|
||||||
|
:1008A000811D911DA11D20D009F468943F912AE07B
|
||||||
|
:1008B000269F11243019305D3193DEF6CF01089563
|
||||||
|
:1008C000462F4770405D4193B3E00FD0C9F7F6CF94
|
||||||
|
:1008D000462F4F70405D4A3318F0495D31FD40525C
|
||||||
|
:1008E000419302D0A9F7EACFB4E0A69597958795F2
|
||||||
|
:1008F00077956795BA95C9F70097610571050895D1
|
||||||
|
:100900009B01AC010A2E069457954795379527957C
|
||||||
|
:10091000BA95C9F7620F731F841F951FA01D089514
|
||||||
|
:100920008AE391E068E049E00E9475070895FF922C
|
||||||
|
:100930000F931F93CF93DF9380E8E7E4F1E0DF01AB
|
||||||
|
:100940001D928A95E9F704E610E021C08AE391E060
|
||||||
|
:100950006F2D0E94F2078AE391E00E94840880E8EC
|
||||||
|
:1009600090E00E94D7058AE391E00E947C078AE329
|
||||||
|
:1009700091E00E944608882329F088819981019698
|
||||||
|
:10098000998388832297FA94BFEFFB16F9F60150FA
|
||||||
|
:100990001040EFEF0F3F1E0729F0C5E4D2E08FE7CC
|
||||||
|
:1009A000F82ED4CFC7E4D1E000E011E000D000D0B1
|
||||||
|
:1009B000ADB7BEB712961C930E931197899199917A
|
||||||
|
:1009C0008F70907014969C938E9313970E94D90009
|
||||||
|
:1009D0000F900F900F900F90B2E0C734DB0731F704
|
||||||
|
:1009E00000D083E091E0EDB7FEB7928381830E944F
|
||||||
|
:1009F000D9000F900F90DF91CF911F910F91FF9031
|
||||||
|
:100A0000089580E895E060E070E00E948D00089510
|
||||||
|
:100A10000F931F93CF93DF9384ED92E040E051EE6C
|
||||||
|
:100A200060E070E00E9454060E94010500D086E05C
|
||||||
|
:100A300091E0EDB7FEB7928381830E94D9000F90B9
|
||||||
|
:100A40000F908AE391E00E944B088AE391E060E016
|
||||||
|
:100A50000E94E8078AE391E00E9484088AE391E01B
|
||||||
|
:100A60000E947C07C0E0D0E000E011E000D000D0A0
|
||||||
|
:100A7000EDB7FEB712830183CE0124E095958795EB
|
||||||
|
:100A80002A95E1F7948383830E94D90021960F90E1
|
||||||
|
:100A90000F900F900F90C038D10541F700D083E040
|
||||||
|
:100AA00091E0EDB7FEB7928381830E94D900C0E048
|
||||||
|
:100AB000D0E00F900F9000D000D0EDB7FEB70183CB
|
||||||
|
:100AC0001283CE018F709070948383830E94D9002B
|
||||||
|
:100AD00021960F900F900F900F90C038D10559F7C5
|
||||||
|
:100AE00000D083E091E0EDB7FEB7928381830E944E
|
||||||
|
:100AF000D9000F900F90DF91CF911F910F91089522
|
||||||
|
:100B00000F931F93082F84ED92E0602F0E94280717
|
||||||
|
:100B1000112707FD1095C8011F910F9108951F928D
|
||||||
|
:100B20000F920FB60F9211242F933F938F939F93A1
|
||||||
|
:100B3000AF93BF9380914B0290914C02A0914D02D4
|
||||||
|
:100B4000B0914E0230914F020196A11DB11D232F8D
|
||||||
|
:100B50002D5F2D3720F02D570196A11DB11D20933B
|
||||||
|
:100B60004F0280934B0290934C02A0934D02B0939E
|
||||||
|
:100B70004E028091470290914802A0914902B091A3
|
||||||
|
:100B80004A020196A11DB11D80934702909348022D
|
||||||
|
:100B9000A0934902B0934A02BF91AF919F918F9168
|
||||||
|
:100BA0003F912F910F900FBE0F901F9018950197B6
|
||||||
|
:100BB00039F0880F991F880F991F02970197F1F755
|
||||||
|
:100BC0000895789484B5826084BD84B5816084BDC5
|
||||||
|
:100BD00085B5826085BD85B5816085BDEEE6F0E0B6
|
||||||
|
:100BE000808181608083E1E8F0E010828081826012
|
||||||
|
:100BF0008083808181608083E0E8F0E08081816093
|
||||||
|
:100C00008083E1EBF0E0808184608083E0EBF0E0C2
|
||||||
|
:100C1000808181608083EAE7F0E080818460808366
|
||||||
|
:100C20008081826080838081816080838081806810
|
||||||
|
:100C300080831092C10008950E94E1050E9408057A
|
||||||
|
:100C40000E949704FDCF1F920F920FB60F921124AE
|
||||||
|
:100C50002F933F934F938F939F93EF93FF934091E5
|
||||||
|
:100C6000C600E091D002F091D10231969F012F771A
|
||||||
|
:100C7000307031978091D2029091D30228173907B2
|
||||||
|
:100C800039F0E05BFD4F40833093D1022093D002D6
|
||||||
|
:100C9000FF91EF919F918F914F913F912F910F90E5
|
||||||
|
:100CA0000FBE0F901F901895AF92BF92DF92EF92F8
|
||||||
|
:100CB000FF920F931F93CF93DF93EC017A018B0187
|
||||||
|
:100CC000DD24403081EE580780E0680780E0780737
|
||||||
|
:100CD00011F0DD24D39491E0A92EB12CE885F9859B
|
||||||
|
:100CE000DD2069F0C5010A8802C0880F991F0A94A7
|
||||||
|
:100CF000E2F7808360E079E08DE390E005C0108248
|
||||||
|
:100D000060E874E88EE190E0A80197010E949A09DA
|
||||||
|
:100D10002150304040405040569547953795279593
|
||||||
|
:100D200080E12030380720F0DD2011F0DD24D6CF1F
|
||||||
|
:100D3000EC81FD813083EE81FF812083EA85FB8594
|
||||||
|
:100D4000208141E050E0CA010E8402C0880F991F43
|
||||||
|
:100D50000A94E2F7282B2083EA85FB852081CA01CB
|
||||||
|
:100D60000F8402C0880F991F0A94E2F7282B208372
|
||||||
|
:100D7000EA85FB858081088802C0440F551F0A94CC
|
||||||
|
:100D8000E2F7842B8083DF91CF911F910F91FF9029
|
||||||
|
:100D9000EF90DF90BF90AF900895DC011296ED9137
|
||||||
|
:100DA000FC911397E058FF4F2191319180819181FF
|
||||||
|
:100DB000281B390B2F773070C9010895DC0112967A
|
||||||
|
:100DC000ED91FC911397EE57FF4F20813181929165
|
||||||
|
:100DD0008291E058F0408217930719F42FEF3FEF0C
|
||||||
|
:100DE00005C0E20FF31F8081282F30E0C90108956C
|
||||||
|
:100DF000DC011296ED91FC911397DF01AE57BF4FC6
|
||||||
|
:100E00002D913C911197E058FF4F80819181E058DE
|
||||||
|
:100E1000F0408217930719F42FEF3FEF0BC0E20F5A
|
||||||
|
:100E2000F31F80812F5F3F4F2F7730702D933C93BE
|
||||||
|
:100E3000282F30E0C9010895DC011296ED91FC9154
|
||||||
|
:100E40001397EE57FF4F808191819293829308957B
|
||||||
|
:100E5000FC01A085B18521898C9190E0022E02C011
|
||||||
|
:100E6000959587950A94E2F780FFF6CF0484F5857F
|
||||||
|
:100E7000E02D608308958BE291E09093D5028093FA
|
||||||
|
:100E8000D40280E592E09093D7028093D60285EC5D
|
||||||
|
:100E900090E09093D9028093D80284EC90E09093F4
|
||||||
|
:100EA000DB028093DA0280EC90E09093DD02809385
|
||||||
|
:100EB000DC0281EC90E09093DF028093DE0286EC0E
|
||||||
|
:100EC00090E09093E1028093E00284E08093E2025C
|
||||||
|
:100ED00083E08093E30287E08093E40285E08093DF
|
||||||
|
:100EE000E50281E08093E6020895FC01608341837E
|
||||||
|
:100EF00080E2828313820895FC01808160E00E9479
|
||||||
|
:100F0000CD080895FF920F931F938C01F62E80E079
|
||||||
|
:100F10000E94650985E00E946A09F80181816F2DB0
|
||||||
|
:100F20000E94CD081F910F91FF9008951F93CF93BA
|
||||||
|
:100F3000DF93EC0160E070E00E94820781EE8EBDDD
|
||||||
|
:100F40000DB407FEFDCF1EB5CE0161E070E00E943A
|
||||||
|
:100F50008207812FDF91CF911F9108951F93CF9327
|
||||||
|
:100F6000DF93EC0160E070E00E94820782EE8EBDAC
|
||||||
|
:100F70000DB407FEFDCF1EB5CE0161E070E00E940A
|
||||||
|
:100F80008207812FDF91CF911F9108950F931F93B7
|
||||||
|
:100F9000CF93DF93EC01162F042F60E070E00E94E6
|
||||||
|
:100FA00082071F7110621EBD0DB407FEFDCF1EB576
|
||||||
|
:100FB0000EBD0DB407FEFDCF8EB5CE0161E070E031
|
||||||
|
:100FC0000E948207812FDF91CF911F910F91089589
|
||||||
|
:100FD000662319F061E04FE302C061E040E00E9447
|
||||||
|
:100FE000C6070895462F603808F04FE765E00E9475
|
||||||
|
:100FF000C6070895EF92FF920F931F93CF93DF934D
|
||||||
|
:101000007C01162FEA01022F60E070E00E94820747
|
||||||
|
:101010001F7110621EBD0DB407FEFDCF1EB508C0C6
|
||||||
|
:1010200088818EBD0DB407FEFDCF21968EB501508F
|
||||||
|
:101030000023B1F7C70161E070E00E948207812FB1
|
||||||
|
:10104000DF91CF911F910F91FF90EF9008951F9323
|
||||||
|
:10105000CF93DF93EC01162F60E070E00E948207CF
|
||||||
|
:101060001F711EBD0DB407FEFDCF8EB58FEF8EBD77
|
||||||
|
:101070000DB407FEFDCF1EB5CE0161E070E00E9409
|
||||||
|
:101080008207812FDF91CF911F91089569E00E941F
|
||||||
|
:101090002708817008950F931F938C01FC018081B4
|
||||||
|
:1010A00061E00E94A708F801818161E00E94A70821
|
||||||
|
:1010B000F801808160E00E94CD08C80161E070E025
|
||||||
|
:1010C0000E9482070E947B0981E00E945C0980E007
|
||||||
|
:1010D0000E94650985E00E946A09C80164E04FEF3B
|
||||||
|
:1010E0000E94C607C80167E040E70E94C607C80122
|
||||||
|
:1010F0000E94AE07C8010E949607C80161E00E94E5
|
||||||
|
:10110000F2071F910F9108950F931F938C0160E0D8
|
||||||
|
:101110004BE00E94C607C80167E040E70E94C6078F
|
||||||
|
:10112000A8014B5F5F4FC8016AE025E00E94FA0703
|
||||||
|
:10113000C8010E94AE07F801808161E00E94CD08DD
|
||||||
|
:1011400082E890E00E94D7051F910F910895482FE3
|
||||||
|
:1011500050E0CA0186569F4FFC0124914A575F4FC9
|
||||||
|
:10116000FA0184918823C1F0E82FF0E0EE0FFF1F11
|
||||||
|
:10117000E859FF4FA591B491662341F49FB7F894C5
|
||||||
|
:101180008C91209582238C939FBF08959FB7F894EC
|
||||||
|
:101190008C91822B8C939FBF0895482F50E0CA01F9
|
||||||
|
:1011A00082559F4FFC012491CA0186569F4FFC0136
|
||||||
|
:1011B00034914A575F4FFA019491992309F444C03E
|
||||||
|
:1011C000222351F1233071F0243028F42130A1F092
|
||||||
|
:1011D000223011F514C02630B1F02730C1F0243090
|
||||||
|
:1011E000D9F404C0809180008F7703C08091800083
|
||||||
|
:1011F0008F7D8093800010C084B58F7702C084B546
|
||||||
|
:101200008F7D84BD09C08091B0008F7703C080912D
|
||||||
|
:10121000B0008F7D8093B000E92FF0E0EE0FFF1F4C
|
||||||
|
:10122000EE58FF4FA591B491662341F49FB7F8940F
|
||||||
|
:101230008C91309583238C939FBF08959FB7F8942A
|
||||||
|
:101240008C91832B8C939FBF08950F931F93CF9303
|
||||||
|
:10125000DF938C01EB0109C02196D801ED91FC913F
|
||||||
|
:101260000190F081E02DC801099568816623A1F7FE
|
||||||
|
:10127000DF91CF911F910F910895EF92FF920F93FD
|
||||||
|
:101280001F93CF93DF938C017B01EA010CC0D70140
|
||||||
|
:101290006D917D01D801ED91FC910190F081E02DDF
|
||||||
|
:1012A000C80109952197209791F7DF91CF911F9160
|
||||||
|
:1012B0000F91FF90EF900895882319F48CB5806208
|
||||||
|
:1012C00002C08CB58F7D8CBD08959CB5937F982B03
|
||||||
|
:1012D0009CBD08952CB5382F33702C7F322B3CBD2C
|
||||||
|
:1012E0002DB590E0959587959595879581702E7F82
|
||||||
|
:1012F000822B8DBD08958DE061E00E94A7088BE0F0
|
||||||
|
:1013000061E00E94A7088AE061E00E94A7088DE0E2
|
||||||
|
:1013100060E00E94CD088BE060E00E94CD088AE08A
|
||||||
|
:1013200061E00E94CD088CB580618CBD8CB5806475
|
||||||
|
:101330008CBD0895A1E21A2EAA1BBB1BFD010DC096
|
||||||
|
:10134000AA1FBB1FEE1FFF1FA217B307E407F50775
|
||||||
|
:1013500020F0A21BB30BE40BF50B661F771F881F51
|
||||||
|
:10136000991F1A9469F760957095809590959B01E7
|
||||||
|
:10137000AC01BD01CF0108952F923F924F925F9231
|
||||||
|
:101380006F927F928F929F92AF92BF92CF92DF9295
|
||||||
|
:10139000EF92FF920F931F93CF93DF93CDB7DEB7FA
|
||||||
|
:1013A000CA1BDB0B0FB6F894DEBF0FBECDBF09948E
|
||||||
|
:1013B0002A88398848885F846E847D848C849B84E5
|
||||||
|
:1013C000AA84B984C884DF80EE80FD800C811B81F3
|
||||||
|
:1013D000AA81B981CE0FD11D0FB6F894DEBF0FBE22
|
||||||
|
:1013E000CDBFED010895EE0FFF1F0590F491E02DA4
|
||||||
|
:0613F0000994F894FFCF00
|
||||||
|
:1013F6002578000A0D000A0D524632342F657861B1
|
||||||
|
:101406006D706C65732F7363616E6E65722F0A0D56
|
||||||
|
:10141600002000F102000000000000280725093D19
|
||||||
|
:0A14260009CD06F806DE061C0700DB
|
||||||
|
:00000001FF
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
version 2 as published by the Free Software Foundation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file printf.h
|
||||||
|
*
|
||||||
|
* Setup necessary to direct stdout to the Arduino Serial library, which
|
||||||
|
* enables 'printf'
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __PRINTF_H__
|
||||||
|
#define __PRINTF_H__
|
||||||
|
|
||||||
|
#include "WProgram.h"
|
||||||
|
|
||||||
|
int serial_putc( char c, FILE *t )
|
||||||
|
{
|
||||||
|
Serial.write( c );
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
void printf_begin(void)
|
||||||
|
{
|
||||||
|
fdevopen( &serial_putc, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __PRINTF_H__
|
|
@ -0,0 +1,125 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
version 2 as published by the Free Software Foundation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Channel scanner
|
||||||
|
*
|
||||||
|
* Example to detect interference on the various channels available.
|
||||||
|
* This is a good diagnostic tool to check whether you're picking a
|
||||||
|
* good channel for your application.
|
||||||
|
*
|
||||||
|
* Inspired by cpixip.
|
||||||
|
* See http://arduino.cc/forum/index.php/topic,54795.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <SPI.h>
|
||||||
|
#include "nRF24L01.h"
|
||||||
|
#include "RF24.h"
|
||||||
|
#include "printf.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hardware configuration
|
||||||
|
//
|
||||||
|
|
||||||
|
// Set up nRF24L01 radio on SPI bus plus pins 8 & 9
|
||||||
|
|
||||||
|
RF24 radio(8,9);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Channel info
|
||||||
|
//
|
||||||
|
|
||||||
|
const short num_channels = 128;
|
||||||
|
short values[num_channels];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setup
|
||||||
|
//
|
||||||
|
|
||||||
|
void setup(void)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Print preamble
|
||||||
|
//
|
||||||
|
|
||||||
|
Serial.begin(57600);
|
||||||
|
printf_begin();
|
||||||
|
printf("\n\rRF24/examples/scanner/\n\r");
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setup and configure rf radio
|
||||||
|
//
|
||||||
|
|
||||||
|
radio.begin();
|
||||||
|
radio.setAutoAck(false);
|
||||||
|
|
||||||
|
// Get into standby mode
|
||||||
|
radio.startListening();
|
||||||
|
radio.stopListening();
|
||||||
|
|
||||||
|
// Print out header, high then low digit
|
||||||
|
int i = 0;
|
||||||
|
while ( i < num_channels )
|
||||||
|
{
|
||||||
|
printf("%x",i>>4);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
printf("\n\r");
|
||||||
|
i = 0;
|
||||||
|
while ( i < num_channels )
|
||||||
|
{
|
||||||
|
printf("%x",i&0xf);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
printf("\n\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Loop
|
||||||
|
//
|
||||||
|
|
||||||
|
const short num_reps = 100;
|
||||||
|
|
||||||
|
void loop(void)
|
||||||
|
{
|
||||||
|
// Clear measurement values
|
||||||
|
memset(values,0,num_channels);
|
||||||
|
|
||||||
|
// Scan all channels num_reps times
|
||||||
|
int rep_counter = num_reps;
|
||||||
|
while (rep_counter--)
|
||||||
|
{
|
||||||
|
int i = num_channels;
|
||||||
|
while (i--)
|
||||||
|
{
|
||||||
|
// Select this channel
|
||||||
|
radio.setChannel(i);
|
||||||
|
|
||||||
|
// Listen for a little
|
||||||
|
radio.startListening();
|
||||||
|
delayMicroseconds(128);
|
||||||
|
radio.stopListening();
|
||||||
|
|
||||||
|
// Did we get a carrier?
|
||||||
|
if ( radio.testCarrier() )
|
||||||
|
++values[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print out channel measurements, clamped to a single hex digit
|
||||||
|
int i = 0;
|
||||||
|
while ( i < num_channels )
|
||||||
|
{
|
||||||
|
printf("%x",min(0xf,values[i]&0xf));
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
printf("\n\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim:ai:cin:sts=2 sw=2 ft=cpp
|
Loading…
Reference in New Issue