Skip to content

Commit f0a1481

Browse files
committed
nrf24l01
1 parent 70fd5ff commit f0a1481

File tree

118 files changed

+22186
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+22186
-3
lines changed

nrf24l01/RF24/Doxyfile

Lines changed: 2462 additions & 0 deletions
Large diffs are not rendered by default.

nrf24l01/RF24/Makefile

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#############################################################################
2+
#
3+
# Makefile for librf24-bcm on Raspberry Pi
4+
#
5+
# License: GPL (General Public License)
6+
# Author: Charles-Henri Hallard
7+
# Date: 2013/03/13
8+
#
9+
# Description:
10+
# ------------
11+
# use make all and mak install to install the library
12+
# You can change the install directory by editing the LIBDIR line
13+
#
14+
PREFIX=/usr/local
15+
16+
# Library parameters
17+
# where to put the lib
18+
LIBDIR=$(PREFIX)/lib
19+
# lib name
20+
LIB=librf24-bcm
21+
# shared library name
22+
LIBNAME=$(LIB).so.1.0
23+
24+
# Where to put the header files
25+
HEADER_DIR=${PREFIX}/include/RF24
26+
27+
# The base location of support files for different devices
28+
ARCH_DIR=utility
29+
30+
ARCH=armv6zk
31+
ifeq "$(shell uname -m)" "armv7l"
32+
ARCH=armv7-a
33+
endif
34+
35+
# The default objects to compile
36+
OBJECTS=RF24.o spi.o
37+
38+
SHARED_LINKER_FLAGS=-shared -Wl,-soname,$@.so.1
39+
40+
41+
42+
# Detect the Raspberry Pi from cpuinfo
43+
# Allow users to override the use of BCM2835 driver and force use of SPIDEV by specifying " sudo make install -B RF24_SPIDEV=1 "
44+
ifeq "$(RF24_SPIDEV)" "1"
45+
RPI=0
46+
else
47+
#Count the matches for BCM2708 or BCM2709 in cpuinfo
48+
RPI=$(shell cat /proc/cpuinfo | grep Hardware | grep -c BCM2708)
49+
ifneq "${RPI}" "1"
50+
RPI=$(shell cat /proc/cpuinfo | grep Hardware | grep -c BCM2709)
51+
endif
52+
endif
53+
54+
ifeq "$(RF24_MRAA)" "1"
55+
SHARED_LINKER_FLAGS+=-lmraa
56+
DRIVER_DIR=$(ARCH_DIR)/MRAA
57+
OBJECTS+=gpio.o compatibility.o
58+
59+
else ifeq "$(RPI)" "1"
60+
DRIVER_DIR=$(ARCH_DIR)/RPi
61+
OBJECTS+=bcm2835.o
62+
OBJECTS+=interrupt.o
63+
SHARED_LINKER_FLAGS+=-pthread
64+
# The recommended compiler flags for the Raspberry Pi
65+
CCFLAGS=-Ofast -mfpu=vfp -mfloat-abi=hard -march=$(ARCH) -mtune=arm1176jzf-s
66+
67+
else
68+
DRIVER_DIR=$(ARCH_DIR)/BBB
69+
OBJECTS+=gpio.o compatibility.o
70+
endif
71+
72+
73+
# make all
74+
# reinstall the library after each recompilation
75+
all: test librf24-bcm
76+
77+
test:
78+
cp ${DRIVER_DIR}/includes.h $(ARCH_DIR)/includes.h
79+
# Make the library
80+
librf24-bcm: $(OBJECTS)
81+
g++ ${SHARED_LINKER_FLAGS} ${CCFLAGS} -o ${LIBNAME} $^
82+
83+
# Library parts
84+
RF24.o: RF24.cpp
85+
g++ -Wall -fPIC ${CCFLAGS} -c $^
86+
87+
bcm2835.o: $(DRIVER_DIR)/bcm2835.c
88+
gcc -Wall -fPIC ${CCFLAGS} -c $^
89+
90+
spi.o: $(DRIVER_DIR)/spi.cpp
91+
g++ -Wall -fPIC ${CCFLAGS} -c $^
92+
93+
compatibility.o: $(DRIVER_DIR)/compatibility.c
94+
gcc -Wall -fPIC ${CCFLAGS} -c $(DRIVER_DIR)/compatibility.c
95+
96+
gpio.o: $(DRIVER_DIR)/gpio.cpp
97+
g++ -Wall -fPIC ${CCFLAGS} -c $(DRIVER_DIR)/gpio.cpp
98+
99+
interrupt.o: $(DRIVER_DIR)/interrupt.c
100+
g++ -Wall -fPIC ${CCFLAGS} -c $(DRIVER_DIR)/interrupt.c
101+
102+
# clear build files
103+
clean:
104+
rm -rf *.o ${LIB}.*
105+
106+
install: all install-libs install-headers
107+
108+
# Install the library to LIBPATH
109+
install-libs:
110+
@echo "[Installing Libs]"
111+
@if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi
112+
@install -m 0755 ${LIBNAME} ${LIBDIR}
113+
@ln -sf ${LIBDIR}/${LIBNAME} ${LIBDIR}/${LIB}.so.1
114+
@ln -sf ${LIBDIR}/${LIBNAME} ${LIBDIR}/${LIB}.so
115+
@ldconfig
116+
117+
install-headers:
118+
@echo "[Installing Headers]"
119+
@if ( test ! -d ${HEADER_DIR} ) ; then mkdir -p ${HEADER_DIR} ; fi
120+
@install -m 0644 *.h ${HEADER_DIR}
121+
@if ( test ! -d ${HEADER_DIR}/${DRIVER_DIR} ) ; then mkdir -p ${HEADER_DIR}/${DRIVER_DIR} ; fi
122+
@install -m 0644 ${DRIVER_DIR}/*.h ${HEADER_DIR}/${DRIVER_DIR}
123+
@install -m 0644 ${ARCH_DIR}/*.h ${HEADER_DIR}/${ARCH_DIR}

nrf24l01/RF24/Makefile.littlewire

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#############################################################################
2+
#
3+
# Makefile for librf24 via LittleWire
4+
#
5+
# License: GPL (General Public License)
6+
# Author: Andreas Steinel
7+
# Date: 2014/11/19
8+
#
9+
# Description:
10+
# ------------
11+
# use make all and make install to install the library
12+
# You can change the install directory by editing the LIBDIR line
13+
#
14+
15+
PREFIX=/opt/LittleWirePrefix
16+
17+
LIB=librf24
18+
19+
HEADER_DIR=${PREFIX}/include/RF24
20+
LIB_DIR=$(PREFIX)/lib
21+
DRIVER_DIR=utility/LittleWire
22+
23+
ifeq ($(shell uname), Linux)
24+
DYN_SUFFIX=so
25+
LINK_FORMAT=-shared -Wl,-soname,$@.$(DYN_SUFFIX)
26+
else ifeq ($(shell uname), Darwin)
27+
DYN_SUFFIX=dylib
28+
LINK_FORMAT=-dynamiclib -install_name ${LIB_DIR}/${LIB}.${DYN_SUFFIX}
29+
else
30+
$(shell echo "Unknown System, please fix Makefile!")
31+
$(shell false )
32+
endif
33+
34+
LIBNAME=$(LIB).$(DYN_SUFFIX)
35+
CCFLAGS=-O2 -Wall -g -DLITTLEWIRE -I$(PREFIX)/include
36+
LIBS=-L$(PREFIX)/lib -llittlewire-spi
37+
38+
# make all
39+
# reinstall the library after each recompilation
40+
all: $(LIB)
41+
42+
# Make the library
43+
$(LIB): RF24.o
44+
g++ $(LINK_FORMAT) ${LIBS} -o ${LIBNAME} $^
45+
46+
# Library parts
47+
RF24.o: RF24.cpp
48+
g++ -Wall -fPIC ${CCFLAGS} -c $^
49+
50+
# clear build files
51+
clean:
52+
rm -rf *.o ${LIBNAME}
53+
54+
install: all install-libs install-headers
55+
56+
# Install the library to LIBPATH
57+
install-libs:
58+
@echo "[Installing Libs]"
59+
@if ( test ! -d ${LIB_DIR} ) ; then mkdir -p ${LIB_DIR}; fi
60+
@install -m 0755 ${LIBNAME} ${LIB_DIR}
61+
@ln -sf ${LIB_DIR}/${LIBNAME} ${LIB_DIR}/${LIBNAME}.1
62+
63+
install-headers:
64+
@echo "[Installing Headers]"
65+
@if ( test ! -d ${HEADER_DIR} ) ; then mkdir -p ${HEADER_DIR} ; fi
66+
@install -m 0644 *.h ${HEADER_DIR}
67+
@if ( test ! -d ${HEADER_DIR}/${DRIVER_DIR} ) ; then mkdir -p ${HEADER_DIR}/${DRIVER_DIR} ; fi
68+
@install -m 0644 ${DRIVER_DIR}/*.h ${HEADER_DIR}/${DRIVER_DIR}

nrf24l01/RF24/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
**See http://tmrh20.github.io/RF24 for all documentation**

0 commit comments

Comments
 (0)