| NUC029FAE_BSP V3.02.000 The Board Support Package for NUC029FAE MCU

Macros | Functions
GPIO Exported Functions
NUC029FAE Device Driver » GPIO Driver » GPIO Exported Constants
Collaboration diagram for GPIO Exported Functions:

## Macros
#define | GPIO_CLR_INT_FLAG(gpio, u32PinMask) ((gpio)->ISRC = u32PinMask)
| Clear GPIO Pin Interrupt Flag. More...
#define | GPIO_DISABLE_DEBOUNCE(gpio, u32PinMask) ((gpio)->DBEN &= ~u32PinMask)
| Disable Pin De-bounce Function. More...
#define | GPIO_ENABLE_DEBOUNCE(gpio, u32PinMask) ((gpio)->DBEN |= u32PinMask)
| Enable Pin De-bounce Function. More...
#define | GPIO_DISABLE_DIGITAL_PATH(gpio, u32PinMask) ((gpio)->OFFD |= (u32PinMask << 16))
| Disable I/O Digital Input Path. More...
#define | GPIO_ENABLE_DIGITAL_PATH(gpio, u32PinMask) ((gpio)->OFFD &= ~(u32PinMask << 16))
| Enable I/O Digital Input Path. More...
#define | GPIO_DISABLE_DOUT_MASK(gpio, u32PinMask) ((gpio)->DMASK |= u32PinMask)
| Disable I/O DOUT mask. More...
#define | GPIO_ENABLE_DOUT_MASK(gpio, u32PinMask) ((gpio)->DMASK &= ~u32PinMask)
| Enable I/O DOUT mask. More...
#define | GPIO_GET_INT_FLAG(gpio, u32PinMask) ((gpio)->ISRC & u32PinMask)
| Get GPIO Pin Interrupt Flag. More...
#define | GPIO_SET_DEBOUNCE_TIME(clksrc, clksel) (GPIO->DBNCECON = (GPIO_DBNCECON_ICLK_ON_Msk | clksrc | clksel))
| Set De-bounce Sampling Cycle Time. More...
#define | GPIO_GET_IN_DATA(gpio) ((gpio)->PIN)
| Get GPIO Port IN Data. More...
#define | GPIO_SET_OUT_DATA(gpio, data) ((gpio)->DOUT = (data))
| Set GPIO Port OUT Data. More...
#define | GPIO_TOGGLE(u32Pin) ((u32Pin) ^= 1)
| Toggle Specified GPIO pin. More...
#define | GPIO_EnableEINT0 GPIO_EnableInt
| Enable External GPIO interrupt 0. More...
#define | GPIO_DisableEINT0 GPIO_DisableInt
| Disable External GPIO interrupt 0. More...
#define | GPIO_EnableEINT1 GPIO_EnableInt
| Enable External GPIO interrupt 1. More...
#define | GPIO_DisableEINT1 GPIO_DisableInt
| Disable External GPIO interrupt 1. More...

## Functions
void | GPIO_SetMode (GPIO_T *gpio, uint32_t u32PinMask, uint32_t u32Mode)
| Set GPIO operation mode. More...
void | GPIO_EnableInt (GPIO_T *gpio, uint32_t u32Pin, uint32_t u32IntAttribs)
| Enable GPIO interrupt. More...
void | GPIO_DisableInt (GPIO_T *gpio, uint32_t u32Pin)
| Disable GPIO interrupt. More...

## Detailed Description

## Macro Definition Documentation

## ◆ GPIO_CLR_INT_FLAG

#define GPIO_CLR_INT_FLAG | ( |  | gpio,
|  |  | u32PinMask
| ) |  | ((gpio)->ISRC = u32PinMask)

Clear GPIO Pin Interrupt Flag.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32PinMask | The single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7

Returns
  None

Clear the interrupt status of specified GPIO pin.

Definition at line 161 of file gpio.h.

## ◆ GPIO_DISABLE_DEBOUNCE

#define GPIO_DISABLE_DEBOUNCE | ( |  | gpio,
|  |  | u32PinMask
| ) |  | ((gpio)->DBEN &= ~u32PinMask)

Disable Pin De-bounce Function.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32PinMask | The single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7

Returns
  None

Disable the interrupt de-bounce function of specified GPIO pin.

Definition at line 173 of file gpio.h.

## ◆ GPIO_DISABLE_DIGITAL_PATH

#define GPIO_DISABLE_DIGITAL_PATH | ( |  | gpio,
|  |  | u32PinMask
| ) |  | ((gpio)->OFFD |= (u32PinMask << 16))

Disable I/O Digital Input Path.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32PinMask | The single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7

