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
This function ungates the FGPIO clock.
- Parameters
-
port | FGPIO 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. ... |
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
-
port | FGPIO 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. ... |
pin | FGPIO port pin number |
config | FGPIO pin configuration pointer |
- Parameters
-
port | FGPIO 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. ... |
pin | FGPIO pin number |
output | FGPIOpin output logic level.
- 0: corresponding pin output low-logic level.
- 1: corresponding pin output high-logic level.
|
- Parameters
-
port | FGPIO 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. ... |
mask | FGPIO pin number macro |
- Parameters
-
port | FGPIO 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. ... |
mask | FGPIO pin number macro |
- Parameters
-
port | FGPIO 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. ... |
mask | FGPIO pin number macro |
- Parameters
-
port | FGPIO 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. ... |
pin | FGPIO pin number |
- Return values
-
FGPIO | port input value
- 0: corresponding pin input low-logic level.
- 1: corresponding pin input high-logic level.
|