Browse Source

Incorporated changes from WiringPi-Official v2.60

pull/157/head
Jim Parziale 3 years ago
parent
commit
9dee54bbe4
18 changed files with 106 additions and 68 deletions
  1. +6
    -2
      INSTALL
  2. +6
    -5
      build
  3. +14
    -8
      devLib/Makefile
  4. +2
    -2
      examples/Gertboard/Makefile
  5. +2
    -2
      examples/PiFace/Makefile
  6. +2
    -2
      examples/PiGlow/Makefile
  7. +2
    -2
      examples/q2w/Makefile
  8. +2
    -2
      examples/scrollPhat/Makefile
  9. +15
    -9
      gpio/Makefile
  10. +1
    -1
      gpio/gpio.1
  11. +5
    -3
      gpio/readall.c
  12. +5
    -0
      update
  13. +15
    -9
      wiringPi/Makefile
  14. +3
    -0
      wiringPi/softPwm.c
  15. +15
    -11
      wiringPi/wiringPi.c
  16. +4
    -2
      wiringPi/wiringPi.h
  17. +6
    -6
      wiringPiD/Makefile
  18. +1
    -2
      wiringPiD/drcNetCmd.h

+ 6
- 2
INSTALL View File

@@ -23,7 +23,11 @@ To un-install wiringPi:

./build uninstall

Gordon Henderson
For help and support see:

projects@drogon.net
* https://github.com/WiringPi/WiringPi/issues
* https://discord.gg/SM4WUVG


wiringPi originally created by Gordon Henderson
https://projects.drogon.net/

+ 6
- 5
build View File

