Skip to content

Commit

Permalink
RPIO v0.9.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Hager committed Mar 13, 2013
1 parent 761be0c commit 25e7552
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 24 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
rpio (0.9.6) unstable; urgency=low

* RC 0.9.5 had critical bugs. Fixed now.

-- Chris Hager <[email protected]> Wed, 13 Mar 2013 21:30:14 +0100

rpio (0.9.5) unstable; urgency=low

* Cleanup
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
# built documents.
#
# The short X.Y version.
version = '0.9.5'
version = '0.9.6'
# The full version, including alpha/beta/rc tags.
release = version

Expand Down
4 changes: 3 additions & 1 deletion documentation/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Or from Github but without Git::
$ cd RPIO-master
$ sudo python setup.py install

Debian packages are available at `metachris.github.com/rpio/download <http://metachris.github.com/rpio/download/latest/>`_.

After the installation you can use ``import RPIO`` as well as the command-line tool ``rpio``.


Expand Down Expand Up @@ -110,7 +112,7 @@ License & Copyright
Changes
-------

* v0.9.5
* v0.9.6

* Added ``debounce_timeout_ms`` argument to ``RPIO.add_interrupt_callback(..)``
* Added ``threaded`` argument to ``RPIO.wait_for_interrupts(..)``
Expand Down
2 changes: 1 addition & 1 deletion fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def upload_deb():
print
print "Debian release files copied. Do this now:"
print ""
print " $ cd %s/.." % t
print " $ cd %s.." % t
print " $ ./gen_version_index.sh %s" % v
print " $ ./gen_index.sh"
print " $ git status"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def read(fname):

