gpio: xgpio_example.c File Reference

| gpio Xilinx SDK Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
xgpio_example.c File Reference

## Overview

This file contains a design example using the AXI GPIO driver (XGpio) and hardware device.

It only uses channel 1 of a GPIO device and assumes that the bit 0 of the GPIO is connected to the LED on the HW board.

    MODIFICATION HISTORY:

    Ver   Who  Date     Changes

    1.00a rmm  03/13/02 First release
    1.00a rpm  08/04/03 Removed second example and invalid macro calls
    2.00a jhl  12/15/03 Added support for dual channels
    2.00a sv   04/20/05 Minor changes to comply to Doxygen and coding guidelines
    3.00a ktn  11/20/09 Minor changes as per coding guidelines.
    4.1   lks  11/18/15 Updated to use canonical xparameters and
                  clean up of the comments and code for CR 900381
    4.3   sk   09/29/16 Modified the example to make it work when LED_bits are
                        configured as an output. CR# 958644
          ms   01/23/17 Added xil_printf statement in main function to
                        ensure that "Successfully ran" and "Failed" strings
                        are available in all examples. This is a fix for
                        CR-965028.
    4.5  sne   06/12/19 Fixed IAR compiler warning.

## Functions
int | main (void)
| The purpose of this function is to illustrate how to use the GPIO driver to turn on and off an LED. More...

## Function Documentation

int main | ( | void |  | ) |

The purpose of this function is to illustrate how to use the GPIO driver to turn on and off an LED.

Parameters

  None |

Returns
  XST_FAILURE to indicate that the GPIO Initialization had failed.

Note
  This function will not return if the test is running.

References XGpio_DiscreteClear(), XGpio_DiscreteWrite(), XGpio_Initialize(), and XGpio_SetDataDirection().