@@ -36,8 +36,8 @@ check_make_ok() {
echo ""
echo "Make Failed..."
echo "Please check the messages and fix any problems. If you're still stuck,"
echo "then please email all the output and as many details as you can to"
echo " projects@drogon.net"
echo "then raise a GitHub issue with the output and as many details as you can"
echo " https://github.com/WiringPi/WiringPi/issues"
echo ""
exit 1
fi
@@ -89,14 +89,15 @@ fi

if [ x$1 = "xdebian" ]; then
here=`pwd`
deb_destdir=${here}/debian-template/wiringPi
cd debian-template/wiringPi
rm -rf usr
cd $here/wiringPi
make install-deb
make install-deb DEB_DESTDIR=${deb_destdir}
cd $here/devLib
make install-deb INCLUDE='-I. -I../wiringPi'
make install-deb INCLUDE='-I. -I../wiringPi' DEB_DESTDIR=${deb_destdir}
cd $here/gpio
make install-deb INCLUDE='-I../wiringPi -I../devLib' LDFLAGS=-L../debian-template/wiringPi/usr/lib
make install-deb INCLUDE='-I../wiringPi -I../devLib' LDFLAGS=-L../debian-template/wiringPi/usr/lib DEB_DESTDIR=${deb_destdir}
cd $here/debian-template
fakeroot dpkg-deb --build wiringPi
mv wiringPi.deb wiringpi-`cat $here/VERSION`-1.deb


+ 14
- 8
devLib/Makefile View File

@@ -36,10 +36,10 @@ DYNAMIC=libwiringPiDev.so.$(VERSION)

#DEBUG = -g -O0
DEBUG = -O2
CC = gcc
CC ?= gcc
INCLUDE = -I.
DEFS = -D_GNU_SOURCE
CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC $(EXTRA_CFLAGS)

LIBS =

@@ -105,15 +105,21 @@ install-static: $(STATIC)
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
$Q install -m 0755 libwiringPiDev.a $(DESTDIR)$(PREFIX)/lib

.PHONY: check-deb-destdir
check-deb-destdir:
ifndef DEB_DESTDIR
$(error DEB_DESTDIR is undefined)
endif

.PHONY: install-deb
install-deb: $(DYNAMIC)
install-deb: $(DYNAMIC) check-deb-destdir
$Q echo "[Install Headers: deb]"
$Q install -m 0755 -d ~/wiringPi/debian-template/wiringPi/usr/include
$Q install -m 0644 $(HEADERS) ~/wiringPi/debian-template/wiringPi/usr/include
$Q install -m 0755 -d $(DEB_DESTDIR)/usr/include
$Q install -m 0644 $(HEADERS) $(DEB_DESTDIR)/usr/include
$Q echo "[Install Dynamic Lib: deb]"
install -m 0755 -d ~/wiringPi/debian-template/wiringPi/usr/lib
install -m 0755 libwiringPiDev.so.$(VERSION) ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPiDev.so.$(VERSION)
ln -sf ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPiDev.so.$(VERSION) ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPiDev.so
install -m 0755 -d $(DEB_DESTDIR)/usr/lib
install -m 0755 libwiringPiDev.so.$(VERSION) $(DEB_DESTDIR)/usr/lib/libwiringPiDev.so.$(VERSION)
ln -sf $(DEB_DESTDIR)/usr/lib/libwiringPiDev.so.$(VERSION) $(DEB_DESTDIR)/usr/lib/libwiringPiDev.so

.PHONY: uninstall
uninstall:


+ 2
- 2
examples/Gertboard/Makefile View File

@@ -11,9 +11,9 @@ endif

#DEBUG = -g -O0
DEBUG = -O3
CC = gcc
CC ?= gcc
INCLUDE = -I/usr/local/include
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe $(EXTRA_CFLAGS)

LDFLAGS = -L/usr/local/lib
LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm


+ 2
- 2
examples/PiFace/Makefile View File

@@ -28,9 +28,9 @@ endif

#DEBUG = -g -O0
DEBUG = -O3
CC = gcc
CC ?= gcc
INCLUDE = -I/usr/local/include
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe $(EXTRA_CFLAGS)

LDFLAGS = -L/usr/local/lib
LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm


+ 2
- 2
examples/PiGlow/Makefile View File

@@ -28,9 +28,9 @@ endif

#DEBUG = -g -O0
DEBUG = -O3
CC = gcc
CC ?= gcc
INCLUDE = -I/usr/local/include
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe $(EXTRA_CFLAGS)

LDFLAGS = -L/usr/local/lib
LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm


+ 2
- 2
examples/q2w/Makefile View File

@@ -28,9 +28,9 @@ endif

#DEBUG = -g -O0
DEBUG = -O3
CC = gcc
CC ?= gcc
INCLUDE = -I/usr/local/include
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe $(EXTRA_CFLAGS)

LDFLAGS = -L/usr/local/lib
LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm


+ 2
- 2
examples/scrollPhat/Makefile View File

@@ -28,9 +28,9 @@ endif

#DEBUG = -g -O0
DEBUG = -O3
CC = gcc
CC ?= gcc
INCLUDE = -I/usr/local/include
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe $(EXTRA_CFLAGS)

LDFLAGS = -L/usr/local/lib
LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm


+ 15
- 9
gpio/Makefile View File

@@ -32,10 +32,9 @@ endif

#DEBUG = -g -O0
DEBUG = -O2
CC = gcc
#INCLUDE = -I$(DESTDIR)$(PREFIX)/include
INCLUDE = -I../wiringPi
CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
CC ?= gcc
INCLUDE = -I$(DESTDIR)$(PREFIX)/include -I../wiringPi
CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe $(EXTRA_CFLAGS)

LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
LIBS = -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt
@@ -73,6 +72,7 @@ tags: $(SRC)
.PHONY: install
install: gpio
$Q echo "[Install]"
$Q mkdir -p $(DESTDIR)$(PREFIX)/bin
$Q cp gpio $(DESTDIR)$(PREFIX)/bin
ifneq ($(WIRINGPI_SUID),0)
$Q chown root.root $(DESTDIR)$(PREFIX)/bin/gpio
@@ -81,13 +81,19 @@ endif
$Q mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
$Q cp gpio.1 $(DESTDIR)$(PREFIX)/share/man/man1

.PHONY: check-deb-destdir
check-deb-destdir:
ifndef DEB_DESTDIR
$(error DEB_DESTDIR is undefined)
endif

.PHONY: install-deb
install-deb: gpio
install-deb: gpio check-deb-destdir
$Q echo "[Install: deb]"
$Q install -m 0755 -d ~/wiringPi/debian-template/wiringPi/usr/bin
$Q install -m 0755 gpio ~/wiringPi/debian-template/wiringPi/usr/bin
$Q install -m 0755 -d ~/wiringPi/debian-template/wiringPi/usr/share/man/man1
$Q install -m 0644 gpio.1 ~/wiringPi/debian-template/wiringPi/usr/share/man/man1
$Q install -m 0755 -d $(DEB_DESTDIR)/usr/bin
$Q install -m 0755 gpio $(DEB_DESTDIR)/usr/bin
$Q install -m 0755 -d $(DEB_DESTDIR)/usr/share/man/man1
$Q install -m 0644 gpio.1 $(DEB_DESTDIR)/usr/share/man/man1

.PHONY: uninstall
uninstall:


+ 1
- 1
gpio/gpio.1 View File

@@ -337,7 +337,7 @@ Gordon Henderson

.SH "REPORTING BUGS"

Please report bugs to <projects@drogon.net>
Please report bugs to https://github.com/WiringPi/WiringPi/issues

.SH COPYRIGHT



+ 5
- 3
gpio/readall.c View File

@@ -311,6 +311,8 @@ static void plus2header (int model)
printf (" +-----+-----+---------+------+---+---Pi 3A+-+---+------+---------+-----+-----+\n") ;
else if (model == PI_MODEL_4B)
printf (" +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+\n") ;
else if (model == PI_MODEL_400)
printf (" +-----+-----+---------+------+---+---Pi 400-+---+------+---------+-----+-----+\n") ;
else
printf (" +-----+-----+---------+------+---+---Pi ?---+---+------+---------+-----+-----+\n") ;
}
@@ -358,10 +360,10 @@ void doReadall (void)
(model == PI_MODEL_2) ||
(model == PI_MODEL_3AP) ||
(model == PI_MODEL_3B) || (model == PI_MODEL_3BP) ||
(model == PI_MODEL_4B) ||
(model == PI_MODEL_ZERO) || (model == PI_MODEL_ZERO_W))
(model == PI_MODEL_4B) || (model == PI_MODEL_400) ||
(model == PI_MODEL_ZERO) || (model == PI_MODEL_ZERO_W) || (model == PI_MODEL_CM4))
piPlusReadall (model) ;
else if ((model == PI_MODEL_CM) || (model == PI_MODEL_CM3) || ((model == PI_MODEL_CM3P)))
else if ((model == PI_MODEL_CM) || (model == PI_MODEL_CM3) || (model == PI_MODEL_CM3P) )
allReadall () ;
else
printf ("Oops - unable to determine board type... model: %d\n", model) ;


