GPIO API Reference. More...
|
Defines | |
| #define | GPIOSPinFunctionSet(ulFunction, eShortPin) |
| #define | GPIOSPinIntEnable(eShortPin, ulIntType) |
| #define | xGPIOSDirModeSet(eShortPin, ulPinIO) |
| #define | GPIOSPinIntDisable(eShortPin) |
| #define | GPIOSPinIntClear(eShortPin) |
| #define | GPIOSPinRead(eShortPin) |
| #define | GPIOSPinWrite(eShortPin, ucVal) |
| #define | GPIOSPinToPeripheralId(eShortPin) |
| #define | GPIOSPinToPort(eShortPin) |
| #define | GPIOSPinToPortPin(eShortPin) |
| #define | GPIOSPinToPin(eShortPin) |
| #define | GPIOSPinConfigure(ePeripheralPin, eShortPin) |
Functions | |
| void | GPIODirModeSet (unsigned long ulPort, unsigned long ulBit, unsigned long ulPinIO) |
| Sets the direction and mode of the specified pin. | |
| unsigned long | GPIODirModeGet (unsigned long ulPort, unsigned long ulBit) |
| void | GPIOPinIntEnable (unsigned long ulPort, unsigned long ulPins, unsigned long ulIntType) |
| Sets the interrupt type and Enables interrupts for the specified pin(s). | |
| void | GPIOPinIntDisable (unsigned long ulPort, unsigned long ulPins) |
| Disables interrupts for the specified pin(s). | |
| void | GPIOPinIntCallbackInit (unsigned long ulPort, unsigned long ulPin, xtEventCallback xtPortCallback) |
| Init interrupts callback for the specified Port. | |
| unsigned long | GPIOPinIntStatus (unsigned long ulPort) |
| Gets interrupt status for the specified GPIO port. | |
| void | GPIOPinIntClear (unsigned long ulPort, unsigned long ulPins) |
| Clears the interrupt for the specified pin(s). | |
| long | GPIOPinRead (unsigned long ulPort, unsigned long ulPins) |
| Reads the values present of the specified pin(s). | |
| void | GPIOPinWrite (unsigned long ulPort, unsigned long ulPins, unsigned char ucVal) |
| Writes a value to the specified pin(s). | |
| void | GPIOPinDebounceEnable (unsigned long ulPort, unsigned long ulPins) |
| Enable the debounce function of the specified GPIO pin(s). | |
| void | GPIOPinDebounceDisable (unsigned long ulPort, unsigned long ulPins) |
| Disable the debounce function of the specified GPIO pin(s). | |
| void | GPIOPinMaskSet (unsigned long ulPort, unsigned long ulPins) |
| Set GPIO port mask register of the specified GPIO pin(s). | |
| void | GPIODebounceTimeSet (unsigned long ulClockSource, unsigned long ulDebounceClk) |
| Set the De-bounce sampling cycle. | |
| long | GPIODebounceTimeGet (void) |
| Get the De-bounce sampling cycle. | |
| long | GPIOPortMaskGet (unsigned long ulPort) |
| Get current GPIO port mask setting. | |
| long | GPIOPinPortDoutGet (unsigned long ulPort) |
| Gets output data for the specified GPIO port. | |
| void | GPIOPinFunctionSet (unsigned long ulFunction, unsigned long ulPort, unsigned long ulPins) |
| Initialize the multi-function pin's specified fucntion. | |
| void | GPIOPinConfigure (unsigned long ulPinConfig) |
| Configures the alternate function of a GPIO pin. | |
| unsigned long | GPIOPinToPeripheralId (unsigned long ulPort, unsigned long ulPin) |
| Get the GPIO Peripheral Id from a short Pin. | |
| unsigned long | GPIOPinToPort (unsigned long ulPort, unsigned long ulPin) |
| Get the GPIO port from a short Pin. | |
| unsigned long | GPIOPinToPin (unsigned long ulPort, unsigned long ulPin) |
| Get the GPIO pin number from a short Pin. | |
GPIO API Reference.
| void GPIODirModeSet | ( | unsigned long | ulPort, |
| unsigned long | ulBit, | ||
| unsigned long | ulPinIO | ||
| ) |
Sets the direction and mode of the specified pin.
| ulPort | is the base address of the GPIO port |
| ulBit | is the bit number of a port. |
| ulPinIO | is the pin direction and/or mode. |
This function will set the specified pin(Only 1 pin) on the selected GPIO port as either an input or output under software control, or it will set the pin to be under hardware control.
The parameter ulPinIO is an enumerated data type that can be one of the following values:
where GPIO_DIR_MODE_IN specifies that the pin will be programmed as a software controlled input, GPIO_DIR_MODE_OUT specifies that the pin will be programmed as a software controlled output,GPIO_DIR_MODE_OD specifies that the pin will be programmed as a Open-Drain.GPIO_DIR_MODE_QB specifies that the pin will be programmed as Quasi-bidirectional.
Definition at line 482 of file xgpio.c.
References GPIO_PMD, GPIO_PMD_PMD0_M, xASSERT, xGPIO_DIR_MODE_IN, xGPIO_DIR_MODE_OD, xGPIO_DIR_MODE_OUT, xGPIO_DIR_MODE_QB, and xHWREG.
Referenced by xGPIODirModeSet().
| unsigned long GPIODirModeGet | ( | unsigned long | ulPort, |
| unsigned long | ulBit | ||
| ) |
Gets the direction and mode of a pin.
| ulPort | is the base address of the GPIO port. |
| ucBit | is the pin number. |
This function gets the direction and control mode for a specified pin on the selected GPIO port. The pin can be configured as either an input or output under software control, or it can be under hardware control. The type of control and direction are returned as an enumerated data type.
| void GPIOPinIntEnable | ( | unsigned long | ulPort, |
| unsigned long | ulPins, | ||
| unsigned long | ulIntType | ||
| ) |
Sets the interrupt type and Enables interrupts for the specified pin(s).
| ulPort | is the base address of the GPIO port. |
| ulPins | is the bit-packed representation of the pin(s). |
| ulIntType | specifies the type of interrupt trigger mechanism. |
This function sets up the various interrupt trigger mechanisms for the specified pin(s) on the selected GPIO port.
The parameter ulIntType is an enumerated data type that can be one of the following values:
where the different values describe the interrupt detection mechanism (edge or level) and the particular triggering event (falling, rising, or both edges for edge detect, low or high for level detect).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
Definition at line 610 of file xgpio.c.
References GPIO_BOTH_EDGES, GPIO_FALLING_EDGE, GPIO_HIGH_LEVEL, GPIO_IEN, GPIO_IMD, GPIO_LOW_LEVEL, GPIO_RISING_EDGE, xASSERT, and xHWREG.
| void GPIOPinIntDisable | ( | unsigned long | ulPort, |
| unsigned long | ulPins | ||
| ) |
Disables interrupts for the specified pin(s).
| ulPort | is the base address of the GPIO port. |
| ulPins | is the bit-packed representation of the pin(s). |
Masks the interrupt for the specified pin(s).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
| void GPIOPinIntCallbackInit | ( | unsigned long | ulPort, |
| unsigned long | ulPin, | ||
| xtEventCallback | xtPortCallback | ||
| ) |
Init interrupts callback for the specified Port.
| ulPort | is the base address of the GPIO port. |
| ulPin | is the bit-packed representation of the pin. |
| xtPortCallback | is callback for the specified Port. |
Init interrupts callback for the specified Port.
Definition at line 680 of file xgpio.c.
References tGPIOPinIntAsssign::pfnGPIOPinHandlerCallback, tGPIOPinIntAsssign::ulpinID, xASSERT, and xGPIO_INT_NUMBER.
| unsigned long GPIOPinIntStatus | ( | unsigned long | ulPort | ) |
Gets interrupt status for the specified GPIO port.
| ulPort | is the base address of the GPIO port. |
| bMasked | specifies whether masked or raw interrupt status is returned. |
| void GPIOPinIntClear | ( | unsigned long | ulPort, |
| unsigned long | ulPins | ||
| ) |
Clears the interrupt for the specified pin(s).
| ulPort | is the base address of the GPIO port. |
| ulPins | is the bit-packed representation of the pin(s). |
Clears the interrupt for the specified pin(s).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
| long GPIOPinRead | ( | unsigned long | ulPort, |
| unsigned long | ulPins | ||
| ) |
Reads the values present of the specified pin(s).
| ulPort | is the base address of the GPIO port. |
| ulPins | is the bit-packed representation of the pin(s). |
The values at the specified pin(s) are read, as specified by ucPins. Values are returned for both input and output pin(s), and the value for pin(s) that are not specified by ucPins are set to 0.
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
| void GPIOPinWrite | ( | unsigned long | ulPort, |
| unsigned long | ulPins, | ||
| unsigned char | ucVal | ||
| ) |
Writes a value to the specified pin(s).
| ulPort | is the base address of the GPIO port. |
| ulPins | is the bit-packed representation of the pin(s). |
| ucVal | is the value to write to the pin(s). |
Writes the corresponding bit values to the output pin(s) specified by ucPins. Writing to a pin configured as an input pin has no effect.
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
| void GPIOPinDebounceEnable | ( | unsigned long | ulPort, |
| unsigned long | ulPins | ||
| ) |
Enable the debounce function of the specified GPIO pin(s).
| ulPort | is the base address of the GPIO port. |
| ulPins | is the bit-packed representation of the pin(s). |
Enable the corresponding bit debounce function to pin(s) specified by ucPins.
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
| void GPIOPinDebounceDisable | ( | unsigned long | ulPort, |
| unsigned long | ulPins | ||
| ) |
Disable the debounce function of the specified GPIO pin(s).
| ulPort | is the base address of the GPIO port. |
| ulPins | is the bit-packed representation of the pin(s). |
Disable the corresponding bit debounce function to pin(s) specified by ucPins.
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
| void GPIOPinMaskSet | ( | unsigned long | ulPort, |
| unsigned long | ulPins | ||
| ) |
Set GPIO port mask register of the specified GPIO pin(s).
| ulPort | is the base address of the GPIO port. |
| ulPins | is the bit-packed representation of the pin(s). |
Set GPIO port mask register of the specified GPIO pin(s) specified by ucPins.
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
Definition at line 936 of file xgpio.c.
References GPIO_DMASK, and xHWREG.
| void GPIODebounceTimeSet | ( | unsigned long | ulClockSource, |
| unsigned long | ulDebounceClk | ||
| ) |
Set the De-bounce sampling cycle.
| ulClockSource | is the De-bounce sampling clock source. |
| ulDebounceClk | is the De-bounce sampling clock. |
Set the De-bounce sampling cycle.
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
Definition at line 967 of file xgpio.c.
References GPIO_DBCLKSRC_10K, GPIO_DBCLKSRC_HCLK, GPIO_DBNCECON, GPIO_DBNCECON_DBCLKSEL_M, GPIO_DBNCECON_DBCLKSRC, xASSERT, and xHWREG.
| long GPIODebounceTimeGet | ( | void | ) |
Get the De-bounce sampling cycle.
| None. |
Definition at line 996 of file xgpio.c.
References GPIO_DBNCECON, GPIO_DBNCECON_DBCLKSEL_M, and xHWREG.
| long GPIOPortMaskGet | ( | unsigned long | ulPort | ) |
Get current GPIO port mask setting.
| ulPort | is the base address of the GPIO port. |
Definition at line 1014 of file xgpio.c.
References GPIO_DBEN_DBEN_M, GPIO_DMASK, and xHWREG.
| long GPIOPinPortDoutGet | ( | unsigned long | ulPort | ) |
Gets output data for the specified GPIO port.
| ulPort | is the base address of the GPIO port. |
| void GPIOPinFunctionSet | ( | unsigned long | ulFunction, |
| unsigned long | ulPort, | ||
| unsigned long | ulPins | ||
| ) |
Initialize the multi-function pin's specified fucntion.
| \param | ulPort is the base address of the GPIO port. |
| ulPins | is the bit-packed representation of the pin(s). |
Initialize the multi-function pin's of the specified function.
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
Definition at line 1127 of file xgpio.c.
References GCR_GPAMFP, GCR_GPBMFP, GCR_GPCMFP, GCR_GPDMFP, GCR_GPEMFP, GPIO_FUNCTION_ACMP, GPIO_FUNCTION_ADC, GPIO_FUNCTION_CLKO, GPIO_FUNCTION_EBI, GPIO_FUNCTION_EXTINT, GPIO_FUNCTION_GPIO, GPIO_FUNCTION_I2C, GPIO_FUNCTION_PWM, GPIO_FUNCTION_SPI, GPIO_FUNCTION_TIM, GPIO_FUNCTION_UART, GPIO_PORTA_BASE, GPIO_PORTB_BASE, GPIO_PORTC_BASE, GPIO_PORTD_BASE, GPIO_PORTE_BASE, xASSERT, and xHWREG.
| void GPIOPinConfigure | ( | unsigned long | ulPinConfig | ) |
Configures the alternate function of a GPIO pin.
| ulPinConfig | is the pin configuration value, specified as only one of the GPIO_P??_??? 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).
| unsigned long GPIOPinToPeripheralId | ( | unsigned long | ulPort, |
| unsigned long | ulPin | ||
| ) |
Get the GPIO Peripheral Id from a short Pin.
| eShortPin | is the base address of the GPIO port |
Definition at line 336 of file xgpio.c.
References SYSCTL_PERIPH_GPIO, and xASSERT.
| unsigned long GPIOPinToPort | ( | unsigned long | ulPort, |
| unsigned long | ulPin | ||
| ) |