Thursday, May 28, 2015

Helpful functions used in c programs

The following steps must be performed in the software application to enable reading from the
GPIO: 1) Initialize the GPIO, 2) Set data direction, and 3) Read the data

XGpio_Initialize (XGpio *InstancePtr, u16 DeviceId)
InstancePtr is a pointer to an XGpio instance. The memory the pointer references must be preallocated
by the caller. Further calls to manipulate the component through the XGpio API must
be made with this pointer.
DeviceId is the unique id of the device controlled by this XGpio component. Passing in a device
id associates the generic XGpio instance to a specific device, as chosen by the caller or
application developer.
XGpio_SetDataDirection (XGpio * InstancePtr, unsigned Channel, u32 DirectionMask)
InstancePtr is a pointer to the XGpio instance to be worked on.
Channel contains the channel of the GPIO (1 or 2) to operate on.
DirectionMask is a bitmask specifying which discretes are input and which are output. Bits set to
0 are output and bits set to 1 are input.
XGpio_DiscreteRead(XGpio *InstancePtr, unsigned channel)
InstancePtr is a pointer to the XGpio instance to be worked on.
Channel contains the channel of the GPIO (1 or 2) to operate on

No comments:

Post a Comment