mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
@@ -11,12 +11,14 @@ from threading import Lock
|
|||||||
|
|
||||||
import RPIO
|
import RPIO
|
||||||
import RPIO.PWM
|
import RPIO.PWM
|
||||||
|
from RPIO.Exceptions import InvalidChannelException
|
||||||
|
|
||||||
from . import Pin, PINS_CLEANUP
|
from . import Pin, PINS_CLEANUP
|
||||||
from ..exc import (
|
from ..exc import (
|
||||||
PinInvalidFunction,
|
PinInvalidFunction,
|
||||||
PinSetInput,
|
PinSetInput,
|
||||||
PinFixedPull,
|
PinFixedPull,
|
||||||
|
PinInvalidPull,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -81,7 +83,10 @@ class RPIOPin(Pin):
|
|||||||
self._bounce = None
|
self._bounce = None
|
||||||
self._when_changed = None
|
self._when_changed = None
|
||||||
self._edges = 'both'
|
self._edges = 'both'
|
||||||
|
try:
|
||||||
RPIO.setup(self._number, RPIO.IN, self.GPIO_PULL_UPS[self._pull])
|
RPIO.setup(self._number, RPIO.IN, self.GPIO_PULL_UPS[self._pull])
|
||||||
|
except InvalidChannelException as e:
|
||||||
|
raise ValueError(e)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
@@ -148,7 +153,10 @@ class RPIOPin(Pin):
|
|||||||
raise PinInvalidPull('invalid pull "%s" for pin %r' % (value, self))
|
raise PinInvalidPull('invalid pull "%s" for pin %r' % (value, self))
|
||||||
|
|
||||||
def _get_frequency(self):
|
def _get_frequency(self):
|
||||||
|
if self._pwm:
|
||||||
return 100
|
return 100
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def _set_frequency(self, value):
|
def _set_frequency(self, value):
|
||||||
if value is not None and value != 100:
|
if value is not None and value != 100:
|
||||||
|
|||||||
Reference in New Issue
Block a user