pynq.lib.axigpio Module¶
The pynq.lib.axigpio module is a driver for interacting with the Xilinx AXIGPIO IP Block. Each AXI GPIO IP instantiated in the fabric has at least one, and at most two channels.
-
class
pynq.lib.axigpio.
AxiGPIO
(description)[source]¶ Bases:
pynq.overlay.DefaultIP
Class for interacting with the AXI GPIO IP block.
This class exposes the two banks of GPIO as the channel1 and channel2 attributes. Each channel can have the direction and the number of wires specified.
The wires in the channel can be accessed from the channel using slice notation - all slices must have a stride of 1. Input wires can be read and output wires can be written to, toggled, or turned off or on. InOut channels combine the functionality of input and output channels. The tristate of the pin is determined by whether the pin was last read or written.
-
class
Channel
(parent, channel)[source]¶ Bases:
object
Class representing a single channel of the GPIO controller.
Wires are and bundles of wires can be accessed using array notation with the methods on the wires determined by the type of the channel:
input_channel[0].read() output_channel[1:3].on()
This class instantiated not used directly, instead accessed through the AxiGPIO classes attributes. This class exposes the wires connected to the channel as an array or elements. Slices of the array can be assigned simultaneously.
-
setdirection
(direction)[source]¶ Set the direction of the channel
Must be one of AxiGPIO.{Input, Output, InOut} or the string ‘in’, ‘out’, or ‘inout’
-
trimask
¶ Gets or sets the tri-state mask for an inout channel
-
-
class
InOut
(parent, start, stop)[source]¶ Bases:
pynq.lib.axigpio.Output
,pynq.lib.axigpio.Input
Class representing wires in an inout channel.
This class should be passed to setdirection to indicate the channel should be used for both input and output. It should not be used directly.
-
class
Input
(parent, start, stop)[source]¶ Bases:
object
Class representing wires in an input channel.
This class should be passed to setdirection to indicate the channel should be used for input only. It should not be used directly.
-
read
()[source]¶ Reads the value of all the wires in the slice
If there is more than one wire in the slice then the least significant bit of the return value corresponds to the wire with the lowest index.
-
-
class
Output
(parent, start, stop)[source]¶ Bases:
object
Class representing wires in an output channel.
This class should be passed to setdirection to indicate the channel should be used for output only. It should not be used directly.
-
bindto
= ['xilinx.com:ip:axi_gpio:2.0']¶
-
class