Skip to content

Commit

Permalink
Sleepy-pi support - do not use pi piface#25
Browse files Browse the repository at this point in the history
  • Loading branch information
avishayp committed Jan 14, 2019
1 parent f81ae8e commit 7b3739a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pifacecommon/interrupts.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# IN_EVENT_DIR_OFF = INPUT_DIRECTION_OFF = 1
# IN_EVENT_DIR_BOTH = INPUT_DIRECTION_BOTH = None

GPIO_INTERRUPT_PIN = 25
GPIO_INTERRUPT_PIN = 13
GPIO_INTERRUPT_DEVICE = "/sys/class/gpio/gpio%d" % GPIO_INTERRUPT_PIN
GPIO_INTERRUPT_DEVICE_EDGE = '%s/edge' % GPIO_INTERRUPT_DEVICE
GPIO_INTERRUPT_DEVICE_VALUE = '%s/value' % GPIO_INTERRUPT_DEVICE
Expand Down
4 changes: 2 additions & 2 deletions pifacecommon/mcp23s17.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
get_bit_mask,
get_bit_num,
)
from .spi import SPIDevice
from .spi import SPIDevice, Defaults
import pifacecommon.interrupts


Expand Down Expand Up @@ -87,7 +87,7 @@ class MCP23S17(SPIDevice):
:attribute: olata/olatb -- The OLAT register provides access to the
output latches.
"""
def __init__(self, hardware_addr=0, bus=0, chip_select=0, speed_hz=100000):
def __init__(self, hardware_addr=0, bus=0, chip_select=0, speed_hz=Defaults.SPEED_HZ):
super(MCP23S17, self).__init__(bus, chip_select, speed_hz=speed_hz)
self.hardware_addr = hardware_addr

Expand Down
5 changes: 4 additions & 1 deletion pifacecommon/spi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
"#enable-the-spi-module"


class Defaults:
SPEED_HZ = 100000

class SPIInitError(Exception):
pass


class SPIDevice(object):
"""An SPI Device at /dev/spi<bus>.<chip_select>."""
def __init__(self, bus=0, chip_select=0, spi_callback=None, speed_hz=100000):
def __init__(self, bus=0, chip_select=0, spi_callback=None, speed_hz=Defaults.SPEED_HZ):
"""Initialises the SPI device file descriptor.
:param bus: The SPI device bus number
Expand Down

0 comments on commit 7b3739a

Please sign in to comment.