diff --git a/pigpio.c b/pigpio.c index eacb301..22aefbf 100644 --- a/pigpio.c +++ b/pigpio.c @@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to */ -/* pigpio version 58 */ +/* pigpio version 59 */ /* include ------------------------------------------------------- */ @@ -897,6 +897,8 @@ typedef struct uint16_t width; uint16_t range; /* dutycycles specified by 0 .. range */ uint16_t freqIdx; + uint16_t deferOff; + uint16_t deferRng; } gpioInfo_t; typedef struct @@ -2507,6 +2509,7 @@ static void myGpioSetPwm(unsigned gpio, int oldVal, int newVal) { int switchGpioOff; int newOff, oldOff, realRange, cycles, i; + int deferOff, deferRng; DBG(DBG_INTERNAL, "myGpioSetPwm %d from %d to %d", gpio, oldVal, newVal); @@ -2520,6 +2523,18 @@ static void myGpioSetPwm(unsigned gpio, int oldVal, int newVal) newOff = (newVal * realRange)/gpioInfo[gpio].range; oldOff = (oldVal * realRange)/gpioInfo[gpio].range; + deferOff = gpioInfo[gpio].deferOff; + deferRng = gpioInfo[gpio].deferRng; + + if (gpioInfo[gpio].deferOff) + { + for (i=0; i oldOff) + { + for (i=0; i oldOff) + { + for (i=0; iI.SCL, PI_INPUT); now = gpioTick(); @@ -10348,7 +10391,7 @@ int bbI2CZip( { if (!ack) { - if ((bytes + outPos) < outLen) + if ((bytes + outPos) <= outLen) { for (i=0; i<(bytes-1); i++) { @@ -10373,7 +10416,7 @@ int bbI2CZip( { if (!ack) { - if ((bytes + inPos) < inLen) + if ((bytes + inPos) <= inLen) { for (i=0; i<(bytes-1); i++) { @@ -10382,7 +10425,7 @@ int bbI2CZip( } ack = I2CPutByte(w, inBuf[inPos++]); } - else status = PI_BAD_I2C_RLEN; + else status = PI_BAD_I2C_WLEN; } else status = PI_I2C_WRITE_FAILED; } else status = PI_BAD_I2C_CMD; @@ -11224,6 +11267,7 @@ static void *pthISRThread(void *x) { lseek(fd, 0, SEEK_SET); /* consume interrupt */ read(fd, buf, sizeof buf); + if (retval) { if (levels & (1<gpio)) level = PI_ON; else level = PI_OFF; diff --git a/pigpio.h b/pigpio.h index d421744..06d12a3 100644 --- a/pigpio.h +++ b/pigpio.h @@ -31,7 +31,7 @@ For more information, please refer to #include #include -#define PIGPIO_VERSION 58 +#define PIGPIO_VERSION 59 /*TEXT diff --git a/pigpio.py b/pigpio.py index b22202e..4876ab1 100644 --- a/pigpio.py +++ b/pigpio.py @@ -299,7 +299,7 @@ import threading import os import atexit -VERSION = "1.34" +VERSION = "1.35" exceptions = True @@ -1744,12 +1744,11 @@ class pi(): The watchdog may be cancelled by setting timeout to 0. - If no level change has been detected for the GPIO for timeout - milliseconds any notification for the GPIO has a report written - to the fifo with the flags set to indicate a watchdog timeout. + Once a watchdog has been started callbacks for the GPIO + will be triggered whenever there has been no GPIO activity + for the timeout interval. - The callback class interprets the flags and will - call registered callbacks for the GPIO with level TIMEOUT. + The callback will receive the special level TIMEOUT. ... pi.set_watchdog(23, 1000) # 1000 ms watchdog on GPIO 23 diff --git a/pigpiod_if2.3 b/pigpiod_if2.3 index 5b25e0c..d0d56a7 100644 --- a/pigpiod_if2.3 +++ b/pigpiod_if2.3 @@ -6065,7 +6065,7 @@ to cancel the callback. .EX typedef void (*CBFunc_t) .br - (unsigned user_gpio, unsigned level, uint32_t tick); + (int pi, unsigned user_gpio, unsigned level, uint32_t tick); .br .EE @@ -6079,7 +6079,7 @@ typedef void (*CBFunc_t) .EX typedef void (*CBFuncEx_t) .br - (unsigned user_gpio, unsigned level, uint32_t tick, void * userdata); + (int pi, unsigned user_gpio, unsigned level, uint32_t tick, void * userdata); .br .EE diff --git a/pigpiod_if2.h b/pigpiod_if2.h index dc6f701..0ed6719 100644 --- a/pigpiod_if2.h +++ b/pigpiod_if2.h @@ -3641,13 +3641,13 @@ to cancel the callback. CBFunc_t:: . . typedef void (*CBFunc_t) - (unsigned user_gpio, unsigned level, uint32_t tick); + (int pi, unsigned user_gpio, unsigned level, uint32_t tick); . . CBFuncEx_t:: . . typedef void (*CBFuncEx_t) - (unsigned user_gpio, unsigned level, uint32_t tick, void * userdata); + (int pi, unsigned user_gpio, unsigned level, uint32_t tick, void * userdata); . . char:: diff --git a/setup.py b/setup.py index 2921df8..619acd5 100644 --- a/setup.py +++ b/setup.py @@ -1,26 +1,17 @@ #!/usr/bin/env python -from setuptools import setup, find_packages +from distutils.core import setup -setup( - name='pigpio', - version='1.34', - author='joan', - author_email='joan@abyz.co.uk', - maintainer='joan', - maintainer_email='joan@abyz.co.uk', - url='http://abyz.co.uk/rpi/pigpio/python.html', - description='Raspberry Pi GPIO module', - long_description='Raspberry Python module to access the pigpio daemon', - download_url='http://abyz.co.uk/rpi/pigpio/pigpio.zip', - license='unlicense.org', - keywords=[ - 'raspberrypi', - 'gpio', - ], - packages=find_packages(), - classifiers=[ - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 3", - ] -) +setup(name='pigpio', + version='1.35', + author='joan', + author_email='joan@abyz.co.uk', + maintainer='joan', + maintainer_email='joan@abyz.co.uk', + url='http://abyz.co.uk/rpi/pigpio/python.html/', + description='Raspberry gpio module', + long_description='Raspberry Python module to access the pigpio daemon', + download_url='http://abyz.co.uk/rpi/pigpio/pigpio.zip', + license='unlicense.org', + py_modules=['pigpio'] + )