MSP432E4 DriverLib API Guide  1.11.00.03
Functions
Gpio_api

Functions

void GPIODirModeSet (uint32_t ui32Port, uint8_t ui8Pins, uint32_t ui32PinIO)
 
uint32_t GPIODirModeGet (uint32_t ui32Port, uint8_t ui8Pin)
 
void GPIOIntTypeSet (uint32_t ui32Port, uint8_t ui8Pins, uint32_t ui32IntType)
 
uint32_t GPIOIntTypeGet (uint32_t ui32Port, uint8_t ui8Pin)
 
void GPIOPadConfigSet (uint32_t ui32Port, uint8_t ui8Pins, uint32_t ui32Strength, uint32_t ui32PinType)
 
void GPIOPadConfigGet (uint32_t ui32Port, uint8_t ui8Pin, uint32_t *pui32Strength, uint32_t *pui32PinType)
 
void GPIOIntEnable (uint32_t ui32Port, uint32_t ui32IntFlags)
 
void GPIOIntDisable (uint32_t ui32Port, uint32_t ui32IntFlags)
 
uint32_t GPIOIntStatus (uint32_t ui32Port, bool bMasked)
 
void GPIOIntClear (uint32_t ui32Port, uint32_t ui32IntFlags)
 
void GPIOIntRegister (uint32_t ui32Port, void(*pfnIntHandler)(void))
 
void GPIOIntUnregister (uint32_t ui32Port)
 
void GPIOIntRegisterPin (uint32_t ui32Port, uint32_t ui32Pin, void(*pfnIntHandler)(void))
 
void GPIOIntUnregisterPin (uint32_t ui32Port, uint32_t ui32Pin)
 