+ 5
- 0
update View File

@@ -0,0 +1,5 @@
#!/bin/sh

# update - update source files from master on yakko

rsync -aHx --exclude='*.o' --exclude='*~' -v --delete gordon@yakko:rpi/git/wiringPi/ .

+ 15
- 9
wiringPi/Makefile View File

@@ -36,10 +36,10 @@ DYNAMIC=libwiringPi.so.$(VERSION)

#DEBUG = -g -O0
DEBUG = -O2
CC = gcc
CC ?= gcc
INCLUDE = -I.
DEFS = -D_GNU_SOURCE
CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC
CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC $(EXTRA_CFLAGS)
#CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Wconversion -Winline $(INCLUDE) -pipe -fPIC

LIBS = -lm -lpthread -lrt -lcrypt
@@ -75,7 +75,7 @@ static:

$(DYNAMIC): $(OBJ)
$Q echo "[Link (Dynamic)]"
$Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(LIBS) $(OBJ)
$Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(OBJ) $(LIBS)

.c.o:
$Q echo [Compile] $<
@@ -104,15 +104,21 @@ install: $(DYNAMIC)
$Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
$Q $(LDCONFIG)

.PHONY: check-deb-destdir
check-deb-destdir:
ifndef DEB_DESTDIR
$(error DEB_DESTDIR is undefined)
endif

