Skip to content

Commit 66278db

Browse files
author
Thomas Preston
committed
added chip select and added falling/rising edge
1 parent 9b4d862 commit 66278db

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

CHANGELOG

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
Change Log
22
==========
33

4+
v2.1.0
5+
------
6+
- Added IODIR_FALLING_EDGE and IODIR_RISING_EDGE (pifacecommon v3.1.1).
7+
- Added `bus` and `chip_select` optional arguments to init.
8+
49
v2.0.3
510
------
6-
- Added support for interrupts from multiple boards.
11+
- Interrupts now work for multiple boards.
712

813
v2.0.2
914
------

pifacedigitalio/__init__.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,11 @@
1515
You should have received a copy of the GNU General Public License
1616
along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
"""
18-
from pifacecommon.interrupts import (IODIR_ON, IODIR_OFF, IODIR_BOTH)
18+
from pifacecommon.interrupts import (
19+
IODIR_FALLING_EDGE,
20+
IODIR_RISING_EDGE,
21+
IODIR_ON,
22+
IODIR_OFF,
23+
IODIR_BOTH,
24+
)
1925
from .core import *

pifacedigitalio/core.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import pifacecommon
66

77
# /dev/spidev<bus>.<chipselect>
8-
SPI_BUS = 0
9-
SPI_CHIP_SELECT = 0
8+
DEFAULT_SPI_BUS = 0
9+
DEFAULT_SPI_CHIP_SELECT = 0
1010

1111
# some easier to remember/read values
1212
OUTPUT_PORT = pifacecommon.core.GPIOA
@@ -115,14 +115,20 @@ def __init__(self, board_num=0):
115115
super(InputEventListener, self).__init__(INPUT_PORT, board_num)
116116

117117

118-
def init(init_board=True):
118+
def init(init_board=True,
119+
bus=DEFAULT_SPI_BUS,
120+
chip_select=DEFAULT_SPI_CHIP_SELECT):
119121
"""Initialises all PiFace Digital boards.
120122
121123
:param init_board: Initialise each board (default: True)
122124
:type init_board: boolean
125+
:param bus: SPI bus /dev/spidev<bus>.<chipselect> (default: {bus})
126+
:type bus: int
127+
:param chip_select: SPI bus /dev/spidev<bus>.<chipselect> (default: {chip})
128+
:type chip_select: int
123129
:raises: :class:`NoPiFaceDigitalDetectedError`
124-
"""
125-
pifacecommon.core.init(SPI_BUS, SPI_CHIP_SELECT)
130+
""".format(bus=DEFAULT_SPI_BUS, chip=DEFAULT_SPI_CHIP_SELECT)
131+
pifacecommon.core.init(bus, chip_select)
126132

127133
if init_board:
128134
# set up each board

pifacedigitalio/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.0.3'
1+
__version__ = '2.1.0'

0 commit comments

Comments
 (0)