int32_t GPIOPinRead (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinWrite (uint32_t ui32Port, uint8_t ui8Pins, uint8_t ui8Val)
 
void GPIOPinTypeADC (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeCAN (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeComparator (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeComparatorOutput (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeDIVSCLK (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeEPI (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeEthernetLED (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeEthernetMII (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeGPIOInput (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeGPIOOutput (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeGPIOOutputOD (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeHibernateRTCCLK (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeI2C (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeI2CSCL (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeLCD (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeOneWire (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypePWM (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeQEI (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeSSI (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeTimer (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeTrace (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeUART (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeUSBAnalog (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeUSBDigital (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeWakeHigh (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOPinTypeWakeLow (uint32_t ui32Port, uint8_t ui8Pins)
 
uint32_t GPIOPinWakeStatus (uint32_t ui32Port)
 
void GPIOPinConfigure (uint32_t ui32PinConfig)
 
void GPIODMATriggerEnable (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIODMATriggerDisable (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOADCTriggerEnable (uint32_t ui32Port, uint8_t ui8Pins)
 
void GPIOADCTriggerDisable (uint32_t ui32Port, uint8_t ui8Pins)
 

Detailed Description

Introduction

The GPIO module provides control for up to eight independent GPIO pins (the actual number present depend upon the GPIO port and part number). Each pin has the following capabilities:

Most of the GPIO functions can operate on more than one GPIO pin (within a single module) at a time. The ucPins parameter to these functions is used to specify the pins that are affected; only the GPIO pins corresponding to the bits in this parameter that are set are affected (where pin 0 is bit 0, pin 1 in bit 1, and so on). For example, if ucPins is 0x09, then pins 0 and 3 are affected by the function.

This protocol is most useful for the GPIOPinRead() and GPIOPinWrite() functions; a read returns only the values of the requested pins (with the other pin values masked out) and a write only affects the requested pins simultaneously (that is, the state of multiple GPIO pins can be changed at the same time). This data masking for the GPIO pin state occurs in the hardware; a single read or write is issued to the hardware, which interprets some of the address bits as an indication of the GPIO pins to operate on (and therefore the ones to not affect). See the part data sheet for details of the GPIO data register address-based bit masking.

For functions that have a ucPin (singular) parameter, only a single pin is affected by the function. In this case, the value specifies the pin number (that is, 0 through 7).

NOTE: A subset of GPIO pins on many MSP432E4 devices are protected by a locking mechanism to prevent inadvertent reconfiguration. The actual pins vary by device but typically include any pin that is part of the JTAG or SWD interface, and any pin which may be configured as an NMI input. On a TM4C129XNCZAD part, for example, this affects pins PC[3:0], PD7 and PE7. Locked pins may not be reconfigured without first unlocking them using the mechanism described under ``Commit Control'' in the GPIO chapter of your device's datasheet.

API Functions

The GPIO API is broken into three groups of functions: those that deal with configuring the GPIO pins, those that deal with interrupts, and those that access the pin value.

The GPIO pins are configured with GPIODirModeSet(), GPIOPadConfigSet(), and GPIOPinConfigure(). The configuration can be read back with GPIODirModeGet() and GPIOPadConfigGet().

The GPIO pin state is accessed with GPIOPinRead() and GPIOPinWrite().

The GPIO interrupts are handled with GPIOIntTypeSet(), GPIOIntTypeGet(), GPIOIntEnable(), GPIOIntDisable(), GPIOIntStatus(), GPIOIntClear(), GPIOIntRegister(), and GPIOIntUnregister().

GPIO Pin Configuration

Many of the GPIO pins on the TM4C123 and TM4C129 devices have other peripheral functions that can also use the GPIO pins for peripheral pins. The Peripheral Driver Library provides a set of convenience functions to configure the pins in the required or recommended input/output configuration for a particular peripheral; these are GPIOPinTypeADC(), GPIOPinTypeCAN(), GPIOPinTypeComparator(), GPIOPinTypeEPI(), GPIOPinTypeEthernetLED(), GPIOPinTypeEthernetMII(), GPIOPinTypeGPIOInput(), GPIOPinTypeGPIOOutput(), GPIOPinTypeGPIOOutputOD(), GPIOPinTypeI2C(), GPIOPinTypeI2CSCL(), GPIOPinTypeLCD() GPIOPinTypePWM(), GPIOPinTypeQEI(), GPIOPinTypeSSI(), GPIOPinTypeTimer(), GPIOPinTypeUART(), GPIOPinTypeUSBAnalog(), GPIOPinTypeUSBDigital(), GPIOPinTypeWakeHigh(), GPIOPinTypeWakeLow(), GPIOPinWakeStatus(), GPIODMATriggerEnable(), GPIODMATriggerDisable(), GPIOADCTriggerEnable(), and GPIOADCTriggerDisable(). In order to complete the pin configuration, the GPIOPinConfigure() function must also be called to enable the desired peripheral function on the given GPIO pin. The GPIOPinConfigure() function uses the pin definitions located in the driverlib/pin_map.h file. These definitions follow the GPIO_P<port><pin>_<peripheral_function> naming scheme. The available pin mappings are supplied on a per-device basis and are selected using the PART_<partno> defines to enable only the pin definitions that are valid for the given device. For example, on the TM4C129XNCZAD device the UART1 RX function can be enabled on one of two pins. The UART1 RX is found on GPIO port B pin 0(GPIO_PB0_U1RX) or it can also be found on GPIO port Q pin 4(GPIO_PQ4_U1RX). The application must define the PART_TM4C129XNCZAD in order to get the correct pin mappings for the TM4C129XNCZAD device.

Note
The PART_<partno> macros also control the mapping of interrupt names to interrupt numbers. See the Interrupt Mapping section of this document for more details on how these defines are used to determine interrupt mapping.

kA locked GPIO pin must be unlocked prior to making calls to GPIODirModeSet(), GPIOPadConfigSet() or any of the GPIOPinType functions.

Function Documentation

§ GPIODirModeSet()

void GPIODirModeSet ( uint32_t  ui32Port,
uint8_t  ui8Pins,
uint32_t  ui32PinIO 
)

Sets the direction and mode of the specified pin(s).

Parameters
ui32Portis the base address of the GPIO port
ui8Pinsis the bit-packed representation of the pin(s).
ui32PinIOis the pin direction and/or mode.

This function configures the specified pin(s) on the selected GPIO port as either input or output under software control, or it configures the pin to be under hardware control.

The parameter ui32PinIO is an enumerated data type that can be one of the following values:

  • GPIO_DIR_MODE_IN
  • GPIO_DIR_MODE_OUT
  • GPIO_DIR_MODE_HW

where GPIO_DIR_MODE_IN specifies that the pin is programmed as a software controlled input, GPIO_DIR_MODE_OUT specifies that the pin is programmed as a software controlled output, and GPIO_DIR_MODE_HW specifies that the pin is placed under hardware control.

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.

Note
GPIOPadConfigSet() must also be used to configure the corresponding pad(s) in order for them to propagate the signal to/from the GPIO.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_DIR_MODE_IN, GPIO_DIR_MODE_OUT, GPIO_O_AFSEL, GPIO_O_DIR, and HWREG.

Referenced by GPIOPinTypeADC(), GPIOPinTypeCAN(), GPIOPinTypeComparator(), GPIOPinTypeComparatorOutput(), GPIOPinTypeDIVSCLK(), GPIOPinTypeEPI(), GPIOPinTypeEthernetLED(), GPIOPinTypeEthernetMII(), GPIOPinTypeGPIOInput(), GPIOPinTypeGPIOOutput(), GPIOPinTypeGPIOOutputOD(), GPIOPinTypeHibernateRTCCLK(), GPIOPinTypeI2C(), GPIOPinTypeI2CSCL(), GPIOPinTypeLCD(), GPIOPinTypeOneWire(), GPIOPinTypePWM(), GPIOPinTypeQEI(), GPIOPinTypeSSI(), GPIOPinTypeTimer(), GPIOPinTypeTrace(), GPIOPinTypeUART(), GPIOPinTypeUSBAnalog(), GPIOPinTypeUSBDigital(), GPIOPinTypeWakeHigh(), and GPIOPinTypeWakeLow().

§ GPIODirModeGet()

uint32_t GPIODirModeGet ( uint32_t  ui32Port,
uint8_t  ui8Pin 
)

Gets the direction and mode of a pin.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinis 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.

Returns
Returns one of the enumerated data types described for GPIODirModeSet().

References ASSERT, GPIO_O_AFSEL, GPIO_O_DIR, and HWREG.

§ GPIOIntTypeSet()

void GPIOIntTypeSet ( uint32_t  ui32Port,
uint8_t  ui8Pins,
uint32_t  ui32IntType 
)

Sets the interrupt type for the specified pin(s).

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).
ui32IntTypespecifies 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.

One of the following flags can be used to define the ui32IntType parameter:

  • GPIO_FALLING_EDGE sets detection to edge and trigger to falling
  • GPIO_RISING_EDGE sets detection to edge and trigger to rising
  • GPIO_BOTH_EDGES sets detection to both edges
  • GPIO_LOW_LEVEL sets detection to low level
  • GPIO_HIGH_LEVEL sets detection to high level

In addition to the above flags, the following flag can be OR'd in to the ui32IntType parameter:

  • GPIO_DISCRETE_INT sets discrete interrupts for each pin on a GPIO port.

The GPIO_DISCRETE_INT is only available on ports P and Q.

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.

Note
In order to avoid any spurious interrupts, the user must ensure that the GPIO inputs remain stable for the duration of this function.
Returns
None.

References ASSERT, GPIO_BOTH_EDGES, GPIO_DISCRETE_INT, GPIO_FALLING_EDGE, GPIO_HIGH_LEVEL, GPIO_LOW_LEVEL, GPIO_O_IBE, GPIO_O_IEV, GPIO_O_IS, GPIO_O_SI, GPIO_RISING_EDGE, and HWREG.

§ GPIOIntTypeGet()

uint32_t GPIOIntTypeGet ( uint32_t  ui32Port,
uint8_t  ui8Pin 
)

Gets the interrupt type for a pin.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinis the pin number.

This function gets the interrupt type for a specified pin on the selected GPIO port. The pin can be configured as a falling-edge, rising-edge, or both-edges detected interrupt, or it can be configured as a low-level or high-level detected interrupt. The type of interrupt detection mechanism is returned and can include the GPIO_DISCRETE_INT flag.

Returns
Returns one of the flags described for GPIOIntTypeSet().

References ASSERT, GPIO_O_IBE, GPIO_O_IEV, GPIO_O_IS, GPIO_O_SI, and HWREG.

§ GPIOPadConfigSet()

void GPIOPadConfigSet ( uint32_t  ui32Port,
uint8_t  ui8Pins,
uint32_t  ui32Strength,
uint32_t  ui32PinType 
)

Sets the pad configuration for the specified pin(s).

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).
ui32Strengthspecifies the output drive strength.
ui32PinTypespecifies the pin type.

This function sets the drive strength and type for the specified pin(s) on the selected GPIO port. For pin(s) configured as input ports, the pad is configured as requested, but the only real effect on the input is the configuration of the pull-up or pull-down termination.

The parameter ui32Strength can be one of the following values:

  • GPIO_STRENGTH_2MA
  • GPIO_STRENGTH_4MA
  • GPIO_STRENGTH_8MA
  • GPIO_STRENGTH_8MA_SC
  • GPIO_STRENGTH_6MA
  • GPIO_STRENGTH_10MA
  • GPIO_STRENGTH_12MA

where GPIO_STRENGTH_xMA specifies either 2, 4, or 8 mA output drive strength, and GPIO_OUT_STRENGTH_8MA_SC specifies 8 mA output drive with slew control.

It can also support output drive strengths of 6, 10, and 12 mA.

The parameter ui32PinType can be one of the following values:

  • GPIO_PIN_TYPE_STD
  • GPIO_PIN_TYPE_STD_WPU
  • GPIO_PIN_TYPE_STD_WPD
  • GPIO_PIN_TYPE_OD
  • GPIO_PIN_TYPE_ANALOG
  • GPIO_PIN_TYPE_WAKE_HIGH
  • GPIO_PIN_TYPE_WAKE_LOW

where GPIO_PIN_TYPE_STD* specifies a push-pull pin, GPIO_PIN_TYPE_OD* specifies an open-drain pin, *_WPU specifies a weak pull-up, *_WPD specifies a weak pull-down, and GPIO_PIN_TYPE_ANALOG specifies an analog input.

The GPIO_PIN_TYPE_WAKE_* settings specify the pin to be used as a hibernation wake source. The pin sense level can be high or low.

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.

Note
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_O_AMSEL, GPIO_O_DEN, GPIO_O_DR12R, GPIO_O_DR2R, GPIO_O_DR4R, GPIO_O_DR8R, GPIO_O_ODR, GPIO_O_PC, GPIO_O_PDR, GPIO_O_PUR, GPIO_O_SLR, GPIO_O_WAKELVL, GPIO_O_WAKEPEN, GPIO_PIN_TYPE_ANALOG, GPIO_PIN_TYPE_OD, GPIO_PIN_TYPE_STD, GPIO_PIN_TYPE_STD_WPD, GPIO_PIN_TYPE_STD_WPU, GPIO_PIN_TYPE_WAKE_HIGH, GPIO_PIN_TYPE_WAKE_LOW, GPIO_STRENGTH_10MA, GPIO_STRENGTH_12MA, GPIO_STRENGTH_2MA, GPIO_STRENGTH_4MA, GPIO_STRENGTH_6MA, GPIO_STRENGTH_8MA, GPIO_STRENGTH_8MA_SC, and HWREG.

Referenced by GPIOPinTypeADC(), GPIOPinTypeCAN(), GPIOPinTypeComparator(), GPIOPinTypeComparatorOutput(), GPIOPinTypeDIVSCLK(), GPIOPinTypeEPI(), GPIOPinTypeEthernetLED(), GPIOPinTypeEthernetMII(), GPIOPinTypeGPIOInput(), GPIOPinTypeGPIOOutput(), GPIOPinTypeGPIOOutputOD(), GPIOPinTypeHibernateRTCCLK(), GPIOPinTypeI2C(), GPIOPinTypeI2CSCL(), GPIOPinTypeLCD(), GPIOPinTypeOneWire(), GPIOPinTypePWM(), GPIOPinTypeQEI(), GPIOPinTypeSSI(), GPIOPinTypeTimer(), GPIOPinTypeTrace(), GPIOPinTypeUART(), GPIOPinTypeUSBAnalog(), GPIOPinTypeUSBDigital(), GPIOPinTypeWakeHigh(), and GPIOPinTypeWakeLow().

§ GPIOPadConfigGet()

void GPIOPadConfigGet ( uint32_t  ui32Port,
uint8_t  ui8Pin,
uint32_t *  pui32Strength,
uint32_t *  pui32PinType 
)

Gets the pad configuration for a pin.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinis the pin number.
pui32Strengthis a pointer to storage for the output drive strength.
pui32PinTypeis a pointer to storage for the output drive type.

This function gets the pad configuration for a specified pin on the selected GPIO port. The values returned in pui32Strength and pui32PinType correspond to the values used in GPIOPadConfigSet(). This function also works for pin(s) configured as input pin(s); however, the only meaningful data returned is whether the pin is terminated with a pull-up or down resistor.

Returns
None

References ASSERT, GPIO_O_DEN, GPIO_O_DR12R, GPIO_O_DR2R, GPIO_O_DR4R, GPIO_O_DR8R, GPIO_O_ODR, GPIO_O_PC, GPIO_O_PDR, GPIO_O_PUR, GPIO_O_SLR, GPIO_O_WAKELVL, GPIO_O_WAKEPEN, and HWREG.

§ GPIOIntEnable()

void GPIOIntEnable ( uint32_t  ui32Port,
uint32_t  ui32IntFlags 
)

Enables the specified GPIO interrupts.

Parameters
ui32Portis the base address of the GPIO port.
ui32IntFlagsis the bit mask of the interrupt sources to enable.

This function enables the indicated GPIO interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

The ui32IntFlags parameter is the logical OR of any of the following:

  • GPIO_INT_PIN_0 - interrupt due to activity on Pin 0.
  • GPIO_INT_PIN_1 - interrupt due to activity on Pin 1.
  • GPIO_INT_PIN_2 - interrupt due to activity on Pin 2.
  • GPIO_INT_PIN_3 - interrupt due to activity on Pin 3.
  • GPIO_INT_PIN_4 - interrupt due to activity on Pin 4.
  • GPIO_INT_PIN_5 - interrupt due to activity on Pin 5.
  • GPIO_INT_PIN_6 - interrupt due to activity on Pin 6.
  • GPIO_INT_PIN_7 - interrupt due to activity on Pin 7.
  • GPIO_INT_DMA - interrupt due to DMA activity on this GPIO module.
Note
If this call is being used to enable summary interrupts on GPIO port P or Q (GPIOIntTypeSet() with GPIO_DISCRETE_INT not enabled), then all individual interrupts for these ports must be enabled in the GPIO module using GPIOIntEnable() and all but the interrupt for pin 0 must be disabled in the NVIC using the IntDisable() function. The summary interrupts for the ports are routed to the INT_GPIOP0 or INT_GPIOQ0 which must be enabled to handle the interrupt. If this is not done then any individual GPIO pin interrupts that are left enabled also trigger the individual interrupts.
Returns
None.

References ASSERT, GPIO_O_IM, and HWREG.

§ GPIOIntDisable()

void GPIOIntDisable ( uint32_t  ui32Port,
uint32_t  ui32IntFlags 
)

Disables the specified GPIO interrupts.

Parameters
ui32Portis the base address of the GPIO port.
ui32IntFlagsis the bit mask of the interrupt sources to disable.

This function disables the indicated GPIO interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

The ui32IntFlags parameter is the logical OR of any of the following:

  • GPIO_INT_PIN_0 - interrupt due to activity on Pin 0.
  • GPIO_INT_PIN_1 - interrupt due to activity on Pin 1.
  • GPIO_INT_PIN_2 - interrupt due to activity on Pin 2.
  • GPIO_INT_PIN_3 - interrupt due to activity on Pin 3.
  • GPIO_INT_PIN_4 - interrupt due to activity on Pin 4.
  • GPIO_INT_PIN_5 - interrupt due to activity on Pin 5.
  • GPIO_INT_PIN_6 - interrupt due to activity on Pin 6.
  • GPIO_INT_PIN_7 - interrupt due to activity on Pin 7.
  • GPIO_INT_DMA - interrupt due to DMA activity on this GPIO module.
Returns
None.

References ASSERT, GPIO_O_IM, and HWREG.

§ GPIOIntStatus()

uint32_t GPIOIntStatus ( uint32_t  ui32Port,
bool  bMasked 
)

Gets interrupt status for the specified GPIO port.

Parameters
ui32Portis the base address of the GPIO port.
bMaskedspecifies whether masked or raw interrupt status is returned.

If bMasked is set as true, then the masked interrupt status is returned; otherwise, the raw interrupt status is returned.

Returns
Returns the current interrupt status for the specified GPIO module. The value returned is the logical OR of the GPIO_INT_* values that are currently active.

References ASSERT, GPIO_O_MIS, GPIO_O_RIS, and HWREG.

§ GPIOIntClear()

void GPIOIntClear ( uint32_t  ui32Port,
uint32_t  ui32IntFlags 
)

Clears the specified interrupt sources.

Parameters
ui32Portis the base address of the GPIO port.
ui32IntFlagsis the bit mask of the interrupt sources to disable.

Clears the interrupt for the specified interrupt source(s).

The ui32IntFlags parameter is the logical OR of the GPIO_INT_* values.

Note
Because there is a write buffer in the Cortex-M processor, it may take several clock cycles before the interrupt source is actually cleared. Therefore, it is recommended that the interrupt source be cleared early in the interrupt handler (as opposed to the very last action) to avoid returning from the interrupt handler before the interrupt source is actually cleared. Failure to do so may result in the interrupt handler being immediately reentered (because the interrupt controller still sees the interrupt source asserted).
Returns
None.

References ASSERT, GPIO_O_ICR, and HWREG.

§ GPIOIntRegister()

void GPIOIntRegister ( uint32_t  ui32Port,
void(*)(void)  pfnIntHandler 
)

Registers an interrupt handler for a GPIO port.

Parameters
ui32Portis the base address of the GPIO port.
pfnIntHandleris a pointer to the GPIO port interrupt handling function.

This function ensures that the interrupt handler specified by pfnIntHandler is called when an interrupt is detected from the selected GPIO port. This function also enables the corresponding GPIO interrupt in the interrupt controller; individual pin interrupts and interrupt sources must be enabled with GPIOIntEnable().

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

References ASSERT.

§ GPIOIntUnregister()

void GPIOIntUnregister ( uint32_t  ui32Port)

Removes an interrupt handler for a GPIO port.

Parameters
ui32Portis the base address of the GPIO port.

This function unregisters the interrupt handler for the specified GPIO port. This function also disables the corresponding GPIO port interrupt in the interrupt controller; individual GPIO interrupts and interrupt sources must be disabled with GPIOIntDisable().

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

References ASSERT.

§ GPIOIntRegisterPin()

void GPIOIntRegisterPin ( uint32_t  ui32Port,
uint32_t  ui32Pin,
void(*)(void)  pfnIntHandler 
)

Registers an interrupt handler for an individual pin of a GPIO port.

Parameters
ui32Portis the base address of the GPIO port.
ui32Pinis the pin whose interrupt is to be registered.
pfnIntHandleris a pointer to the GPIO port interrupt handling function.

This function ensures that the interrupt handler specified by pfnIntHandler is called when an interrupt is detected from the selected pin of a GPIO port. This function also enables the corresponding GPIO pin interrupt in the interrupt controller.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

References ASSERT.

§ GPIOIntUnregisterPin()

void GPIOIntUnregisterPin ( uint32_t  ui32Port,
uint32_t  ui32Pin 
)

Removes an interrupt handler for an individual pin of a GPIO port.

Parameters
ui32Portis the base address of the GPIO port.
ui32Pinis the pin whose interrupt is to be unregistered.

This function unregisters the interrupt handler for the specified pin of a GPIO port. This function also disables the corresponding GPIO pin interrupt in the interrupt controller.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

References ASSERT.

§ GPIOPinRead()

int32_t GPIOPinRead ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Reads the values present of the specified pin(s).

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The values at the specified pin(s) are read, as specified by ui8Pins. Values are returned for both input and output pin(s), and the value for pin(s) that are not specified by ui8Pins 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.

Returns
Returns a bit-packed byte providing the state of the specified pin, where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. Any bit that is not specified by ui8Pins is returned as a 0. Bits 31:8 should be ignored.

References ASSERT, GPIO_O_DATA, and HWREG.

§ GPIOPinWrite()

void GPIOPinWrite ( uint32_t  ui32Port,
uint8_t  ui8Pins,
uint8_t  ui8Val 
)

Writes a value to the specified pin(s).

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).
ui8Valis the value to write to the pin(s).

Writes the corresponding bit values to the output pin(s) specified by ui8Pins. 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.

Returns
None.

References ASSERT, GPIO_O_DATA, and HWREG.

§ GPIOPinTypeADC()

void GPIOPinTypeADC ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use as analog-to-digital converter inputs.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The analog-to-digital converter input pins must be properly configured for the analog-to-digital peripheral to function correctly. This function provides the proper configuration for those 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.

Note
This function cannot be used to turn any pin into an ADC input; it only configures an ADC input pin for proper operation.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_IN, GPIO_PIN_TYPE_ANALOG, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeCAN()

void GPIOPinTypeCAN ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use as a CAN device.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The CAN pins must be properly configured for the CAN peripherals to function correctly. This function provides a typical configuration for those pin(s); other configurations may work as well depending upon the board setup (for example, using the on-chip pull-ups).

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.

Note
This function cannot be used to turn any pin into a CAN pin; it only configures a CAN pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the CAN function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_8MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeComparator()

void GPIOPinTypeComparator ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use as an analog comparator input.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The analog comparator input pins must be properly configured for the analog comparator to function correctly. This function provides the proper configuration for those 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.

Note
This function cannot be used to turn any pin into an analog comparator input; it only configures an analog comparator pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the analog comparator function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_IN, GPIO_PIN_TYPE_ANALOG, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeComparatorOutput()

void GPIOPinTypeComparatorOutput ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use as an analog comparator output.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The analog comparator output pins must be properly configured for the analog comparator to function correctly. This function provides the proper configuration for those 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.

Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeDIVSCLK()

void GPIOPinTypeDIVSCLK ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use as an clock to be output from the device.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The system control output pin must be properly configured for the DIVSCLK to function correctly. This function provides the proper configuration for those 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.

Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeEPI()

void GPIOPinTypeEPI ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use by the external peripheral interface.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The external peripheral interface pins must be properly configured for the external peripheral interface to function correctly. This function provides a typical configuration for those pin(s); other configurations may work as well depending upon the board setup (for example, using the on-chip pull-ups).

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.

Note
This function cannot be used to turn any pin into an external peripheral interface pin; it only configures an external peripheral interface pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the external peripheral interface function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_8MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeEthernetLED()

void GPIOPinTypeEthernetLED ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use by the Ethernet peripheral as LED signals.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The Ethernet peripheral provides four signals that can be used to drive an LED (for example, for link status/activity). This function provides a typical configuration for the pins.

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.

Note
This function cannot be used to turn any pin into an Ethernet LED pin; it only configures an Ethernet LED pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure the pin for the Ethernet LED function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_8MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeEthernetMII()

void GPIOPinTypeEthernetMII ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use by the Ethernet peripheral as MII signals.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The Ethernet peripheral provides a set of MII signals that are used to connect to an external PHY. This function provides a typical configuration for the pins.

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.

Note
This function cannot be used to turn any pin into an Ethernet MII pin; it only configures an Ethernet MII pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure the pin for the Ethernet MII function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_8MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeGPIOInput()

void GPIOPinTypeGPIOInput ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use as GPIO inputs.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The GPIO pins must be properly configured in order to function correctly as GPIO inputs. This function provides the proper configuration for those 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.

Note
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_IN, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeGPIOOutput()

void GPIOPinTypeGPIOOutput ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use as GPIO outputs.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The GPIO pins must be properly configured in order to function correctly as GPIO outputs. This function provides the proper configuration for those 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.

Note
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_OUT, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeGPIOOutputOD()

void GPIOPinTypeGPIOOutputOD ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use as GPIO open drain outputs.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The GPIO pins must be properly configured in order to function correctly as GPIO outputs. This function provides the proper configuration for those 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.

Note
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_OUT, GPIO_PIN_TYPE_OD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeHibernateRTCCLK()

void GPIOPinTypeHibernateRTCCLK ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use as an Hibernate RTC Clock.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The hibernate output pin must be properly configured for the RTCCLK to function correctly. This function provides the proper configuration for the RTC Clock to be output from the device.

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.

Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeI2C()

void GPIOPinTypeI2C ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin for use as SDA by the I2C peripheral.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin.

The I2C pins must be properly configured for the I2C peripheral to function correctly. This function provides the proper configuration for the SDA pin.

The pin is 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.

Note
This function cannot be used to turn any pin into an I2C SDA pin; it only configures an I2C SDA pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the I2C SDA function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_OD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeI2CSCL()

void GPIOPinTypeI2CSCL ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin for use as SCL by the I2C peripheral.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin.

The I2C pins must be properly configured for the I2C peripheral to function correctly. This function provides the proper configuration for the SCL pin.

The pin is 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.

Note
This function cannot be used to turn any pin into an I2C SCL pin; it only configures an I2C SCL pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the I2C SCL function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeLCD()

void GPIOPinTypeLCD ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use by the LCD Controller.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The LCD controller pins must be properly configured for the LCD controller to function correctly. This function provides a typical configuration for those pin(s); other configurations may work as well depending upon the board setup (for example, using the on-chip pull-ups).

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.

Note
This function cannot be used to turn any pin into an LCD pin; it only configures an LCD pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the LCD controller function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_8MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeOneWire()

void GPIOPinTypeOneWire ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use by the 1-Wire module.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The 1-Wire pin must be properly configured for the 1-Wire peripheral to function correctly. This function provides a typical configuration for those pin(s); other configurations may work as well depending upon the board setup (for example, using the on-chip pull-ups).

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.

Note
This function cannot be used to turn any pin into a 1-Wire pin; it only configures a 1-Wire pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the 1-Wire function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypePWM()

void GPIOPinTypePWM ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use by the PWM peripheral.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The PWM pins must be properly configured for the PWM peripheral to function correctly. This function provides a typical configuration for those pin(s); other configurations may work as well depending upon the board setup (for example, using the on-chip pull-ups).

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.

Note
This function cannot be used to turn any pin into a PWM pin; it only configures a PWM pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the PWM function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeQEI()

void GPIOPinTypeQEI ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use by the QEI peripheral.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The QEI pins must be properly configured for the QEI peripheral to function correctly. This function provides a typical configuration for those pin(s); other configurations may work as well depending upon the board setup (for example, not using the on-chip pull-ups).

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.

Note
This function cannot be used to turn any pin into a QEI pin; it only configures a QEI pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the QEI function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD_WPU, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeSSI()

void GPIOPinTypeSSI ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use by the SSI peripheral.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The SSI pins must be properly configured for the SSI peripheral to function correctly. This function provides a typical configuration for those pin(s); other configurations may work as well depending upon the board setup (for example, using the on-chip pull-ups).

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.

Note
This function cannot be used to turn any pin into a SSI pin; it only configures a SSI pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the SSI function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeTimer()

void GPIOPinTypeTimer ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use by the Timer peripheral.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The CCP pins must be properly configured for the timer peripheral to function correctly. This function provides a typical configuration for those pin(s); other configurations may work as well depending upon the board setup (for example, using the on-chip pull-ups).

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.

Note
This function cannot be used to turn any pin into a timer pin; it only configures a timer pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the CCP function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeTrace()

void GPIOPinTypeTrace ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use by the Trace peripheral.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The Trace pins must be properly configured for the Trace peripheral to function correctly. This function provides a typical configuration for those 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.

Note
This function cannot be used to turn any pin into a trace pin; it only configures a trace pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the Trace function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeUART()

void GPIOPinTypeUART ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use by the UART peripheral.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The UART pins must be properly configured for the UART peripheral to function correctly. This function provides a typical configuration for those pin(s); other configurations may work as well depending upon the board setup (for example, using the on-chip pull-ups).

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.

Note
This function cannot be used to turn any pin into a UART pin; it only configures a UART pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the UART function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeUSBAnalog()

void GPIOPinTypeUSBAnalog ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use by the USB peripheral.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

USB analog pins must be properly configured for the USB peripheral to function correctly. This function provides the proper configuration for any USB analog 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.

Note
This function cannot be used to turn any pin into a USB pin; it only configures a USB pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the USB function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_IN, GPIO_PIN_TYPE_ANALOG, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeUSBDigital()

void GPIOPinTypeUSBDigital ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use by the USB peripheral.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

USB digital pins must be properly configured for the USB peripheral to function correctly. This function provides a typical configuration for the digital USB pin(s); other configurations may work as well depending upon the board setup (for example, using the on-chip pull-ups).

This function should only be used with EPEN and PFAULT pins as all other USB pins are analog in nature.

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.

Note
This function cannot be used to turn any pin into a USB pin; it only configures a USB pin for proper operation. Note that a GPIOPinConfigure() function call is also required to properly configure a pin for the USB function.
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_HW, GPIO_PIN_TYPE_STD, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeWakeHigh()

void GPIOPinTypeWakeHigh ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use as a hibernate wake-on-high source.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The GPIO pins must be properly configured in order to function correctly as hibernate wake-high inputs. This function provides the proper configuration for those 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.

Note
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_IN, GPIO_PIN_TYPE_WAKE_HIGH, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinTypeWakeLow()

void GPIOPinTypeWakeLow ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Configures pin(s) for use as a hibernate wake-on-low source.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

The GPIO pins must be properly configured in order to function correctly as hibernate wake-low inputs. This function provides the proper configuration for those 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.

Note
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
None.

References ASSERT, GPIO_DIR_MODE_IN, GPIO_PIN_TYPE_WAKE_LOW, GPIO_STRENGTH_2MA, GPIODirModeSet(), and GPIOPadConfigSet().

§ GPIOPinWakeStatus()

uint32_t GPIOPinWakeStatus ( uint32_t  ui32Port)

Retrieves the wake pins status.

Parameters
ui32Portis the base address of the GPIO port.

This function returns the GPIO wake pin status values. The returned bitfield shows low or high pin state via a value of 0 or 1.

Note
A subset of GPIO pins, notably those used by the JTAG/SWD interface and any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration. These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR registers before this function can be called.
Returns
Returns the wake pin status.

References GPIO_O_WAKESTAT, and HWREG.

§ GPIOPinConfigure()

void GPIOPinConfigure ( uint32_t  ui32PinConfig)

Configures the alternate function of a GPIO pin.

Parameters
ui32PinConfigis 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). To fully configure a pin, a GPIOPinType*() function should also be called.

The available mappings are supplied on a per-device basis in pin_map.h.

Note
If the same signal is assigned to two different GPIO port pins, the signal is assigned to the port with the lowest letter and the assignment to the higher letter port is ignored.
Returns
None.

References ASSERT, GPIO_O_PCTL, and HWREG.

§ GPIODMATriggerEnable()

void GPIODMATriggerEnable ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Enables a GPIO pin as a trigger to start a DMA transaction.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

This function enables a GPIO pin to be used as a trigger to start a uDMA transaction. Any GPIO pin can be configured to be an external trigger for the uDMA. The GPIO pin still generates interrupts if the interrupt is enabled for the selected pin.

Returns
None.

References ASSERT, GPIO_O_DMACTL, and HWREGB.

§ GPIODMATriggerDisable()

void GPIODMATriggerDisable ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Disables a GPIO pin as a trigger to start a DMA transaction.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

This function disables a GPIO pin from being used as a trigger to start a uDMA transaction. This function can be used to disable this feature if it was enabled via a call to GPIODMATriggerEnable().

Returns
None.

References ASSERT, GPIO_O_DMACTL, and HWREGB.

§ GPIOADCTriggerEnable()

void GPIOADCTriggerEnable ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Enables a GPIO pin as a trigger to start an ADC capture.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

This function enables a GPIO pin to be used as a trigger to start an ADC sequence. Any GPIO pin can be configured to be an external trigger for an ADC sequence. The GPIO pin still generates interrupts if the interrupt is enabled for the selected pin. To enable the use of a GPIO pin to trigger the ADC module, the ADCSequenceConfigure() function must be called with the ADC_TRIGGER_EXTERNAL parameter.

Returns
None.

References ASSERT, GPIO_O_ADCCTL, and HWREGB.

§ GPIOADCTriggerDisable()

void GPIOADCTriggerDisable ( uint32_t  ui32Port,
uint8_t  ui8Pins 
)

Disable a GPIO pin as a trigger to start an ADC capture.

Parameters
ui32Portis the base address of the GPIO port.
ui8Pinsis the bit-packed representation of the pin(s).

This function disables a GPIO pin to be used as a trigger to start an ADC sequence. This function can be used to disable this feature if it was enabled via a call to GPIOADCTriggerEnable().

Returns
None.

References ASSERT, GPIO_O_ADCCTL, and HWREGB.

© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale