mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Remove all the remaining pin.address stuff
... again?
This commit is contained in:
@@ -238,11 +238,11 @@ class PiPin(Pin):
|
|||||||
self._when_changed = None
|
self._when_changed = None
|
||||||
self._number = number
|
self._number = number
|
||||||
try:
|
try:
|
||||||
factory.pi_info.physical_pin('GPIO%d' % self.number)
|
factory.pi_info.physical_pin(repr(self))
|
||||||
except PinNoPins:
|
except PinNoPins:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
PinNonPhysical(
|
PinNonPhysical(
|
||||||
'no physical pins exist for GPIO%d' % self.number))
|
'no physical pins exist for %s' % repr(self)))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def number(self):
|
def number(self):
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class RPiGPIOPin(LocalPiPin):
|
|||||||
|
|
||||||
def __init__(self, factory, number):
|
def __init__(self, factory, number):
|
||||||
super(RPiGPIOPin, self).__init__(factory, number)
|
super(RPiGPIOPin, self).__init__(factory, number)
|
||||||
self._pull = 'up' if self.factory.pi_info.pulled_up(self.address[-1]) else 'floating'
|
self._pull = 'up' if self.factory.pi_info.pulled_up(repr(self)) else 'floating'
|
||||||
self._pwm = None
|
self._pwm = None
|
||||||
self._frequency = None
|
self._frequency = None
|
||||||
self._duty_cycle = None
|
self._duty_cycle = None
|
||||||
@@ -110,7 +110,7 @@ class RPiGPIOPin(LocalPiPin):
|
|||||||
GPIO.setup(self.number, GPIO.OUT, initial=state)
|
GPIO.setup(self.number, GPIO.OUT, initial=state)
|
||||||
|
|
||||||
def input_with_pull(self, pull):
|
def input_with_pull(self, pull):
|
||||||
if pull != 'up' and self.factory.pi_info.pulled_up(self.address[-1]):
|
if pull != 'up' and self.factory.pi_info.pulled_up(repr(self)):
|
||||||
raise PinFixedPull('%r has a physical pull-up resistor' % self)
|
raise PinFixedPull('%r has a physical pull-up resistor' % self)
|
||||||
try:
|
try:
|
||||||
GPIO.setup(self.number, GPIO.IN, self.GPIO_PULL_UPS[pull])
|
GPIO.setup(self.number, GPIO.IN, self.GPIO_PULL_UPS[pull])
|
||||||
@@ -156,7 +156,7 @@ class RPiGPIOPin(LocalPiPin):
|
|||||||
def _set_pull(self, value):
|
def _set_pull(self, value):
|
||||||
if self.function != 'input':
|
if self.function != 'input':
|
||||||
raise PinFixedPull('cannot set pull on non-input pin %r' % self)
|
raise PinFixedPull('cannot set pull on non-input pin %r' % self)
|
||||||
if value != 'up' and self.factory.pi_info.pulled_up(self.address[-1]):
|
if value != 'up' and self.factory.pi_info.pulled_up(repr(self)):
|
||||||
raise PinFixedPull('%r has a physical pull-up resistor' % self)
|
raise PinFixedPull('%r has a physical pull-up resistor' % self)
|
||||||
try:
|
try:
|
||||||
GPIO.setup(self.number, GPIO.IN, self.GPIO_PULL_UPS[value])
|
GPIO.setup(self.number, GPIO.IN, self.GPIO_PULL_UPS[value])
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class RPIOPin(LocalPiPin):
|
|||||||
|
|
||||||
def __init__(self, factory, number):
|
def __init__(self, factory, number):
|
||||||
super(RPIOPin, self).__init__(factory, number)
|
super(RPIOPin, self).__init__(factory, number)
|
||||||
self._pull = 'up' if self.factory.pi_info.pulled_up(self.address[-1]) else 'floating'
|
self._pull = 'up' if self.factory.pi_info.pulled_up(repr(self)) else 'floating'
|
||||||
self._pwm = False
|
self._pwm = False
|
||||||
self._duty_cycle = None
|
self._duty_cycle = None
|
||||||
self._bounce = None
|
self._bounce = None
|
||||||
@@ -145,7 +145,7 @@ class RPIOPin(LocalPiPin):
|
|||||||
def _set_pull(self, value):
|
def _set_pull(self, value):
|
||||||
if self.function != 'input':
|
if self.function != 'input':
|
||||||
raise PinFixedPull('cannot set pull on non-input pin %r' % self)
|
raise PinFixedPull('cannot set pull on non-input pin %r' % self)
|
||||||
if value != 'up' and self.factory.pi_info.pulled_up(self.address[-1]):
|
if value != 'up' and self.factory.pi_info.pulled_up(repr(self)):
|
||||||
raise PinFixedPull('%r has a physical pull-up resistor' % self)
|
raise PinFixedPull('%r has a physical pull-up resistor' % self)
|
||||||
try:
|
try:
|
||||||
RPIO.setup(self.number, RPIO.IN, self.GPIO_PULL_UPS[value])
|
RPIO.setup(self.number, RPIO.IN, self.GPIO_PULL_UPS[value])
|
||||||
|
|||||||
Reference in New Issue
Block a user