.PHONY: install-deb
install-deb: $(DYNAMIC)
install-deb: $(DYNAMIC) check-deb-destdir
$Q echo "[Install Headers: deb]"
$Q install -m 0755 -d ~/wiringPi/debian-template/wiringPi/usr/include
$Q install -m 0644 $(HEADERS) ~/wiringPi/debian-template/wiringPi/usr/include
$Q install -m 0755 -d $(DEB_DESTDIR)/usr/include
$Q install -m 0644 $(HEADERS) $(DEB_DESTDIR)/usr/include
$Q echo "[Install Dynamic Lib: deb]"
install -m 0755 -d ~/wiringPi/debian-template/wiringPi/usr/lib
install -m 0755 libwiringPi.so.$(VERSION) ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPi.so.$(VERSION)
ln -sf ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPi.so.$(VERSION) ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPi.so
install -m 0755 -d $(DEB_DESTDIR)/usr/lib
install -m 0755 libwiringPi.so.$(VERSION) $(DEB_DESTDIR)/usr/lib/libwiringPi.so.$(VERSION)
ln -sf $(DEB_DESTDIR)/usr/lib/libwiringPi.so.$(VERSION) $(DEB_DESTDIR)/usr/lib/libwiringPi.so

.PHONY: uninstall
uninstall:


+ 3
- 0
wiringPi/softPwm.c View File

@@ -153,6 +153,9 @@ int softPwmCreate (int pin, int initialValue, int pwmRange)
newPin = pin ;
res = pthread_create (&myThread, NULL, softPwmThread, (void *)passPin) ;

if (res != 0)
return res ;
while (newPin != -1)
delay (1) ;



+ 15
- 11
wiringPi/wiringPi.c View File

@@ -219,7 +219,7 @@ volatile unsigned int *_wiringPiTimerIrqRaw ;

static volatile unsigned int piGpioBase = 0 ;

const char *piModelNames [20] =
const char *piModelNames [21] =
{
"Model A", // 0
"Model B", // 1
@@ -240,10 +240,11 @@ const char *piModelNames [20] =
"CM3+", // 16
"Pi 4B", // 17
"Unknown18", // 18
"Unknown19", // 19
"Pi 400", // 19
"CM4", // 20
} ;

const char *piRevisionNames [18] =
const char *piRevisionNames [21] =
{
"00",
"01",
@@ -263,6 +264,9 @@ const char *piRevisionNames [18] =
"15",
"16",
"17",
"18",
"19",
"20",
} ;

const char *piMakerNames [16] =
@@ -292,7 +296,7 @@ const int piMemorySize [8] =
1024, // 2
2048, // 3
4096, // 4
0, // 5
8192, // 5
0, // 6
0, // 7
} ;
@@ -1325,8 +1329,8 @@ struct wiringPiNodeStruct *wiringPiFindNode (int pin)