Returns
  None

Disable I/O digital input path of specified GPIO pin.

Definition at line 197 of file gpio.h.

## ◆ GPIO_DISABLE_DOUT_MASK

#define GPIO_DISABLE_DOUT_MASK | ( |  | gpio,
|  |  | u32PinMask
| ) |  | ((gpio)->DMASK |= u32PinMask)

Disable I/O DOUT mask.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32PinMask | The single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7

Returns
  None

Disable I/O DOUT mask of specified GPIO pin.

Definition at line 221 of file gpio.h.

## ◆ GPIO_DisableEINT0

#define GPIO_DisableEINT0 GPIO_DisableInt

Disable External GPIO interrupt 0.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32Pin | The pin of specified GPIO port. It could be 0 ~ 7.

Returns
  None

This function is used to enable specified GPIO pin interrupt.

Definition at line 327 of file gpio.h.

## ◆ GPIO_DisableEINT1

#define GPIO_DisableEINT1 GPIO_DisableInt

Disable External GPIO interrupt 1.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32Pin | The pin of specified GPIO port. It could be 0 ~ 7.

Returns
  None

This function is used to enable specified GPIO pin interrupt.

Definition at line 355 of file gpio.h.

## ◆ GPIO_ENABLE_DEBOUNCE

#define GPIO_ENABLE_DEBOUNCE | ( |  | gpio,
|  |  | u32PinMask
| ) |  | ((gpio)->DBEN |= u32PinMask)

Enable Pin De-bounce Function.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32PinMask | The single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7

Returns
  None

Enable the interrupt de-bounce function of specified GPIO pin.

Definition at line 185 of file gpio.h.

## ◆ GPIO_ENABLE_DIGITAL_PATH

#define GPIO_ENABLE_DIGITAL_PATH | ( |  | gpio,
|  |  | u32PinMask
| ) |  | ((gpio)->OFFD &= ~(u32PinMask << 16))

Enable I/O Digital Input Path.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32PinMask | The single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7

Returns
  None

Enable I/O digital input path of specified GPIO pin.

Definition at line 209 of file gpio.h.

## ◆ GPIO_ENABLE_DOUT_MASK

#define GPIO_ENABLE_DOUT_MASK | ( |  | gpio,
|  |  | u32PinMask
| ) |  | ((gpio)->DMASK &= ~u32PinMask)

Enable I/O DOUT mask.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32PinMask | The single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7

Returns
  None

Enable I/O DOUT mask of specified GPIO pin.

Definition at line 233 of file gpio.h.

## ◆ GPIO_EnableEINT0

#define GPIO_EnableEINT0 GPIO_EnableInt

Enable External GPIO interrupt 0.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32Pin | The pin of specified GPIO port.
  [in] | u32IntAttribs | The interrupt attribute of specified GPIO pin. It could be GPIO_INT_RISING, GPIO_INT_FALLING, GPIO_INT_BOTH_EDGE, GPIO_INT_HIGH, GPIO_INT_LOW.

Returns
  None

This function is used to enable specified GPIO pin interrupt.

Definition at line 314 of file gpio.h.

## ◆ GPIO_EnableEINT1

#define GPIO_EnableEINT1 GPIO_EnableInt

Enable External GPIO interrupt 1.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32Pin | The pin of specified GPIO port.
  [in] | u32IntAttribs | The interrupt attribute of specified GPIO pin. It could be GPIO_INT_RISING, GPIO_INT_FALLING, GPIO_INT_BOTH_EDGE, GPIO_INT_HIGH, GPIO_INT_LOW.

Returns
  None

This function is used to enable specified GPIO pin interrupt.

Definition at line 342 of file gpio.h.

## ◆ GPIO_GET_IN_DATA

#define GPIO_GET_IN_DATA | ( |  | gpio | ) | ((gpio)->PIN)

Get GPIO Port IN Data.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.

Return values

  The | specified port data

Get the PIN register of specified GPIO port.

Definition at line 277 of file gpio.h.

## ◆ GPIO_GET_INT_FLAG

#define GPIO_GET_INT_FLAG | ( |  | gpio,
|  |  | u32PinMask
| ) |  | ((gpio)->ISRC & u32PinMask)

Get GPIO Pin Interrupt Flag.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32PinMask | The single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7

Return values

  0 | No interrupt at specified GPIO pin
  1 | The specified GPIO pin generate an interrupt

Get the interrupt status of specified GPIO pin.

Definition at line 246 of file gpio.h.

## ◆ GPIO_SET_DEBOUNCE_TIME

