Qwiic_GPIO_Py  2.0.0
Python for SFE Qwiic GPIO
Loading...
Searching...
No Matches
qwiic_gpio.QwiicGPIO Class Reference

QwiicGPIO. More...

Inheritance diagram for qwiic_gpio.QwiicGPIO:

Public Member Functions

def __init__ (self, address=None, i2c_driver=None)
 
def isConnected (self)
 Determine if a Qwiic GPIO device is connected to the system. More...
 
def begin (self)
 Initialize the operation of the Qwiic GPIO. More...
 
def setMode (self)
 Sends all 8 pin modes (input or output) to the GPIO to set all 8 pins. More...
 
def getMode (self)
 Updates mode_X variables with values from Qwiic GPIO. More...
 
def setInversion (self)
 Send the inversion modes of all pins. More...
 
def getInversion (self)
 Updates inversion_X variables with values from Qwiic GPIO. More...
 
def setGPIO (self)
 Send all current output settings to the GPIO. More...
 
def getGPIO (self)
 Updates mode_X variables with values from Qwiic GPIO. More...
 
def pinMode (self, pin, mode)
 Set the mode of a single pin. More...
 
def pinModePort (self, gpioPinModeList)
 Set the mode of a list of pins. More...
 
def invertPin (self, pin, invert)
 Set the inversion of a single pin. More...
 
def invertPinPort (self, gpioInversionList)
 Set the inversion of a list of pins. More...
 
def digitalWrite (self, pin, value)
 Set the output value of a single pin. More...
 
def digitalWritePort (self, gpioOutputList)
 Set the output value of a list of pins. More...
 
def digitalRead (self, pin)
 Get the input value of a single pin. More...
 
def digitalReadPort (self)
 Get the input value of all pins. More...
 

Public Attributes

 address
 
 inversions
 
 modes
 
 out_statuses
 
 in_statuses
 

Static Public Attributes

 device_name = _DEFAULT_NAME
 
 available_addresses = _AVAILABLE_I2C_ADDRESS
 
int REG_INPUT_PORT = 0x00
 
int REG_OUTPUT_PORT = 0x01
 
int REG_INVERSION = 0x02
 
int REG_CONFIGURATION = 0x03
 
int GPIO_OUT = 0
 
int GPIO_IN = 1
 
int GPIO_LO = 0
 
int GPIO_HI = 1
 
bool INVERT = True
 
bool NO_INVERT = False
 
int NUM_GPIO = 8
 

Detailed Description

QwiicGPIO.

Parameters
addressThe I2C address to use for the device. If not provided, the default address is used.
i2c_driverAn existing i2c driver object. If not provided a driver object is created.
Returns
Object The GPIO device object.

Constructor & Destructor Documentation

◆ __init__()

def qwiic_gpio.QwiicGPIO.__init__ (   self,
  address = None,
  i2c_driver = None 
)

Member Function Documentation

◆ begin()

def qwiic_gpio.QwiicGPIO.begin (   self)

Initialize the operation of the Qwiic GPIO.

Returns
bool Returns true of the initializtion was successful, otherwise False.

◆ digitalRead()

def qwiic_gpio.QwiicGPIO.digitalRead (   self,
  pin 
)

Get the input value of a single pin.

Parameters
pinThe pin number to get the input value of.
Returns
bool The value of the pin.

◆ digitalReadPort()

def qwiic_gpio.QwiicGPIO.digitalReadPort (   self)

Get the input value of all pins.

Returns
A list of boolean input values of all pins.

◆ digitalWrite()

def qwiic_gpio.QwiicGPIO.digitalWrite (   self,
  pin,
  value 
)

Set the output value of a single pin.

Parameters
pinThe pin number to set the output value of.
valueThe value to set the pin to.
Returns
No return value

◆ digitalWritePort()

def qwiic_gpio.QwiicGPIO.digitalWritePort (   self,
  gpioOutputList 
)

Set the output value of a list of pins.

Parameters
gpioOutputListA list of boolean output values to set the pins at each index to.
Returns
No return value

◆ getGPIO()

def qwiic_gpio.QwiicGPIO.getGPIO (   self)

Updates mode_X variables with values from Qwiic GPIO.

Returns
8 bit unsigned integer The value of the mode register.