setup(
name="RPIO",
version="0.9.5",
version="0.9.6",
package_dir={"": "source"},
packages=['RPIO', 'RPIO.PWM'],
ext_modules=[
Expand Down
24 changes: 15 additions & 9 deletions source/RPIO/_RPIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from threading import Thread
from functools import partial

import RPIO
import RPIO._GPIO as _GPIO

# Internals
Expand All @@ -41,6 +42,11 @@
_PULL_UPDN = ("PUD_OFF", "PUD_DOWN", "PUD_UP")


def _threaded_callback(callback, *args):
""" Internal wrapper to start a callback in threaded mode """
Thread(target=callback, args=args).start()


class Interruptor:
"""
Object-based wrapper for interrupt management.
Expand Down Expand Up @@ -102,26 +108,26 @@ def add_interrupt_callback(self, gpio_id, callback, edge='both',
If `threaded_callback` is True, the callback will be started
inside a Thread.
"""
gpio_id = channel_to_gpio(gpio_id)
gpio_id = _GPIO.channel_to_gpio(gpio_id)
debug("Adding callback for GPIO %s" % gpio_id)
if not edge in ["falling", "rising", "both", "none"]:
raise AttributeError("'%s' is not a valid edge." % edge)

if not pull_up_down in [PUD_UP, PUD_DOWN, PUD_OFF]:
if not pull_up_down in [_GPIO.PUD_UP, _GPIO.PUD_DOWN, _GPIO.PUD_OFF]:
raise AttributeError("'%s' is not a valid pull_up_down." % edge)

# Make sure the gpio_id is valid
if not gpio_id in (GPIO_LIST_R1 if RPI_REVISION == 1 else \
GPIO_LIST_R2):
if not gpio_id in (RPIO.GPIO_LIST_R1 if _GPIO.RPI_REVISION == 1 else \
RPIO.GPIO_LIST_R2):
raise AttributeError("GPIO %s is not a valid gpio-id." % gpio_id)

# Require INPUT pin setup; and set the correct PULL_UPDN
if gpio_function(int(gpio_id)) == IN:
_GPIO.set_pullupdn(gpio_id, pull_up_down)
if RPIO.gpio_function(int(gpio_id)) == RPIO.IN:
RPIO.set_pullupdn(gpio_id, pull_up_down)
else:
debug("- changing gpio function from %s to INPUT" % \
(GPIO_FUNCTIONS[gpio_function(int(gpio_id))]))
_GPIO.setup(gpio_id, IN, pull_up_down)
(GPIO_FUNCTIONS[RPIO.gpio_function(int(gpio_id))]))
RPIO.setup(gpio_id, RPIO.IN, pull_up_down)

# Prepare the callback (wrap in Thread if needed)
cb = callback if not threaded_callback else \
Expand Down Expand Up @@ -197,7 +203,7 @@ def add_interrupt_callback(self, gpio_id, callback, edge='both',
def del_interrupt_callback(self, gpio_id):
""" Delete all interrupt callbacks from a certain gpio """
debug("- removing interrupts on gpio %s" % gpio_id)
gpio_id = channel_to_gpio(gpio_id)
gpio_id = _GPIO.channel_to_gpio(gpio_id)
fileno = self._map_gpioid_to_fileno[gpio_id]

# 1. Remove from epoll
Expand Down
7 changes: 1 addition & 6 deletions source/RPIO/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def socket_callback(socket, val):
from RPIO._RPIO import Interruptor


VERSION = "0.9.5"
VERSION = "0.9.6"

# Exposing constants from RPi.GPIO
VERSION_GPIO = _GPIO.VERSION_GPIO
Expand Down Expand Up @@ -182,11 +182,6 @@ def socket_callback(socket, val):
_rpio = Interruptor()


def _threaded_callback(callback, *args):
""" Internal wrapper to start a callback in threaded mode """
Thread(target=callback, args=args).start()


def sysinfo():
""" Returns (model, revision, mb-ram, maker) for this raspberry """
return (RPI_REVISION_HEX,) + MODEL_DATA[RPI_REVISION_HEX.lstrip("0")]
Expand Down
2 changes: 1 addition & 1 deletion source/c_gpio/py_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ PyMODINIT_FUNC init_GPIO(void)
rpi_revision_hex = Py_BuildValue("s", revision_hex);
PyModule_AddObject(module, "RPI_REVISION_HEX", rpi_revision_hex);

version = Py_BuildValue("s", "0.9.5/0.4.2a");
version = Py_BuildValue("s", "0.9.6/0.4.2a");
PyModule_AddObject(module, "VERSION_GPIO", version);

// set up mmaped areas
Expand Down
2 changes: 1 addition & 1 deletion source/c_pwm/pwm_py.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ PyMODINIT_FUNC init_PWM(void)
return;
#endif

PyModule_AddObject(module, "VERSION", Py_BuildValue("s", "0.9.5"));
PyModule_AddObject(module, "VERSION", Py_BuildValue("s", "0.9.6"));
PyModule_AddObject(module, "DELAY_VIA_PWM", Py_BuildValue("i", DELAY_VIA_PWM));
PyModule_AddObject(module, "DELAY_VIA_PCM", Py_BuildValue("i", DELAY_VIA_PCM));
PyModule_AddObject(module, "LOG_LEVEL_DEBUG", Py_BuildValue("i", LOG_LEVEL_DEBUG));
Expand Down
2 changes: 1 addition & 1 deletion source/scripts/man/rpio.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "RPIO" "1" "March 13, 2013" "0.9.5" "RPIO"
.TH "RPIO" "1" "March 13, 2013" "0.9.6" "RPIO"
.SH NAME
rpio \- RPIO Documentation
.
Expand Down
6 changes: 4 additions & 2 deletions source/scripts/rpio
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ def main():
gpio_id = int(gpio_id_str)
if is_valid_gpio_id(gpio_id):
f = RPIO.gpio_function(gpio_id)
info("GPIO %s: %-6s (%s)" % (gpio_id, RPIO.GPIO_FUNCTIONS[f], \
info("GPIO %s: %-6s (%s)" % (gpio_id, \
RPIO._RPIO.GPIO_FUNCTIONS[f], \
1 if RPIO.forceinput(gpio_id) else 0))
else:
if show_nonexists:
Expand All @@ -241,7 +242,8 @@ def main():
else:
error(("Cannot output to GPIO %s, because it is setup as %s. Use "
"--setoutput %s first.") % (gpio_id_str, \
RPIO.GPIO_FUNCTIONS[f], gpio_id))
RPIO._RPIO.GPIO_FUNCTIONS[f], gpio_id))



if options.interrupt:
Expand Down

0 comments on commit 25e7552

Please sign in to comment.