chiark / gitweb /
Changed the build system to drop I2C for now. Seems to cause too many issues
authorGordon Henderson <projects@drogon.net>
Sat, 19 Jan 2013 10:31:14 +0000 (10:31 +0000)
committerGordon Henderson <projects@drogon.net>
Sat, 19 Jan 2013 10:31:14 +0000 (10:31 +0000)
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.

People
README.TXT [new file with mode: 0644]
build
examples/Makefile
gpio/Makefile
gpio/gpio.c
wiringPi/Makefile
wiringPi/softServo.c
wiringPi/softTone.c
wiringPi/wiringPi.c
wiringPi/wiringPi.h

diff --git a/People b/People
index 35f8a4cbadd266786f6edf06a9e940003e365eb8..f5645be1c3b48f1698e8827d399b005c868c638f 100644 (file)
--- 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 (file)
index 0000000..0fce86a
--- /dev/null
@@ -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 cc6804a6a7f3e544fa5edc7affddd0bd910e3766..2afafa665cff04f38f8b817972c3c8c20d5f6ea9 100755 (executable)
--- 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()
index 3607fc85059d4a3ae9489110b1c2a507b2a9edb2..e1d29a01a571e3fb8163707acac95fbf688ef1fb 100644 (file)
@@ -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]
index 729a86bdb0dd9f31a1fb7be0ff0553e5829518cc..623096c58d4072fb9261f11cfc7356094659e205 100644 (file)
@@ -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
 ###############################################################################
index 66151336fa0c158aadcc4a83e04684d55e2e5d47..326dd2d9558e87c9514e2e18544f263538b12649 100644 (file)
@@ -42,7 +42,7 @@ extern int wiringPiDebug ;
 #  define      FALSE   (1==2)
 #endif
 
-#define        VERSION "1.7"
+#define        VERSION "1.8"
 
 static int wpMode ;
 
index 62e9d9b8e7503c752b0f18c4cabe777e42dfb982..0ba690f3c28fb09f19bb4455b8198001b4a6046a 100644 (file)
@@ -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)
index a6ff1fb661131e949bcdad3cae5fc409672ee404..9de9f4faf11a82074b7f794e048431d488ebcaa4 100644 (file)
 //     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
 
index d14c2a2ea69753d6b02d0c1d5369b41a23a841c5..846362726fdb8fbbe20fe7e38774cffa8d0ff135 100644 (file)
@@ -59,7 +59,9 @@ static PI_THREAD (softToneThread)
   for (;;)
   {
     frewq = frewqs [pin] ;
-    if (frewq != 0)
+    if (frewq == 0)
+      delay (1) ;
+    else
     {
       halfPeriod = 500000 / frewq ;
 
index 36c49f548703fb443c36730daa14c34ab89b2705..9655db25d705a292dc08608f12d54c3fa8d64f8b 100644 (file)
@@ -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 ;
   }
 
index 424e3bcd451a0f66365ebae34e5e07ffba87a444..7626d284db7e1f4775ec73788bda844f430ad3dc 100644 (file)
@@ -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