Browse Source

Merge 94003c022f into 093e0a17a4

pull/60/merge
Jonathan Conway 6 years ago
committed by GitHub
parent
commit
4d38dc1d3f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 8 deletions
  1. +3
    -1
      gpio/Makefile
  2. +2
    -2
      gpio/gpio.c
  3. +4
    -4
      wiringPi/wiringPi.c
  4. +1
    -1
      wiringPi/wiringPi.h

+ 3
- 1
gpio/Makefile View File

@@ -33,7 +33,9 @@ endif
#DEBUG = -g -O0
DEBUG = -O2
CC = gcc
INCLUDE = -I$(DESTDIR)$(PREFIX)/include
#INCLUDE = -I$(DESTDIR)$(PREFIX)/include
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
INCLUDE = -I$(DESTDIR)$(PREFIX)/include -I$(ROOT_DIR)/devLib
CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe

LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib


+ 2
- 2
gpio/gpio.c View File

@@ -541,7 +541,7 @@ void doExport (int argc, char *argv [])
*********************************************************************************
*/

static void wfi (void)
static void wfi (void* arg)
{ exit (0) ; }

void doWfi (int argc, char *argv [])
@@ -565,7 +565,7 @@ void doWfi (int argc, char *argv [])
exit (1) ;
}

if (wiringPiISR (pin, mode, &wfi) < 0)
if (wiringPiISR (pin, mode, &wfi,NULL) < 0)
{
fprintf (stderr, "%s: wfi: Unable to setup ISR: %s\n", argv [1], strerror (errno)) ;
exit (1) ;


+ 4
- 4
wiringPi/wiringPi.c View File

@@ -322,7 +322,7 @@ static int sysFds [64] =

// ISR Data

static void (*isrFunctions [64])(void) ;
static void (*isrFunctions [64])(void*) ;


// Doing it the Arduino way with lookup tables...
@@ -1933,7 +1933,7 @@ static void *interruptHandler (UNU void *arg)

for (;;)
if (waitForInterrupt (myPin, -1) > 0)
isrFunctions [myPin] () ;
isrFunctions [myPin] (arg) ;

return NULL ;
}
@@ -1947,7 +1947,7 @@ static void *interruptHandler (UNU void *arg)
*********************************************************************************
*/

int wiringPiISR (int pin, int mode, void (*function)(void))
int wiringPiISR (int pin, int mode, void (*function)(void *), void* userData)
{
pthread_t threadId ;
const char *modeS ;
@@ -2029,7 +2029,7 @@ int wiringPiISR (int pin, int mode, void (*function)(void))

pthread_mutex_lock (&pinMutex) ;
pinPass = pin ;
pthread_create (&threadId, NULL, interruptHandler, NULL) ;
pthread_create (&threadId, NULL, interruptHandler, userData) ;
while (pinPass != -1)
delay (1) ;
pthread_mutex_unlock (&pinMutex) ;


+ 1
- 1
wiringPi/wiringPi.h View File

@@ -238,7 +238,7 @@ extern void digitalWriteByte2 (int value) ;
// (Also Pi hardware specific)

extern int waitForInterrupt (int pin, int mS) ;
extern int wiringPiISR (int pin, int mode, void (*function)(void)) ;
extern int wiringPiISR (int pin, int mode, void (*function)(void *), void *userData) ;

// Threads



Loading…
Cancel
Save