◆ getInversion()

def qwiic_gpio.QwiicGPIO.getInversion (   self)

Updates inversion_X variables with values from Qwiic GPIO.

Returns
8 bit unsigned integer The value of the inversion register.

◆ getMode()

def qwiic_gpio.QwiicGPIO.getMode (   self)

Updates mode_X variables with values from Qwiic GPIO.

Returns
8 bit unsigned integer The value of the mode register.

◆ invertPin()

def qwiic_gpio.QwiicGPIO.invertPin (   self,
  pin,
  invert 
)

Set the inversion of a single pin.

Parameters
pinThe pin number to set the inversion of.
invertThe inversion to set the pin to.
Returns
No return value

◆ invertPinPort()

def qwiic_gpio.QwiicGPIO.invertPinPort (   self,
  gpioInversionList 
)

Set the inversion of a list of pins.

Parameters
gpioInversionListA list of boolean inversions to set the pins at each index to.
Returns
No return value

◆ isConnected()

def qwiic_gpio.QwiicGPIO.isConnected (   self)

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

Returns
bool True if the device is connected, otherwise False.

◆ pinMode()

def qwiic_gpio.QwiicGPIO.pinMode (   self,
  pin,
  mode 
)

Set the mode of a single pin.

Parameters
pinThe pin number to set the mode of.
modeThe mode to set the pin to.
Returns
No return value

◆ pinModePort()

def qwiic_gpio.QwiicGPIO.pinModePort (   self,
  gpioPinModeList 
)

Set the mode of a list of pins.

Parameters
gpioPinModeListA list of boolean modes to set the pins at each index to.
Returns
No return value

◆ setGPIO()

def qwiic_gpio.QwiicGPIO.setGPIO (   self)

Send all current output settings to the GPIO.

This should be called after calling myGPIO.out_statuses[0] = myGPIO.GPIO_HI to set the GPIO.

Returns
No return value

◆ setInversion()

def qwiic_gpio.QwiicGPIO.setInversion (   self)

Send the inversion modes of all pins.

This function must be called after editing modes using myGPIO.inversions[0] = myGPIO.INVERT

Returns
No return value

◆ setMode()

def qwiic_gpio.QwiicGPIO.setMode (   self)

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.modes[0] = myGPIO.GPIO_OUT

Returns
No return value

Member Data Documentation

◆ address

qwiic_gpio.QwiicGPIO.address

◆ available_addresses

qwiic_gpio.QwiicGPIO.available_addresses = _AVAILABLE_I2C_ADDRESS
static

◆ device_name

qwiic_gpio.QwiicGPIO.device_name = _DEFAULT_NAME
static

◆ GPIO_HI

int qwiic_gpio.QwiicGPIO.GPIO_HI = 1
static

◆ GPIO_IN

int qwiic_gpio.QwiicGPIO.GPIO_IN = 1
static

◆ GPIO_LO

int qwiic_gpio.QwiicGPIO.GPIO_LO = 0
static

◆ GPIO_OUT

int qwiic_gpio.QwiicGPIO.GPIO_OUT = 0
static

◆ in_statuses

qwiic_gpio.QwiicGPIO.in_statuses

◆ inversions

qwiic_gpio.QwiicGPIO.inversions

◆ INVERT

bool qwiic_gpio.QwiicGPIO.INVERT = True
static

◆ modes

qwiic_gpio.QwiicGPIO.modes

◆ NO_INVERT

bool qwiic_gpio.QwiicGPIO.NO_INVERT = False
static

◆ NUM_GPIO

int qwiic_gpio.QwiicGPIO.NUM_GPIO = 8
static

◆ out_statuses

qwiic_gpio.QwiicGPIO.out_statuses

◆ REG_CONFIGURATION

int qwiic_gpio.QwiicGPIO.REG_CONFIGURATION = 0x03
static

◆ REG_INPUT_PORT

int qwiic_gpio.QwiicGPIO.REG_INPUT_PORT = 0x00
static

◆ REG_INVERSION

int qwiic_gpio.QwiicGPIO.REG_INVERSION = 0x02
static

◆ REG_OUTPUT_PORT

int qwiic_gpio.QwiicGPIO.REG_OUTPUT_PORT = 0x01
static

The documentation for this class was generated from the following file: