b1e66c2af1
Xmlrpc client/server application to control the digital attenuators installed in the lava testbed. Implements AR_VUL-64. Signed-off-by: Thomas Klaehn <thomas.klaehn@u-blox.com>
22 lines
605 B
Python
22 lines
605 B
Python
class IOPi(object):
|
|
address = None
|
|
used_pins = [0 for i in range(17)]
|
|
pin_directions = [0 for i in range(17)]
|
|
pin_values = [0 for i in range(17)]
|
|
|
|
def __init__(self, address):
|
|
self.address = address
|
|
|
|
def set_pin_direction(self, pin, direction):
|
|
self.used_pins[pin] = 1
|
|
self.pin_directions[pin] = direction
|
|
|
|
def write_pin(self, pin, value):
|
|
self.used_pins[pin] = 1
|
|
self.pin_values[pin] = value
|
|
|
|
def read_pin(self, pin):
|
|
if self.used_pins[pin] == 1:
|
|
return self.pin_values[pin]
|
|
else:
|
|
return None |