#define GPIO_SET_DEBOUNCE_TIME | ( |  | clksrc,
|  |  | clksel
| ) |  | (GPIO->DBNCECON = (GPIO_DBNCECON_ICLK_ON_Msk | clksrc | clksel))

Set De-bounce Sampling Cycle Time.

Parameters

  [in] | clksrc | The de-bounce counter clock source. It could be GPIO_DBNCECON_DBCLKSRC_HCLK or GPIO_DBNCECON_DBCLKSRC_IRC10K.
  [in] | clksel | The de-bounce sampling cycle selection. It could be GPIO_DBNCECON_DBCLKSEL_1, GPIO_DBNCECON_DBCLKSEL_2, GPIO_DBNCECON_DBCLKSEL_4, GPIO_DBNCECON_DBCLKSEL_8, GPIO_DBNCECON_DBCLKSEL_16, GPIO_DBNCECON_DBCLKSEL_32, GPIO_DBNCECON_DBCLKSEL_64, GPIO_DBNCECON_DBCLKSEL_128, GPIO_DBNCECON_DBCLKSEL_256, GPIO_DBNCECON_DBCLKSEL_512, GPIO_DBNCECON_DBCLKSEL_1024, GPIO_DBNCECON_DBCLKSEL_2048, GPIO_DBNCECON_DBCLKSEL_4096, GPIO_DBNCECON_DBCLKSEL_8192, GPIO_DBNCECON_DBCLKSEL_16384, GPIO_DBNCECON_DBCLKSEL_32768.

Returns
  None

Set the interrupt de-bounce sampling cycle time based on the debounce counter clock source.
Example: _GPIO_SET_DEBOUNCE_TIME(GPIO_DBNCECON_DBCLKSRC_IRC10K, GPIO_DBNCECON_DBCLKSEL_4).
It's meaning the De-debounce counter clock source is internal 10 KHz and sampling cycle selection is 4.
Then the target de-bounce sampling cycle time is (2^4)*(1/(10*1000)) s = 16*0.0001 s = 1600 us, and system will sampling interrupt input once per 1600 us.

Definition at line 266 of file gpio.h.

## ◆ GPIO_SET_OUT_DATA

#define GPIO_SET_OUT_DATA | ( |  | gpio,
|  |  | data
| ) |  | ((gpio)->DOUT = (data))

Set GPIO Port OUT Data.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | data | GPIO port data.

Return values

  None |

Set the Data into specified GPIO port.

Definition at line 289 of file gpio.h.

## ◆ GPIO_TOGGLE

#define GPIO_TOGGLE | ( |  | u32Pin | ) | ((u32Pin) ^= 1)

Toggle Specified GPIO pin.

Parameters

  [in] | u32Pin | Pxy

Return values

  None |

Toggle the specified GPIO pint.

Definition at line 300 of file gpio.h.

## Function Documentation

## ◆ GPIO_DisableInt()

void GPIO_DisableInt | ( | GPIO_T * | gpio,
|  | uint32_t | u32Pin
| ) |  |

Disable GPIO interrupt.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32Pin | The pin of specified GPIO port. It could be 0 ~ 7.

Returns
  None

This function is used to enable specified GPIO pin interrupt.

Definition at line 82 of file gpio.c.

## ◆ GPIO_EnableInt()

void GPIO_EnableInt | ( | GPIO_T * | gpio,
|  | uint32_t | u32Pin,
|  | uint32_t | u32IntAttribs
| ) |  |

Enable GPIO interrupt.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32Pin | The pin of specified GPIO port. It could be 0 ~ 7.
  [in] | u32IntAttribs | The interrupt attribute of specified GPIO pin. It could be GPIO_INT_RISING, GPIO_INT_FALLING, GPIO_INT_BOTH_EDGE, GPIO_INT_HIGH, GPIO_INT_LOW.

Returns
  None

This function is used to enable specified GPIO pin interrupt.

Definition at line 65 of file gpio.c.

## ◆ GPIO_SetMode()

void GPIO_SetMode | ( | GPIO_T * | gpio,
|  | uint32_t | u32PinMask,
|  | uint32_t | u32Mode
| ) |  |

Set GPIO operation mode.

Parameters

  [in] | gpio | GPIO port. It could be P0, P1, P2, P3, P4 or P5.
  [in] | u32PinMask | The single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7
  [in] | u32Mode | Operation mode. GPIO_PMD_INPUT, GPIO_PMD_OUTPUT, GPIO_PMD_OPEN_DRAIN, GPIO_PMD_QUASI

Returns
  None

This function is used to set specified GPIO operation mode.

Definition at line 40 of file gpio.c.