Module zio :: Class GPIO

Class GPIO

object --+    
         |    
    Module --+
             |
object --+   |
         |   |
     LockI --+
             |
            GPIO

GPIO class is used to control devices over general purpose IO pins.
Instance Methods
 
__init__(self, agent)
Constructs an GPIO object.
 
add_change_handler(self, handler)
Adds a handler to be invoked if the input driven on a pin changes.
 
remove_change_handler(self, handler)
Removes a previously registered handler.
 
write_output_port(self, data, mask)
Drives out data on multiple output pins.
 
write_output_pin(self, pin, value)
Drives out data on specified pin.
int
read_output_port(self)
Reads data last driven on the output port.
int
read_output_pin(self, pin)
Reads data last driven on the specified output pin.
int
read_input_port(self)
Reads out data on all pins.
int
read_input_pin(self, pin)
Reads the specified pin.

Inherited from Module: do_op

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Methods

Inherited from LockI: synchronized

Properties
  input_pin_count
The no.
  output_pin_count
The no.
  last_read_time
The relative time in microsec at which the last input pin read operation occured.
  last_write_time
The relative time in microsec at which the last output pin write operation occured.

Inherited from object: __class__

Method Details

__init__(self, agent)
(Constructor)

 
Constructs an GPIO object.
Parameters:
  • agent (Agent) - the agent interface object
Raises:
  • ProtocolError - If communication with agent fails or if data sent or received is corrupted
Overrides: object.__init__

add_change_handler(self, handler)

 
Adds a handler to be invoked if the input driven on a pin changes.
Parameters:
  • handler (function) - the callback function
Decorators:
  • @LockI.synchronized

See Also: GPIOChangeEvent

remove_change_handler(self, handler)

 
Removes a previously registered handler.
Parameters:
  • handler (function) - the handler to be removed
Decorators:
  • @LockI.synchronized

write_output_port(self, data, mask)

 
Drives out data on multiple output pins.
Parameters:
  • data (int) - the data to be driven on the pin
  • mask (int) - indicates which pins are to be modified, 1 pin will be affected, 0 pin will not be affected
Decorators:
  • @LockI.synchronized
Raises:
  • ProtocolError - If communication with agent fails or if data sent or received is corrupted

write_output_pin(self, pin, value)

 
Drives out data on specified pin.
Parameters:
  • pin (int) - the pin to be driven
  • value (int) - the value to be driven
Raises:
  • ProtocolError - If communication with agent fails or or if data sent or received is corrupted

read_output_port(self)

 
Reads data last driven on the output port.
Returns: int
the data last driven on the port.
Decorators:
  • @LockI.synchronized

read_output_pin(self, pin)

 
Reads data last driven on the specified output pin.
Parameters:
  • pin (int) - the pin to be driven
Returns: int
the data last driven on the pin

read_input_port(self)

 
Reads out data on all pins.
Returns: int
the data read from the pins.
Raises:
  • ProtocolError - If communication with agent fails or if data sent or received is corrupted

read_input_pin(self, pin)

 
Reads the specified pin.
Parameters:
  • pin (int) - the pin to be read
Returns: int
the data read from the pin
Raises:
  • ProtocolError - If communication with agent fails or if data sent or received is corrupted

Property Details

input_pin_count

The no. of input pins supported by the interface kit.
Get Method:
_get_input_pin_count(self)

output_pin_count

The no. of output pins supported by the interface kit.
Get Method:
_get_output_pin_count(self)

last_read_time

The relative time in microsec at which the last input pin read operation occured.
Get Method:
_get_last_read_time(self)

last_write_time

The relative time in microsec at which the last output pin write operation occured.
Get Method:
_get_last_write_time(self)