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
| Name | Description |
|---|---|
| GPIO_Initialize | Initialize the GPIO library |
| GPIO_PinDirConfig | Sets the direction of the given GPIO Pin |
| GPIO_PinInputEnable | Enables the input mode of the given GPIO Pin |
| GPIO_PinInputDisable | Disables the input mode of the given GPIO Pin |
| GPIO_PinInputConfig | Enables or disables input on the given GPIO pin |
| GPIO_PinGroupOutputEnable | Enables the group output of the given GPIO pin |
| GPIO_PinGroupOutputDisable | Disables the group output of the given GPIO pin |
| GPIO_PinGroupOutputConfig | Either enables or disables control of the GPIO pin using the Group output register |
| GPIO_PinSet | Sets the selected pin |
| GPIO_PinClear | Clears the selected pin |
| GPIO_PinToggle | Toggles the selected pin |
| GPIO_PinRead | Read the selected pin value |
| GPIO_GroupSet | Sets the value in the given Group output register |
| GPIO_GroupClear | Clears the value in the given Group output register |
| GPIO_GroupToggle | Toggles the value in the given Group output register |
| GPIO_GroupRead | Returns the state of the pins in the given GPIO group |
| GPIO_GroupPinSet | Sets the value of the given pin in the Group output register |
| GPIO_GroupPinClear | Clears the value of the given pin in the Group output register |
| GPIO_GroupPinToggle | Toggles the value of the given pin in the Group output register |
| GPIO_GroupPinRead | Returns the value of the given pin by reading it from the Group GPIO input register |
| vGPIO_PinMUXConfig | Configures the signal function on the given pin |
| GPIO_PinPolarityConfig | Configures the polarity of the given GPIO pin |
| GPIO_PinOuputBufferTypeConfig | Configures the buffer type of the given GPIO pin |
| GPIO_PinPullUpPullDownConfig | Configures the pull type on the given GPIO pin |
| GPIO_PinSlewRateConfig | Configures the slew rate on the given GPIO pin |
| GPIO_PinIntDetectConfig | Configures the event that generates interrupt on the GPIO pin |
| GPIO_PinPwrGateConfig | Configures the power well to use for the given GPIO pin |
| GPIO_DrvStrConfig | Configures the drive strength on the given GPIO pin |
| GPIO_PropertySet | Configures various parameters of the given GPIO pin |
Data types and constants
| Name | Type | Description |
|---|---|---|
| GPIO_ALT_OUT | Enum | This enum is used to specify whether to enable alternate output for a GPIO pin |
| GPIO_DIR | Enum | This enum is used to specify the GPIO pin direction |
| GPIO_DRV | Enum | This enum is used to specify the pin drive strength |
| GPIO_FUNCTION | Enum | This enum is used to specify the GPIO pin function |
| GPIO_GROUP | Enum | Identifies the available GPIO groups |
| GPIO_INP_READ | Enum | This enum is used to enable or disable input for a pin |
| GPIO_INTDET_TYPE | Enum | This enum is used to specify the interrupt detect event type |
| GPIO_OUTPUT_BUFFER_TYPE | Enum | This enum is used to specify the pin output buffer type |
| GPIO_POLARITY | Enum | This enum is used to specify the pin polarity |
| GPIO_PROPERTY | Enum | This enum is used to specify the property of the pin to set |
| GPIO_PULL_TYPE | Enum | This enum is used to specify the pin pull type |
| GPIO_PWRGATE | Enum | This enum is used to specify the power well for the pin |
| GPIO_SLEW_RATE | Enum | his enum is used to specify the pin slew rate type |
| GPIO_PIN | Enum | Identifies the available GPIO pins |
| GPIO_PIN_CALLBACK | Typedef | Pointer to a GPIO Pin-Event handler function |
