1.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 |
---|---|
void GPIO_Initialize(void) | Initialize the GPIO library |
void GPIO_PinDirConfig(GPIO_PIN pin, GPIO_DIR dir) | Sets the direction of the given GPIO Pin |
void GPIO_PinInputEnable(GPIO_PIN pin) | |
void GPIO_PinInputDisable(GPIO_PIN pin) | Disables the input mode of the given GPIO Pin |
void GPIO_PinInputConfig(GPIO_PIN pin, GPIO_INP_READ inpEn) | Enables or disables input on the given GPIO pin |
void GPIO_PinGroupOutputEnable(GPIO_PIN pin) | Enables the group output of the given GPIO pin |
void GPIO_PinGroupOutputDisable(GPIO_PIN pin) | Disables the group output of the given GPIO pin |
void GPIO_PinGroupOutputConfig(GPIO_PIN pin, GPIO_ALT_OUT altOutputEn) | Either enables or disables control of the GPIO pin using the Group output register |
void GPIO_PinSet(GPIO_PIN pin) | Sets the selected pin |
void GPIO_PinClear(GPIO_PIN pin) | Clears the selected pin |
void GPIO_PinToggle(GPIO_PIN pin) | Toggles the selected pin |
uint8_t GPIO_PinRead(GPIO_PIN pin) | Read the selected pin value |
void GPIO_GroupSet(GPIO_GROUP group, uint32_t mask) | Sets the value in the given Group output register |
void GPIO_GroupClear(GPIO_GROUP group, uint32_t mask) | Clears the value in the given Group output register |
void GPIO_GroupToggle(GPIO_GROUP group, uint32_t mask) | Toggles the value in the given Group output register |
uint32_t GPIO_GroupRead(GPIO_GROUP group, uint32_t mask) | Returns the state of the pins in the given GPIO group |
void GPIO_GroupPinSet(GPIO_PIN pin) | Sets the value of the given pin in the Group output register |
void GPIO_GroupPinClear(GPIO_PIN pin) | Clears the value of the given pin in the Group output register |
void GPIO_GroupPinToggle(GPIO_PIN pin) | Toggles the value of the given pin in the Group output register |
uint32_t GPIO_GroupPinRead(GPIO_PIN pin) | Returns the value of the given pin by reading it from the Group GPIO input register |
void GPIO_PinMUXConfig(GPIO_PIN pin, GPIO_FUNCTION function) | Configures the signal function on the given pin |
void GPIO_PinPolarityConfig(GPIO_PIN pin, GPIO_POLARITY polarity) | Configures the polarity of the given GPIO pin |
void GPIO_PinOuputBufferTypeConfig(GPIO_PIN pin, GPIO_OUTPUT_BUFFER_TYPE bufferType) | Configures the buffer type of the given GPIO pin |
void GPIO_PinPullUpPullDownConfig(GPIO_PIN pin, GPIO_PULL_TYPE pullType) | Configures the pull type on the given GPIO pin |
void GPIO_PinSlewRateConfig(GPIO_PIN pin, GPIO_SLEW_RATE slewRate) | Configures the slew rate on the given GPIO pin |
void GPIO_PinIntDetectConfig(GPIO_PIN pin, GPIO_INTDET_TYPE intDet) | Configures the event that generates interrupt on the GPIO pin |
void GPIO_PinPwrGateConfig(GPIO_PIN pin, GPIO_PWRGATE pwrGate) | Configures the power well to use for the given GPIO pin |
void GPIO_DrvStrConfig(GPIO_PIN pin, GPIO_DRV drvStrn) | Configures the drive strength on the given GPIO pin |
void GPIO_PropertySet( GPIO_PIN pin, GPIO_PROPERTY gpioProp, const uint32_t propMask ) | Configures various parameters of the given GPIO pin |
Data types and constants
Name | Type | Description |
---|---|---|
GPIO_ALT_OUT | Enum | This enum is used to to specify whether to enable alternate output for a GPIO pin |
GPIO_DIR | Enum | This enum is used to to specify the GPIO pin direction |
GPIO_DRV | Enum | This enum is used to to specify the pin drive strength |
GPIO_FUNCTION | Enum | This enum is used to 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 to specify the interrupt detect event type |
GPIO_OUTPUT_BUFFER_TYPE | Enum | This enum is used to to specify the pin output buffre type |
GPIO_POLARITY | Enum | This enum is used to to specify the pin polarity |
GPIO_PROPERTY | Enum | This enum is used to to specify the property of the pin to set |
GPIO_PULL_TYPE | Enum | This enum is used to to specify the pin pull type |
GPIO_PWRGATE | Enum | This enum is used to to specify the power well for the pin |
GPIO_SLEW_RATE | Enum | his enum is used to 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 |