API Reference

qwiic_gpio

Python module for the Qwiic GPIO.

This python package is a port of the existing [SparkFun GPIO Arduino Library](https://github.com/sparkfun/SparkFun_gpio_Arduino_Library)

This package can be used in conjunction with the overall [SparkFun qwiic Python Package](https://github.com/sparkfun/Qwiic_Py)

New to qwiic? Take a look at the entire [SparkFun qwiic ecosystem](https://www.sparkfun.com/qwiic).

class qwiic_gpio.QwiicGPIO(address=None, i2c_driver=None)[source]
Parameters
  • address – The I2C address to use for the device. If not provided, the default address is used.

  • i2c_driver – An existing i2c driver object. If not provided a driver object is created.

Returns

The GPIO device object.

Return type

Object

begin()[source]

Initialize the operation of the Qwiic GPIO

Returns

Returns true of the initializtion was successful, otherwise False.

Return type

bool

getGPIO()[source]

Updates mode_X variables with values from Qwiic GPIO

Returns

The value of the mode register.

Return type

8 bit unsigned integer

getInversion()[source]

Updates inversion_X variables with values from Qwiic GPIO

Returns

The value of the inversion register.

Return type

8 bit unsigned integer

getMode()[source]

Updates mode_X variables with values from Qwiic GPIO

Returns

The value of the mode register.

Return type

8 bit unsigned integer

isConnected()[source]

Determine if a Qwiic GPIO device is connected to the system..

Returns

True if the device is connected, otherwise False.

Return type

bool

setGPIO()[source]

Send all current output settings to the GPIO. This should be called after calling myGPIO.out_status_0 = myGPIO.GPIO_HI to set the GPIO.

Returns

No return value

setInversion()[source]

Send the inversion modes of all pins. This function must be called after editing modes using myGPIO.inversion_0 = myGPIO.INVERT

Returns

No return value

setMode()[source]

Sends all 8 pin modes (input or output) to the GPIO to set all 8 pins. Setting the value to input or output is done using myGPIO.mode_0 = myGPIO.GPIO_OUT

Returns

No return value