From: Gordon Henderson Date: Sat, 19 Jan 2013 10:31:14 +0000 (+0000) Subject: Changed the build system to drop I2C for now. Seems to cause too many issues X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=be04c1bd52fbc787eb741a2a87fcebe40f571a0d;p=wiringPi.git Changed the build system to drop I2C for now. Seems to cause too many issues on non Raspbian systems (and even on some Raspbian systems it would appear ): fixed a timing issue on softTone fixed some issues in wiringPisetup introduced when optimising the mmap calls. --- diff --git a/People b/People index 35f8a4c..f5645be 100644 --- a/People +++ b/People @@ -19,3 +19,6 @@ Armin (Via projects website) Arno Wagner Suggestions for the mmap calls in wiringPiSetup() + +CHARLES Thibaut: + A small issue in softTone diff --git a/README.TXT b/README.TXT new file mode 100644 index 0000000..0fce86a --- /dev/null +++ b/README.TXT @@ -0,0 +1,26 @@ + +wiringPi README +=============== + +Please note that the official way to get wiringPi is via git from +git.drogon.net and not GitHub. + +ie. + + git clone git://git.drogon.net/wiringPi + +The version of wiringPi held on GitHub by "Gadgetoid" is used to build the +wiringPython, Ruby, Perl, etc. wrappers for these other languages. This +version may lag the official Drogon release. Pull requests may not be +accepted to Github.... + +Please see + + https://projects.drogon.net/raspberry-pi/wiringpi/ + +for the official documentation, etc. and the best way to submit bug reports, etc. +is by sending an email to projects@drogon.net + +Thanks! + + -Gordon diff --git a/build b/build index cc6804a..2afafa6 100755 --- a/build +++ b/build @@ -2,17 +2,17 @@ i2c-install() { - echo "* wiringPi needs the I2C Development Libraires installing." - echo "" - echo "If using Debian/Raspbian, then type this command:" - echo " sudo apt-get install libi2c-dev" - echo "then run ./build again." - echo "" - echo "If using another Linux distribution, then you will have to" - echo "work out how to install the I2C Developmen Libraries for your" - echo "system. (Sorry - I don't know - do let me know though!)" - echo "" - exit 1 + echo "* wiringPi needs the I2C Development Libraires installing." + echo "" + echo "If using Debian/Raspbian, then type this command:" + echo " sudo apt-get install libi2c-dev" + echo "then run ./build again." + echo "" + echo "If using another Linux distribution, then you will have to" + echo "work out how to install the I2C Developmen Libraries for your" + echo "system. (Sorry - I don't know - do let me know though!)" + echo "" + exit 1 } check-make-ok() diff --git a/examples/Makefile b/examples/Makefile index 3607fc8..e1d29a0 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -30,7 +30,7 @@ INCLUDE = -I/usr/local/include CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe LDFLAGS = -L/usr/local/lib -LDLIBS = -lwiringPi +LDLIBS = -lwiringPi -lpthread -lm # Should not alter anything below this line ############################################################################### @@ -44,6 +44,13 @@ OBJ = $(SRC:.c=.o) BINS = $(SRC:.c=) +# Note: +# Please don't waste your time by emailling me or doing a +# pull request with changes to make all these targets. It +# is intentional that I do it this way as it now takes too +# long to compile them all and most people will not run +# them anyway... -GH- + all: @cat README.TXT @echo " $(BINS)" | fmt @@ -75,19 +82,19 @@ isr: isr.o piface: piface.o @echo [link] - @$(CC) -o $@ piface.o $(LDFLAGS) $(LDLIBS) -lpthread + @$(CC) -o $@ piface.o $(LDFLAGS) $(LDLIBS) gertboard: gertboard.o @echo [link] - @$(CC) -o $@ gertboard.o $(LDFLAGS) $(LDLIBS) -lm + @$(CC) -o $@ gertboard.o $(LDFLAGS) $(LDLIBS) nes: nes.o @echo [link] - @$(CC) -o $@ nes.o $(LDFLAGS) $(LDLIBS) -lm + @$(CC) -o $@ nes.o $(LDFLAGS) $(LDLIBS) pwm: pwm.o @echo [link] - @$(CC) -o $@ pwm.o $(LDFLAGS) $(LDLIBS) -lm -lpthread + @$(CC) -o $@ pwm.o $(LDFLAGS) $(LDLIBS) delayTest: delayTest.o @echo [link] diff --git a/gpio/Makefile b/gpio/Makefile index 729a86b..623096c 100644 --- a/gpio/Makefile +++ b/gpio/Makefile @@ -30,7 +30,7 @@ INCLUDE = -I/usr/local/include CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe LDFLAGS = -L/usr/local/lib -LIBS = -lwiringPi -lpthread +LIBS = -lwiringPi -lpthread -lm # May not need to alter anything below this line ############################################################################### diff --git a/gpio/gpio.c b/gpio/gpio.c index 6615133..326dd2d 100644 --- a/gpio/gpio.c +++ b/gpio/gpio.c @@ -42,7 +42,7 @@ extern int wiringPiDebug ; # define FALSE (1==2) #endif -#define VERSION "1.7" +#define VERSION "1.8" static int wpMode ; diff --git a/wiringPi/Makefile b/wiringPi/Makefile index 62e9d9b..0ba690f 100644 --- a/wiringPi/Makefile +++ b/wiringPi/Makefile @@ -46,7 +46,7 @@ SRC = wiringPi.c wiringPiFace.c wiringSerial.c wiringShift.c \ gertboard.c \ piNes.c \ lcd.c piHiPri.c piThread.c \ - wiringPiSPI.c wiringPiI2C.c \ + wiringPiSPI.c \ softPwm.c softServo.c softTone.c OBJ = $(SRC:.c=.o) diff --git a/wiringPi/softServo.c b/wiringPi/softServo.c index a6ff1fb..9de9f4f 100644 --- a/wiringPi/softServo.c +++ b/wiringPi/softServo.c @@ -54,6 +54,15 @@ // the multipexing, but it does need to be at least 10mS, and preferably 16 // from what I've been able to determine. +// WARNING: +// This code is really experimental. It was written in response to some people +// asking for a servo driver, however while it works, there is too much +// jitter to successfully drive a small servo - I have tried it with a micro +// servo and it worked, but the servo ran hot due to the jitter in the signal +// being sent to it. +// +// If you want servo control for the Pi, then use the servoblaster kernel +// module. #define MAX_SERVOS 8 diff --git a/wiringPi/softTone.c b/wiringPi/softTone.c index d14c2a2..8463627 100644 --- a/wiringPi/softTone.c +++ b/wiringPi/softTone.c @@ -59,7 +59,9 @@ static PI_THREAD (softToneThread) for (;;) { frewq = frewqs [pin] ; - if (frewq != 0) + if (frewq == 0) + delay (1) ; + else { halfPeriod = 500000 / frewq ; diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c index 36c49f5..9655db2 100644 --- a/wiringPi/wiringPi.c +++ b/wiringPi/wiringPi.c @@ -1204,7 +1204,11 @@ int wiringPiSetup (void) if ((fd = open ("/dev/mem", O_RDWR | O_SYNC) ) < 0) { if (wiringPiDebug) - fprintf (stderr, "wiringPiSetup: Unable to open /dev/mem: %s\n", strerror (errno)) ; + { + int serr = errno ; + fprintf (stderr, "wiringPiSetup: Unable to open /dev/mem: %s\n", strerror (errno)) ; + errno = serr ; + } return -1 ; } @@ -1214,7 +1218,11 @@ int wiringPiSetup (void) if ((int32_t)gpio == -1) { if (wiringPiDebug) - fprintf (stderr, "wiringPiSetup: mmap failed: %s\n", strerror (errno)) ; + { + int serr = errno ; + fprintf (stderr, "wiringPiSetup: mmap failed: %s\n", strerror (errno)) ; + errno = serr ; + } return -1 ; } @@ -1224,27 +1232,39 @@ int wiringPiSetup (void) if ((int32_t)pwm == -1) { if (wiringPiDebug) - fprintf (stderr, "wiringPiSetup: mmap failed (pwm): %s\n", strerror (errno)) ; + { + int serr = errno ; + fprintf (stderr, "wiringPiSetup: mmap failed (pwm): %s\n", strerror (errno)) ; + errno = serr ; + } return -1 ; } // Clock control (needed for PWM) clk = (uint32_t *)mmap(0, BLOCK_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, CLOCK_BASE) ; - if ((int32_t)clk < 0) + if ((int32_t)clk == -1) { if (wiringPiDebug) - fprintf (stderr, "wiringPiSetup: mmap failed (clk): %s\n", strerror (errno)) ; + { + int serr = errno ; + fprintf (stderr, "wiringPiSetup: mmap failed (clk): %s\n", strerror (errno)) ; + errno = serr ; + } return -1 ; } // The drive pads pads = (uint32_t *)mmap(0, BLOCK_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, GPIO_PADS) ; - if ((int32_t)pads < 0) + if ((int32_t)pads == -1) { if (wiringPiDebug) - fprintf (stderr, "wiringPiSetup: mmap failed (pads): %s\n", strerror (errno)) ; + { + int serr = errno ; + fprintf (stderr, "wiringPiSetup: mmap failed (pads): %s\n", strerror (errno)) ; + errno = serr ; + } return -1 ; } @@ -1256,10 +1276,14 @@ int wiringPiSetup (void) // The system timer timer = (uint32_t *)mmap(0, BLOCK_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, GPIO_TIMER) ; - if ((int32_t)timer < 0) + if ((int32_t)timer == -1) { if (wiringPiDebug) - fprintf (stderr, "wiringPiSetup: mmap failed (timer): %s\n", strerror (errno)) ; + { + int serr = errno ; + fprintf (stderr, "wiringPiSetup: mmap failed (timer): %s\n", strerror (errno)) ; + errno = serr ; + } return -1 ; } diff --git a/wiringPi/wiringPi.h b/wiringPi/wiringPi.h index 424e3bc..7626d28 100644 --- a/wiringPi/wiringPi.h +++ b/wiringPi/wiringPi.h @@ -53,6 +53,7 @@ #define INT_EDGE_SETUP 0 #define INT_EDGE_FALLING 1 #define INT_EDGE_RISING 2 +#define INT_EDGE_BOTH 3 // Threads