MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Overview

This section describes the programming interface of the FGPIO driver. The FGPIO driver configures the FGPIO module and provides a functional interface to build the GPIO application.

Note
FGPIO (Fast GPIO) is only available in a few MCUs. FGPIO and GPIO share the same peripheral but use different registers. FGPIO is closer to the core than the regular GPIO and it's faster to read and write.

Typical use case

Output Operation

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/gpio

Input Operation

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/gpio

FGPIO Configuration

void FGPIO_PortInit (gpio_port_num_t port)
 Initializes the FGPIO peripheral. More...
 
void FGPIO_PinInit (gpio_port_num_t port, uint8_t pin, const gpio_pin_config_t *config)
 Initializes a FGPIO pin used by the board. More...
 

FGPIO Output Operations

void FGPIO_PinWrite (gpio_port_num_t port, uint8_t pin, uint8_t output)
 Sets the output level of the multiple FGPIO pins to the logic 1 or 0. More...
 
void FGPIO_PortSet (gpio_port_num_t port, uint8_t mask)
 Sets the output level of the multiple FGPIO pins to the logic 1. More...
 
void FGPIO_PortClear (gpio_port_num_t port, uint8_t mask)
 Sets the output level of the multiple FGPIO pins to the logic 0. More...
 
void FGPIO_PortToggle (gpio_port_num_t port, uint8_t mask)
 Reverses the current output logic of the multiple FGPIO pins. More...
 

FGPIO Input Operations

uint32_t FGPIO_PinRead (gpio_port_num_t port, uint8_t pin)
 Reads the current input value of the FGPIO port. More...
 

Function Documentation

void FGPIO_PortInit ( gpio_port_num_t  port)

This function ungates the FGPIO clock.

Parameters
portFGPIO PORT number, see "gpio_port_num_t". For each group FGPIO (FGPIOA, FGPIOB,etc) control registers, they handles four PORT number controls. FGPIOA serial registers --— PTA 0 ~ 7, PTB 0 ~7 ... PTD 0 ~ 7. FGPIOB serial registers --— PTE 0 ~ 7, PTF 0 ~7 ... PTH 0 ~ 7. ...
void FGPIO_PinInit ( gpio_port_num_t  port,
uint8_t  pin,
const gpio_pin_config_t config 
)

To initialize the FGPIO driver, define a pin configuration, as either input or output, in the user file. Then, call the FGPIO_PinInit() function.

This is an example to define an input pin or an output pin configuration:

* Define a digital input pin configuration,
* {
* 0,
* }
* Define a digital output pin configuration,
* {
* 0,
* }
*
Parameters
portFGPIO PORT number, see "gpio_port_num_t". For each group FGPIO (FGPIOA, FGPIOB,etc) control registers, they handles four PORT number controls. FGPIOA serial registers --— PTA 0 ~ 7, PTB 0 ~7 ... PTD 0 ~ 7. FGPIOB serial registers --— PTE 0 ~ 7, PTF 0 ~7 ... PTH 0 ~ 7. ...
pinFGPIO port pin number
configFGPIO pin configuration pointer
void FGPIO_PinWrite ( gpio_port_num_t  port,
uint8_t  pin,
uint8_t  output 
)
Parameters
portFGPIO PORT number, see "gpio_port_num_t". For each group FGPIO (FGPIOA, FGPIOB,etc) control registers, they handles four PORT number controls. FGPIOA serial registers --— PTA 0 ~ 7, PTB 0 ~7 ... PTD 0 ~ 7. FGPIOB serial registers --— PTE 0 ~ 7, PTF 0 ~7 ... PTH 0 ~ 7. ...
pinFGPIO pin number
outputFGPIOpin output logic level.
  • 0: corresponding pin output low-logic level.
  • 1: corresponding pin output high-logic level.
void FGPIO_PortSet ( gpio_port_num_t  port,
uint8_t  mask 
)
Parameters
portFGPIO PORT number, see "gpio_port_num_t". For each group FGPIO (FGPIOA, FGPIOB,etc) control registers, they handles four PORT number controls. FGPIOA serial registers --— PTA 0 ~ 7, PTB 0 ~7 ... PTD 0 ~ 7. FGPIOB serial registers --— PTE 0 ~ 7, PTF 0 ~7 ... PTH 0 ~ 7. ...
maskFGPIO pin number macro
void FGPIO_PortClear ( gpio_port_num_t  port,
uint8_t  mask 
)
Parameters
portFGPIO PORT number, see "gpio_port_num_t". For each group FGPIO (FGPIOA, FGPIOB,etc) control registers, they handles four PORT number controls. FGPIOA serial registers --— PTA 0 ~ 7, PTB 0 ~7 ... PTD 0 ~ 7. FGPIOB serial registers --— PTE 0 ~ 7, PTF 0 ~7 ... PTH 0 ~ 7. ...
maskFGPIO pin number macro
void FGPIO_PortToggle ( gpio_port_num_t  port,
uint8_t  mask 
)
Parameters
portFGPIO PORT number, see "gpio_port_num_t". For each group FGPIO (FGPIOA, FGPIOB,etc) control registers, they handles four PORT number controls. FGPIOA serial registers --— PTA 0 ~ 7, PTB 0 ~7 ... PTD 0 ~ 7. FGPIOB serial registers --— PTE 0 ~ 7, PTF 0 ~7 ... PTH 0 ~ 7. ...
maskFGPIO pin number macro
uint32_t FGPIO_PinRead ( gpio_port_num_t  port,
uint8_t  pin 
)
Parameters
portFGPIO PORT number, see "gpio_port_num_t". For each group FGPIO (FGPIOA, FGPIOB,etc) control registers, they handles four PORT number controls. FGPIOA serial registers --— PTA 0 ~ 7, PTB 0 ~7 ... PTD 0 ~ 7. FGPIOB serial registers --— PTE 0 ~ 7, PTF 0 ~7 ... PTH 0 ~ 7. ...
pinFGPIO pin number
Return values
FGPIOport input value
  • 0: corresponding pin input low-logic level.
  • 1: corresponding pin input high-logic level.