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.
pull/6/head
Gordon Henderson 13 years ago
parent c82fb8735d
commit be04c1bd52

@ -19,3 +19,6 @@ Armin (Via projects website)
Arno Wagner
Suggestions for the mmap calls in wiringPiSetup()
CHARLES Thibaut:
A small issue in softTone

@ -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

@ -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]

@ -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
###############################################################################

@ -42,7 +42,7 @@ extern int wiringPiDebug ;
# define FALSE (1==2)
#endif
#define VERSION "1.7"
#define VERSION "1.8"
static int wpMode ;

@ -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)

@ -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

@ -59,7 +59,9 @@ static PI_THREAD (softToneThread)
for (;;)
{
frewq = frewqs [pin] ;
if (frewq != 0)
if (frewq == 0)
delay (1) ;
else
{
halfPeriod = 500000 / frewq ;

@ -1204,7 +1204,11 @@ int wiringPiSetup (void)
if ((fd = open ("/dev/mem", O_RDWR | O_SYNC) ) < 0)
{
if (wiringPiDebug)
{
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)
{
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)
{
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)
{
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)
{
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)
{
int serr = errno ;
fprintf (stderr, "wiringPiSetup: mmap failed (timer): %s\n", strerror (errno)) ;
errno = serr ;
}
return -1 ;
}

@ -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

Loading…
Cancel
Save