Package rstem :: Package gpio :: Class Pin
[hide private]
[frames] | no frames]

Class Pin

source code

Instance Methods [hide private]
 
__init__(self, pin) source code
 
__pullup(self, pin, enable) source code
 
__enable_pullup(self, pin) source code
 
__disable_pullup(self, pin) source code
 
__enable_pulldown(self, pin) source code
 
__disable_pulldown(self, pin) source code
 
__poll_thread_run(self, callback, bouncetime)
Run function used in poll_thread
source code
 
__set_edge(self, edge) source code
 
__end_thread(self) source code
 
remove_edge_detect(self)
Removes edge detect interrupt
source code
 
wait_for_edge(self, edge)
Blocks until the given edge has happened
source code
 
edge_detect(self, edge, callback=None, bouncetime=200)
Sets up edge detection interrupt.
source code
 
configure(self, direction)
Configure the GPIO pin to either be an input, output or disabled.
source code
 
was_clicked(self)
Detects whether the GPIO has been clicked or on since the pin has been initialized or since the last time was_clicked() has been called.
source code
 
get_level(self)
Returns the current level of the GPIO pin.
source code
 
set_level(self, level)
Sets the level of the GPIO port.
source code
Method Details [hide private]

wait_for_edge(self, edge)

source code 

Blocks until the given edge has happened

Parameters:
  • edge (string) - Either gpio.FALLING, gpio.RISING, gpio.BOTH

edge_detect(self, edge, callback=None, bouncetime=200)

source code 

Sets up edge detection interrupt.

Parameters:
  • edge (int) - either gpio.NONE, gpio.RISING, gpio.FALLING, or gpio.BOTH
  • callback (function) - Function to call when given edge has been detected.
  • bouncetime (int) - Debounce time in milliseconds.

Note: First parameter of callback function will be the pin number of gpio that called it.

configure(self, direction)

source code 

Configure the GPIO pin to either be an input, output or disabled.

Parameters:
  • direction (int) - Either gpio.INPUT, gpio.OUTPUT, or gpio.DISABLED

was_clicked(self)

source code 

Detects whether the GPIO has been clicked or on since the pin has been initialized or since the last time was_clicked() has been called.

Returns:
boolean

get_level(self)

source code 

Returns the current level of the GPIO pin.

Returns:
int (1 for HIGH, 0 for LOW)

Note: The GPIO pins are active low.

set_level(self, level)

source code 

Sets the level of the GPIO port.

Parameters:
  • level - Level to set. Must be either HIGH or LOW.
  • level - int