Skip to content

Commit

Permalink
Don't build Adafruit_BBIO - doesn't work on all platforms. (#5281)
Browse files Browse the repository at this point in the history
* Don't build Adafruit_BBIO - doesn't work on all platforms.

* Disable pylint import warning on BBIO.
  • Loading branch information
pavoni authored and balloob committed Jan 12, 2017
1 parent d4a54ac commit 9a3c0c8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
13 changes: 11 additions & 2 deletions homeassistant/components/bbb_gpio.py
Expand Up @@ -19,6 +19,7 @@
# pylint: disable=no-member
def setup(hass, config):
"""Setup the Beaglebone black GPIO component."""
# pylint: disable=import-error
import Adafruit_BBIO.GPIO as GPIO

def cleanup_gpio(event):
Expand All @@ -33,33 +34,41 @@ def prepare_gpio(event):
return True


# noqa: F821

def setup_output(pin):
"""Setup a GPIO as output."""
# pylint: disable=import-error,undefined-variable
import Adafruit_BBIO.GPIO as GPIO
GPIO.setup(pin, GPIO.OUT)


def setup_input(pin, pull_mode):
"""Setup a GPIO as input."""
# pylint: disable=import-error,undefined-variable
import Adafruit_BBIO.GPIO as GPIO
GPIO.setup(pin, GPIO.IN,
GPIO.PUD_DOWN if pull_mode == 'DOWN' else GPIO.PUD_UP)
GPIO.setup(pin, GPIO.IN, # noqa: F821
GPIO.PUD_DOWN if pull_mode == 'DOWN' # noqa: F821
else GPIO.PUD_UP) # noqa: F821


def write_output(pin, value):
"""Write a value to a GPIO."""
# pylint: disable=import-error,undefined-variable
import Adafruit_BBIO.GPIO as GPIO
GPIO.output(pin, value)


def read_input(pin):
"""Read a value from a GPIO."""
# pylint: disable=import-error,undefined-variable
import Adafruit_BBIO.GPIO as GPIO
return GPIO.input(pin)


def edge_detect(pin, event_callback, bounce):
"""Add detection for RISING and FALLING events."""
# pylint: disable=import-error,undefined-variable
import Adafruit_BBIO.GPIO as GPIO
GPIO.add_event_detect(
pin,
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Expand Up @@ -13,7 +13,7 @@ async_timeout==1.1.0
--only-binary=all http://github.com/getSenic/nuimo-linux-python/archive/29fc42987f74d8090d0e2382e8f248ff5990b8c9.zip#nuimo==1.0.0

# homeassistant.components.bbb_gpio
Adafruit_BBIO==1.0.0
# Adafruit_BBIO==1.0.0

# homeassistant.components.isy994
PyISY==1.0.7
Expand Down
1 change: 1 addition & 0 deletions script/gen_requirements_all.py
Expand Up @@ -10,6 +10,7 @@
'RPi.GPIO',
'rpi-rf',
'Adafruit_Python_DHT',
'Adafruit_BBIO',
'fritzconnection',
'pybluez',
'bluepy',
Expand Down

0 comments on commit 9a3c0c8

Please sign in to comment.