static void pinModeDummy (UNU struct wiringPiNodeStruct *node, UNU int pin, UNU int mode) { return ; }
static void pullUpDnControlDummy (UNU struct wiringPiNodeStruct *node, UNU int pin, UNU int pud) { return ; }
static unsigned int digitalRead8Dummy (UNU struct wiringPiNodeStruct *node, UNU int UNU pin) { return 0 ; }
static void digitalWrite8Dummy (UNU struct wiringPiNodeStruct *node, UNU int pin, UNU int value) { return ; }
//static unsigned int digitalRead8Dummy (UNU struct wiringPiNodeStruct *node, UNU int UNU pin) { return 0 ; }
//static void digitalWrite8Dummy (UNU struct wiringPiNodeStruct *node, UNU int pin, UNU int value) { return ; }
static int digitalReadDummy (UNU struct wiringPiNodeStruct *node, UNU int UNU pin) { return LOW ; }
static void digitalWriteDummy (UNU struct wiringPiNodeStruct *node, UNU int pin, UNU int value) { return ; }
static void pwmWriteDummy (UNU struct wiringPiNodeStruct *node, UNU int pin, UNU int value) { return ; }
@@ -2050,7 +2054,7 @@ int wiringPiISR (int pin, int mode, void (*function)(void))
return wiringPiFailure (WPI_FATAL, "wiringPiISR: Can't find gpio program\n") ;
}
else // Parent, wait
wait (NULL) ;
waitpid (pid, NULL, 0) ;
}

// Now pre-open the /sys/class node - but it may already be open if
@@ -2257,10 +2261,8 @@ int wiringPiSetup (void)
int fd ;
int model, rev, mem, maker, overVolted ;

// It's actually a fatal error to call any of the wiringPiSetup routines more than once,
// (you run out of file handles!) but I'm fed-up with the useless twats who email
// me bleating that there is a bug in my code, so screw-em.

// It's actually a fatal error to call any of the wiringPiSetup routines more than once,
// you run out of file handles.
if (wiringPiSetuped)
return 0 ;

@@ -2314,6 +2316,8 @@ int wiringPiSetup (void)
break ;

case PI_MODEL_4B:
case PI_MODEL_400:
case PI_MODEL_CM4:
piGpioBase = GPIO_PERI_BASE_2711 ;
piGpioPupOffset = GPPUPPDN0 ;
break ;


+ 4
- 2
wiringPi/wiringPi.h View File

@@ -103,6 +103,8 @@
#define PI_MODEL_3AP 14
#define PI_MODEL_CM3P 16
#define PI_MODEL_4B 17
#define PI_MODEL_400 19
#define PI_MODEL_CM4 20

#define PI_VERSION_1 0
#define PI_VERSION_1_1 1
@@ -116,8 +118,8 @@
#define PI_MAKER_EMBEST4 4
#define PI_MAKER_STADIUM 5

extern const char *piModelNames [20] ;
extern const char *piRevisionNames [18] ;
extern const char *piModelNames [21] ;
extern const char *piRevisionNames [21] ;
extern const char *piMakerNames [16] ;
extern const int piMemorySize [ 8] ;



+ 6
- 6
wiringPiD/Makefile View File

@@ -31,9 +31,9 @@ endif

#DEBUG = -g -O0
DEBUG = -O2
CC = gcc
CC ?= gcc
INCLUDE = -I$(DESTDIR)$(PREFIX)/include
CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe $(EXTRA_CFLAGS)

LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
LIBS = -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt
@@ -78,10 +78,10 @@ install: wiringpid
.PHONY: install-deb
install-deb: gpio
$Q echo "[Install: deb]"
$Q install -m 0755 -d ~/wiringPi/debian-template/wiringPi/usr/bin
$Q install -m 0755 gpio ~/wiringPi/debian-template/wiringPi/usr/bin
$Q install -m 0755 -d ~/wiringPi/debian-template/wiringPi/man/man1
$Q install -m 0644 gpio.1 ~/wiringPi/debian-template/wiringPi/man/man1
$Q install -m 0755 -d $(DEB_DESTDIR)/usr/bin
$Q install -m 0755 gpio $(DEB_DESTDIR)/usr/bin
$Q install -m 0755 -d $(DEB_DESTDIR)/man/man1
$Q install -m 0644 gpio.1 $(DEB_DESTDIR)/man/man1

.PHONY: uninstall
uninstall:


+ 1
- 2
wiringPiD/drcNetCmd.h View File

@@ -40,5 +40,4 @@ struct drcNetComStruct
uint32_t pin ;
uint32_t cmd ;
uint32_t data ;
} comDat ;

};

Loading…
Cancel
Save