CHIP_IO

A CHIP IO library for Python: IO+PWM+SPWM+ADC+Utilities

View the Project on GitHub

CHIP_IO.GPIO

Import the GPIO module as follows

  import CHIP_IO.GPIO as GPIO

Note: As of version 0.7.0, all GPIO functions can use the SYSFS pin number for a GPIO for control, a la RPi.GPIO.

toggle_debug()

Enable/Disable the Debug

is_chip_pro()

Function to report to the calling script if the SBC is a CHIP or a CHIP Pro

setmode(mode)

Dummy function to maintain backwards compatibility with Raspberry Pi scripts.

setup(channel, direction, pull_up_down=PUD_OFF, initial=None)

Setup a GPIO pin. If pin is already configure, it will reconfigure.

cleanup(channel)

Cleanup GPIO. If not channel input, all GPIO will be cleaned up

output(channel, value)

Write a value to a GPIO pin.

input(channel)

Read a GPIO pin once.

read_byte(channel)

Read a GPIO pin multiple times to fill up 8 bits.

read_word(channel)

Read a GPIO pin multiple times to fill up 16 bits.

add_event_detect(channel, edge, callback=None, bouncetime=0)

Add event detection to a pin. Refer to main table for which pins are able to use edge detection.

remove_event_detect(channel)

Remove a pins event detection. Refer to main table for which pins are able to use edge detection.

event_detected(channel)

Function to determine if an event was detected on a pin. Pin must have an event detect added via add_event_detect() prior to calling this function. Refer to main table for which pins are able to use edge detection.

add_event_callback(channel, callback, bouncetime=0)

Add callback function to a pin that has been setup for edge detection. Refer to main table for which pins are able to use edge detection.

wait_for_edge(channel, edge, timeout=-1)

Wait for an edge to be detected. This is a blocking function. Refer to main table for which pins are able to use edge detection.

gpio_function(channel)

Function to report get a GPIO Pins directioj

setwarnings(state)

Function to enable/disable warning print outs. This may or may not work properly. toggle_debug() is a better bet.

get_gpio_base()

Function to get the SYSFS base value for the XIO pins on a CHIP

selftest(value)

Function to perform a selftest on the GPIO module

direction(channel, direction)

Function to set the direction of an exported GPIO pin

home