Functions | |
| static bool | GPIO_isPinValid (uint32_t pin) |
| static void | GPIO_setInterruptType (GPIO_ExternalIntNum extIntNum, GPIO_IntType intType) |
| static GPIO_IntType | GPIO_getInterruptType (GPIO_ExternalIntNum extIntNum) |
| static void | GPIO_enableInterrupt (GPIO_ExternalIntNum extIntNum) |
| static void | GPIO_disableInterrupt (GPIO_ExternalIntNum extIntNum) |
| static uint16_t | GPIO_getInterruptCounter (GPIO_ExternalIntNum extIntNum) |
| static uint32_t | GPIO_readPin (uint32_t pin) |
| static uint32_t | GPIO_readPinDataRegister (uint32_t pin) |
| static void | GPIO_writePin (uint32_t pin, uint32_t outVal) |
| static void | GPIO_togglePin (uint32_t pin) |
| static uint32_t | GPIO_readPortData (GPIO_Port port) |
| static uint32_t | GPIO_readPortDataRegister (GPIO_Port port) |
| static void | GPIO_writePortData (GPIO_Port port, uint32_t outVal) |
| static void | GPIO_setPortPins (GPIO_Port port, uint32_t pinMask) |
| static void | GPIO_clearPortPins (GPIO_Port port, uint32_t pinMask) |
| static void | GPIO_togglePortPins (GPIO_Port port, uint32_t pinMask) |
| static void | GPIO_lockPortConfig (GPIO_Port port, uint32_t pinMask) |
| static void | GPIO_unlockPortConfig (GPIO_Port port, uint32_t pinMask) |
| static void | GPIO_commitPortConfig (GPIO_Port port, uint32_t pinMask) |
| void | GPIO_setDirectionMode (uint32_t pin, GPIO_Direction pinIO) |
| GPIO_Direction | GPIO_getDirectionMode (uint32_t pin) |
| void | GPIO_setInterruptPin (uint32_t pin, GPIO_ExternalIntNum extIntNum) |
| void | GPIO_setPadConfig (uint32_t pin, uint32_t pinType) |
| uint32_t | GPIO_getPadConfig (uint32_t pin) |
| void | GPIO_setQualificationMode (uint32_t pin, GPIO_QualificationMode qualification) |
| GPIO_QualificationMode | GPIO_getQualificationMode (uint32_t pin) |
| void | GPIO_setQualificationPeriod (uint32_t pin, uint32_t divider) |
| void | GPIO_setControllerCore (uint32_t pin, GPIO_CoreSelect core) |
| void | GPIO_setAnalogMode (uint32_t pin, GPIO_AnalogMode mode) |
| void | GPIO_setPinConfig (uint32_t pinConfig) |
Enumerations | |
| enum | GPIO_Direction { GPIO_DIR_MODE_IN , GPIO_DIR_MODE_OUT } |
| enum | GPIO_IntType { GPIO_INT_TYPE_FALLING_EDGE = 0x00 , GPIO_INT_TYPE_RISING_EDGE = 0x04 , GPIO_INT_TYPE_BOTH_EDGES = 0x0C } |
| enum | GPIO_QualificationMode { GPIO_QUAL_SYNC , GPIO_QUAL_3SAMPLE , GPIO_QUAL_6SAMPLE , GPIO_QUAL_ASYNC } |
| enum | GPIO_AnalogMode { GPIO_ANALOG_DISABLED , GPIO_ANALOG_ENABLED } |
| Values that can be passed to GPIO_setAnalogMode() as the mode parameter. More... | |
| enum | GPIO_CoreSelect { GPIO_CORE_CPU1 , GPIO_CORE_CPU2 , GPIO_CORE_CPU3 } |
| enum | GPIO_Port { GPIO_PORT_A = 0 , GPIO_PORT_B = 1 , GPIO_PORT_C = 2 , GPIO_PORT_D = 3 , GPIO_PORT_E = 4 , GPIO_PORT_F = 5 , GPIO_PORT_G = 6 , GPIO_PORT_H = 7 } |
| enum | GPIO_ExternalIntNum { GPIO_INT_XINT1 = 0 , GPIO_INT_XINT2 = 2 , GPIO_INT_XINT3 = 4 , GPIO_INT_XINT4 = 6 , GPIO_INT_XINT5 = 8 } |
Macros | |
| #define | GPIO_CTRL_REGS_STEP ((GPIO_O_GPBCTRL - GPIO_O_GPACTRL) / 4U) |
| #define | GPIO_DATA_REGS_STEP ((GPIO_O_GPBDAT - GPIO_O_GPADAT) / 4U) |
| #define | GPIO_DATA_READ_REGS_STEP ((GPIO_O_GPBDAT_R - GPIO_O_GPADAT_R) / 4U) |
| #define | GPIO_GPxCTRL_INDEX (0U) |
| #define | GPIO_GPxQSEL_INDEX (1U) |
| #define | GPIO_GPxMUX_INDEX (3U) |
| #define | GPIO_GPxPUD_INDEX (6U) |
| #define | GPIO_GPxINV_INDEX (8U) |
| #define | GPIO_GPxODR_INDEX (9U) |
| #define | GPIO_GPxAMSEL_INDEX (10U) |
| #define | GPIO_GPxGMUX_INDEX (16U) |
| #define | GPIO_GPxCSEL_INDEX (20U) |
| #define | GPIO_GPxLOCK_INDEX (30U) |
| #define | GPIO_GPxCR_INDEX (31U) |
| #define | GPIO_GPxDAT_INDEX (0U) |
| #define | GPIO_GPxSET_INDEX (1U) |
| #define | GPIO_GPxCLEAR_INDEX (2U) |
| #define | GPIO_GPxTOGGLE_INDEX (3U) |
| #define | GPIO_GPxDIR_INDEX (4U) |
| #define | GPIO_GPxDAT_R_INDEX (0U) |
| #define | GPIO_MUX_TO_GMUX (GPIO_O_GPAGMUX1 - GPIO_O_GPAMUX1) |
| #define | GPIO_PIN_TYPE_STD 0x0000U |
| Push-pull output or floating input. | |
| #define | GPIO_PIN_TYPE_PULLUP 0x0001U |
| Pull-up enable for input. | |
| #define | GPIO_PIN_TYPE_INVERT 0x0002U |
| Invert polarity on input. | |
| #define | GPIO_PIN_TYPE_OD 0x0004U |
| Open-drain on output. | |
| #define GPIO_CTRL_REGS_STEP ((GPIO_O_GPBCTRL - GPIO_O_GPACTRL) / 4U) |
| #define GPIO_DATA_REGS_STEP ((GPIO_O_GPBDAT - GPIO_O_GPADAT) / 4U) |
| #define GPIO_DATA_READ_REGS_STEP ((GPIO_O_GPBDAT_R - GPIO_O_GPADAT_R) / 4U) |
| #define GPIO_GPxCTRL_INDEX (0U) |
| #define GPIO_GPxQSEL_INDEX (1U) |
| #define GPIO_GPxMUX_INDEX (3U) |
| #define GPIO_GPxPUD_INDEX (6U) |
| #define GPIO_GPxINV_INDEX (8U) |
| #define GPIO_GPxODR_INDEX (9U) |
| #define GPIO_GPxAMSEL_INDEX (10U) |
| #define GPIO_GPxGMUX_INDEX (16U) |
| #define GPIO_GPxCSEL_INDEX (20U) |
| #define GPIO_GPxLOCK_INDEX (30U) |
| #define GPIO_GPxCR_INDEX (31U) |
| #define GPIO_GPxDAT_INDEX (0U) |
| #define GPIO_GPxSET_INDEX (1U) |
| #define GPIO_GPxCLEAR_INDEX (2U) |
| #define GPIO_GPxTOGGLE_INDEX (3U) |
| #define GPIO_GPxDIR_INDEX (4U) |
| #define GPIO_GPxDAT_R_INDEX (0U) |
| #define GPIO_MUX_TO_GMUX (GPIO_O_GPAGMUX1 - GPIO_O_GPAMUX1) |
| #define GPIO_PIN_TYPE_STD 0x0000U |
Push-pull output or floating input.
| #define GPIO_PIN_TYPE_PULLUP 0x0001U |
Pull-up enable for input.
| #define GPIO_PIN_TYPE_INVERT 0x0002U |
Invert polarity on input.
| #define GPIO_PIN_TYPE_OD 0x0004U |
Open-drain on output.
| enum GPIO_Direction |
Values that can be passed to GPIO_setDirectionMode() as the pinIO parameter and returned from GPIO_getDirectionMode().
| Enumerator | |
|---|---|
| GPIO_DIR_MODE_IN | Pin is a GPIO input. |
| GPIO_DIR_MODE_OUT | Pin is a GPIO output. |
| enum GPIO_IntType |
Values that can be passed to GPIO_setInterruptType() as the intType parameter and returned from GPIO_getInterruptType().
| Enumerator | |
|---|---|
| GPIO_INT_TYPE_FALLING_EDGE | Interrupt on falling edge. |
| GPIO_INT_TYPE_RISING_EDGE | Interrupt on rising edge. |
| GPIO_INT_TYPE_BOTH_EDGES | Interrupt on both edges. |
Values that can be passed to GPIO_setQualificationMode() as the qualification parameter and returned by GPIO_getQualificationMode().
| Enumerator | |
|---|---|
| GPIO_QUAL_SYNC | Synchronization to SYSCLK. |
| GPIO_QUAL_3SAMPLE | Qualified with 3 samples. |
| GPIO_QUAL_6SAMPLE | Qualified with 6 samples. |
| GPIO_QUAL_ASYNC | No synchronization. |
| enum GPIO_AnalogMode |
Values that can be passed to GPIO_setAnalogMode() as the mode parameter.
| Enumerator | |
|---|---|
| GPIO_ANALOG_DISABLED | Pin is in digital mode. |
| GPIO_ANALOG_ENABLED | Pin is in analog mode. |
| enum GPIO_CoreSelect |
Values that can be passed to GPIO_setControllerCore() as the core parameter.
| Enumerator | |
|---|---|
| GPIO_CORE_CPU1 | CPU1 selected as controller core. |
| GPIO_CORE_CPU2 | CPU2 selected as controller core. |
| GPIO_CORE_CPU3 | CPU3 selected as controller core. |
| enum GPIO_Port |
Values that can be passed to GPIO_readPortData(), GPIO_setPortPins(), GPIO_clearPortPins(), and GPIO_togglePortPins() as the port parameter.
| enum GPIO_ExternalIntNum |
Values that can be passed to GPIO_setInterruptPin(), GPIO_setInterruptType(), GPIO_getInterruptType(), GPIO_enableInterrupt(), GPIO_disableInterrupt(), as the extIntNum parameter.
| Enumerator | |
|---|---|
| GPIO_INT_XINT1 | External Interrupt 1. |
| GPIO_INT_XINT2 | External Interrupt 2. |
| GPIO_INT_XINT3 | External Interrupt 3. |
| GPIO_INT_XINT4 | External Interrupt 4. |
| GPIO_INT_XINT5 | External Interrupt 5. |
|
inlinestatic |
|
inlinestatic |
Sets the interrupt type for the specified pin.
| extIntNum | specifies the external interrupt. |
| intType | specifies the type of interrupt trigger mechanism. |
This function sets up the various interrupt trigger mechanisms for the specified pin on the selected GPIO port.
The following defines can be used to specify the external interrupt for the extIntNum parameter:
One of the following flags can be used to define the intType parameter:
|
inlinestatic |
Gets the interrupt type for a pin.
| extIntNum | specifies the external interrupt. |
This function gets the interrupt type for a interrupt. The interrupt can be configured as a falling-edge, rising-edge, or both-edges detected interrupt.
The following defines can be used to specify the external interrupt for the extIntNum parameter:
|
inlinestatic |
Enables the specified external interrupt.
| extIntNum | specifies the external interrupt. |
This function enables the indicated external interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt. Disabled sources have no effect on the processor.
The following defines can be used to specify the external interrupt for the extIntNum parameter:
|
inlinestatic |
Disables the specified external interrupt.
| extIntNum | specifies the external interrupt. |
This function disables the indicated external interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt. Disabled sources have no effect on the processor.
The following defines can be used to specify the external interrupt for the extIntNum parameter:
|
inlinestatic |
Gets the value of the external interrupt counter.
| extIntNum | specifies the external interrupt. |
The following defines can be used to specify the external interrupt for the extIntNum parameter:
Note: The counter is clocked at the SYSCLKOUT rate.
|
inlinestatic |
Reads the value present on the specified pin.
| pin | is the identifying GPIO number of the pin. |
The value at the specified pin are read, as specified by pin. The value is returned for both input and output pins.
The pin is specified by its numerical value. For example, GPIO34 is specified by passing 34 as pin.
|
inlinestatic |
Reads the data register value for specified pin.
| pin | is the identifying GPIO number of the pin. |
The value available at the data register for the specified pin is read, as specified by pin. The value is returned for both input and output pins.
The pin is specified by its numerical value. For example, GPIO34 is specified by passing 34 as pin.
|
inlinestatic |
Writes a value to the specified pin.
| pin | is the identifying GPIO number of the pin. |
| outVal | is the value to write to the pin. |
Writes the corresponding bit values to the output pin specified by pin. Writing to a pin configured as an input pin has no effect.
The pin is specified by its numerical value. For example, GPIO34 is specified by passing 34 as pin.
|
inlinestatic |
Toggles the specified pin.
| pin | is the identifying GPIO number of the pin. |
Writes the corresponding bit values to the output pin specified by pin. Writing to a pin configured as an input pin has no effect.
The pin is specified by its numerical value. For example, GPIO34 is specified by passing 34 as pin.
|
inlinestatic |
Reads the data on the specified port.
| port | is the GPIO port being accessed in the form of GPIO_PORT_X where X is the port letter. |
|
inlinestatic |
Reads the data written in GPIO Data Register.
| port | is the GPIO port being accessed in the form of GPIO_PORT_X where X is the port letter. |
Reads the data written in GPIO Data Register for the specified port. In previous devices, read of GPIO data registers resulted in read of corresponding pins. The function GPIO_readPortData() returns the value on pin.
|
inlinestatic |
Writes a value to the specified port.
| port | is the GPIO port being accessed. |
| outVal | is the value to write to the port. |
This function writes the value outVal to the port specified by the port parameter which takes a value in the form of GPIO_PORT_X where X is the port letter. For example, use GPIO_PORT_A to affect port A (GPIOs 0-31).
The outVal is a bit-packed value, where each bit represents a bit on a GPIO port. Bit 0 represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
inlinestatic |
Sets all of the specified pins on the specified port.
| port | is the GPIO port being accessed. |
| pinMask | is a mask of which of the 32 pins on the port are affected. |
This function sets all of the pins specified by the pinMask parameter on the port specified by the port parameter which takes a value in the form of GPIO_PORT_X where X is the port letter. For example, use GPIO_PORT_A to affect port A (GPIOs 0-31).
The pinMask is a bit-packed value, where each bit that is set identifies the pin to be set. Bit 0 represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
inlinestatic |
Clears all of the specified pins on the specified port.
| port | is the GPIO port being accessed. |
| pinMask | is a mask of which of the 32 pins on the port are affected. |
This function clears all of the pins specified by the pinMask parameter on the port specified by the port parameter which takes a value in the form of GPIO_PORT_X where X is the port letter. For example, use GPIO_PORT_A to affect port A (GPIOs 0-31).
The pinMask is a bit-packed value, where each bit that is set identifies the pin to be cleared. Bit 0 represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
inlinestatic |
Toggles all of the specified pins on the specified port.
| port | is the GPIO port being accessed. |
| pinMask | is a mask of which of the 32 pins on the port are affected. |
This function toggles all of the pins specified by the pinMask parameter on the port specified by the port parameter which takes a value in the form of GPIO_PORT_X where X is the port letter. For example, use GPIO_PORT_A to affect port A (GPIOs 0-31).
The pinMask is a bit-packed value, where each bit that is set identifies the pin to be toggled. Bit 0 represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
inlinestatic |
Locks the configuration of the specified pins on the specified port.
| port | is the GPIO port being accessed. |
| pinMask | is a mask of which of the 32 pins on the port are affected. |
This function locks the configuration registers of the pins specified by the pinMask parameter on the port specified by the port parameter which takes a value in the form of GPIO_PORT_X where X is the port letter. For example, use GPIO_PORT_A to affect port A (GPIOs 0-31).
The pinMask is a bit-packed value, where each bit that is set identifies the pin to be locked. Bit 0 represents GPIO port pin 0, bit 1 represents GPIO port pin 1, 0xFFFFFFFF represents all pins on that port, and so on.
Note that this function is for locking the configuration of a pin such as the pin muxing, direction, open drain mode, and other settings. It does not affect the ability to change the value of the pin.
|
inlinestatic |
Unlocks the configuration of the specified pins on the specified port.
| port | is the GPIO port being accessed. |
| pinMask | is a mask of which of the 32 pins on the port are affected. |
This function unlocks the configuration registers of the pins specified by the pinMask parameter on the port specified by the port parameter which takes a value in the form of GPIO_PORT_X where X is the port letter. For example, use GPIO_PORT_A to affect port A (GPIOs 0-31).
The pinMask is a bit-packed value, where each bit that is set identifies the pin to be unlocked. Bit 0 represents GPIO port pin 0, bit 1 represents GPIO port pin 1, 0xFFFFFFFF represents all pins on that port, and so on.
|
inlinestatic |
Commits the lock configuration of the specified pins on the specified port.
| port | is the GPIO port being accessed. |
| pinMask | is a mask of which of the 32 pins on the port are affected. |
This function commits the lock configuration registers of the pins specified by the pinMask parameter on the port specified by the port parameter which takes a value in the form of GPIO_PORT_X where X is the port letter. For example, use GPIO_PORT_A to affect port A (GPIOs 0-31).
The pinMask is a bit-packed value, where each bit that is set identifies the pin to be locked. Bit 0 represents GPIO port pin 0, bit 1 represents GPIO port pin 1, 0xFFFFFFFF represents all pins on that port, and so on.
Note that once this function is called, GPIO_lockPortConfig() and GPIO_unlockPortConfig() will no longer have any effect on the specified pins.
|
extern |
Sets the direction and mode of the specified pin.
| pin | is the identifying GPIO number of the pin. |
| pinIO | is the pin direction mode. |
This function configures the specified pin on the selected GPIO port as either input or output.
The parameter pinIO is an enumerated data type that can be one of the following values:
where GPIO_DIR_MODE_IN specifies that the pin is programmed as an input and GPIO_DIR_MODE_OUT specifies that the pin is programmed as an output.
The pin is specified by its numerical value. For example, GPIO34 is specified by passing 34 as pin.
|
extern |
Gets the direction mode of a pin.
| pin | is the identifying GPIO number of the pin. |
This function gets the direction mode for a specified pin. The pin can be configured as either an input or output The type of direction is returned as an enumerated data type.
|
extern |
Sets the pin for the specified external interrupt.
| pin | is the identifying GPIO number of the pin. |
| extIntNum | specifies the external interrupt. |
This function sets which pin triggers the selected external interrupt.
The following defines can be used to specify the external interrupt for the extIntNum parameter:
The pin is specified by its numerical value. For example, GPIO34 is specified by passing 34 as pin.
|
extern |
Sets the pad configuration for the specified pin.
| pin | is the identifying GPIO number of the pin. |
| pinType | specifies the pin type. |
This function sets the pin type for the specified pin. The parameter pinType can be the following values:
GPIO_PIN_TYPE_INVERT may be OR-ed with GPIO_PIN_TYPE_STD or GPIO_PIN_TYPE_PULLUP.
The pin is specified by its numerical value. For example, GPIO34 is specified by passing 34 as pin.
|
extern |
Gets the pad configuration for a pin.
| pin | is the identifying GPIO number of the pin. |
This function returns the pin type for the specified pin. The value returned corresponds to the values used in GPIO_setPadConfig().
|
extern |
Sets the qualification mode for the specified pin.
| pin | is the identifying GPIO number of the pin. |
| qualification | specifies the qualification mode of the pin. |
This function sets the qualification mode for the specified pin. The parameter qualification can be one of the following values:
To set the qualification sampling period, use GPIO_setQualificationPeriod().
|
extern |
Gets the qualification type for the specified pin.
| pin | is the identifying GPIO number of the pin. |
|
extern |
Sets the qualification period for a set of pins
| pin | is the identifying GPIO number of the pin. |
| divider | specifies the output drive strength. |
This function sets the qualification period for a set of 8 pins, specified by the pin parameter. For instance, passing in 3 as the value of pin will set the qualification period for GPIO0 through GPIO7, and a value of 98 will set the qualification period for GPIO96 through GPIO103. This is because the register field that configures the divider is shared.
To think of this in terms of an equation, configuring pin as n will configure GPIO (n & ~(7)) through GPIO ((n & ~(7)) + 7).
divider is the value by which the frequency of SYSCLKOUT is divided. It can be 1 or an even value between 2 and 510 inclusive.
|
extern |
Selects the controller core of a specified pin.
| pin | is the identifying GPIO number of the pin. |
| core | is the core that is controller of the specified pin. |
This function configures which core owns the specified pin's data registers (DATA, SET, CLEAR, and TOGGLE). The core parameter is an enumerated data type that specifies the core, such as GPIO_CORE_CPU1_CLA1 to make CPU1's CLA1 controller of the pin.
The pin is specified by its numerical value. For example, GPIO34 is specified by passing 34 as pin.
|
extern |
Sets the analog mode of the specified pin.
| pin | is the identifying GPIO number of the pin. |
| mode | is the selected analog mode. |
This function configures the specified pin for either analog or digital mode. Not all GPIO pins have the ability to be switched to analog mode, so refer to the technical reference manual for details. This setting should be thought of as another level of muxing.
The parameter mode is an enumerated data type that can be one of the following values:
The pin is specified by its numerical value. For example, GPIO34 is specified by passing 34 as pin.
|
extern |
Configures the alternate function of a GPIO pin.
| pinConfig | is the pin configuration value, specified as only one of the GPIO_::_???? values. |
This function configures the pin mux that selects the peripheral function associated with a particular GPIO pin. Only one peripheral function at a time can be associated with a GPIO pin, and each peripheral function should only be associated with a single GPIO pin at a time (despite the fact that many of them can be associated with more than one GPIO pin).
The available mappings are supplied in pin_map.h.