3.1.4 General Purpose I/O (GPIO)

The GPIO Interface provides general purpose input monitoring and output control, as well as managing many aspects of pin functionality; including, multi-function Pin Multiplexing Control, GPIO Direction control, PU/PD (PU_PD) resistors and synchronous Interrupt Detection (int_det), GPIO Direction, and Polarity control, as well as control of pin drive strength and slew rate.

Features of the GPIO Interface include:

  • Inputs:

    • Asynchronous rising and falling edge detection

    • Interrupt High or Low Level

  • On Output:

    • Push Pull or Open Drain output

  • Pull up or pull down resistor control

  • Interrupt capability available for all GPIOs

  • Programmable pin drive strength and slew rate limiting

  • Group or individual control of GPIO data.

  • Multiplexing of all multi-function pins are controlled by the GPIO interface

Library Interface

General Purpose I/O peripheral library provides the following interfaces:

Functions

NameDescription
GPIO_InitializeInitialize the GPIO library
GPIO_PinDirConfigSets the direction of the given GPIO Pin
GPIO_PinInputEnableEnables the input mode of the given GPIO Pin
GPIO_PinInputDisableDisables the input mode of the given GPIO Pin
GPIO_PinInputConfigEnables or disables input on the given GPIO pin
GPIO_PinGroupOutputEnableEnables the group output of the given GPIO pin
GPIO_PinGroupOutputDisableDisables the group output of the given GPIO pin
GPIO_PinGroupOutputConfigEither enables or disables control of the GPIO pin using the Group output register
GPIO_PinSetSets the selected pin
GPIO_PinClearClears the selected pin
GPIO_PinToggleToggles the selected pin
GPIO_PinReadRead the selected pin value
GPIO_GroupSetSets the value in the given Group output register
GPIO_GroupClearClears the value in the given Group output register
GPIO_GroupToggleToggles the value in the given Group output register
GPIO_GroupReadReturns the state of the pins in the given GPIO group
GPIO_GroupPinSetSets the value of the given pin in the Group output register
GPIO_GroupPinClearClears the value of the given pin in the Group output register
GPIO_GroupPinToggleToggles the value of the given pin in the Group output register
GPIO_GroupPinReadReturns the value of the given pin by reading it from the Group GPIO input register
vGPIO_PinMUXConfigConfigures the signal function on the given pin
GPIO_PinPolarityConfigConfigures the polarity of the given GPIO pin
GPIO_PinOuputBufferTypeConfigConfigures the buffer type of the given GPIO pin
GPIO_PinPullUpPullDownConfigConfigures the pull type on the given GPIO pin
GPIO_PinSlewRateConfigConfigures the slew rate on the given GPIO pin
GPIO_PinIntDetectConfigConfigures the event that generates interrupt on the GPIO pin
GPIO_PinPwrGateConfigConfigures the power well to use for the given GPIO pin
GPIO_DrvStrConfigConfigures the drive strength on the given GPIO pin
GPIO_PropertySetConfigures various parameters of the given GPIO pin

Data types and constants

NameTypeDescription
GPIO_ALT_OUTEnumThis enum is used to specify whether to enable alternate output for a GPIO pin
GPIO_DIREnumThis enum is used to specify the GPIO pin direction
GPIO_DRVEnumThis enum is used to specify the pin drive strength
GPIO_FUNCTIONEnumThis enum is used to specify the GPIO pin function
GPIO_GROUPEnumIdentifies the available GPIO groups
GPIO_INP_READEnumThis enum is used to enable or disable input for a pin
GPIO_INTDET_TYPEEnumThis enum is used to specify the interrupt detect event type
GPIO_OUTPUT_BUFFER_TYPEEnumThis enum is used to specify the pin output buffer type
GPIO_POLARITYEnumThis enum is used to specify the pin polarity
GPIO_PROPERTYEnumThis enum is used to specify the property of the pin to set
GPIO_PULL_TYPEEnumThis enum is used to specify the pin pull type
GPIO_PWRGATEEnumThis enum is used to specify the power well for the pin
GPIO_SLEW_RATEEnumhis enum is used to specify the pin slew rate type
GPIO_PINEnumIdentifies the available GPIO pins
GPIO_PIN_CALLBACKTypedefPointer to a GPIO Pin-Event handler function