PAN1080 Peripheral API
Modules | Macros | Functions
Gpio Interface

Gpio Interface. More...

Collaboration diagram for Gpio Interface:

Modules

 Gpio mode
 Gpio mode definitions.
 
 Gpio interrupt type
 Gpio interrupt type definitions.
 
 Gpio debounce src
 Gpio debouce src definitions.
 
 Gpio debounce count
 Gpio debouce count definitions.
 
 Gpio address map
 

Macros

#define GPIO_PIN_MAX   8
 
#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

__STATIC_INLINE void GPIO_ClrIntFlag (GPIO_T *gpio, uint32_t PinMask)
 Clear GPIO Pin Interrupt Flag. More...
 
__STATIC_INLINE void GPIO_ClrAllIntFlag (GPIO_T *gpio)
 Clear GPIO Pin Interrupt Flag. More...
 
__STATIC_INLINE void GPIO_DisableDebounce (GPIO_T *gpio, uint32_t PinMask)
 Disable Pin De-bounce Function. More...
 
__STATIC_INLINE void GPIO_EnableDebounce (GPIO_T *gpio, uint32_t PinMask)
 Enable Pin De-bounce Function. More...
 
__STATIC_INLINE void GPIO_DisableDigitalPath (GPIO_T *gpio, uint32_t PinMask)
 Disable I/O Digital Input Path. More...
 
__STATIC_INLINE void GPIO_EnableDigitalPath (GPIO_T *gpio, uint32_t PinMask)
 Enable I/O Digital Input Path. More...
 
__STATIC_INLINE void GPIO_DisablePullupPath (GPIO_T *gpio, uint32_t PinMask)
 Disable I/O Digital pull up Path. More...
 
__STATIC_INLINE void GPIO_EnablePullupPath (GPIO_T *gpio, uint32_t PinMask)
 Enable I/O Digital pull up Path. More...
 
__STATIC_INLINE void GPIO_DisablePulldownPath (GPIO_T *gpio, uint32_t PinMask)
 Disable I/O Digital pull down Path. More...
 
__STATIC_INLINE void GPIO_EnablePulldownPath (GPIO_T *gpio, uint32_t PinMask)
 Enable I/O Digital pull down Path. More...
 
__STATIC_INLINE void GPIO_DisableDoutMask (GPIO_T *gpio, uint32_t PinMask)
 Disable I/O DOUT mask. More...
 
__STATIC_INLINE void GPIO_EnableDoutMask (GPIO_T *gpio, uint32_t PinMask)
 Enable I/O DOUT mask. More...
 
__STATIC_INLINE bool GPIO_GetIntFlag (GPIO_T *gpio, uint32_t PinMask)
 Get GPIO Pin Interrupt Flag. More...
 
__STATIC_INLINE void GPIO_SetDebounceTime (GPIO_ClkSrcDef ClkSrc, GPIO_ClkSelDef ClkSel)
 Set De-bounce Sampling Cycle Time. More...
 
__STATIC_INLINE uint32_t GPIO_GetInData (GPIO_T *gpio)
 Get GPIO Port IN Data. More...
 
__STATIC_INLINE void GPIO_SetOutData (GPIO_T *gpio, uint32_t data)
 Set GPIO Port OUT Data. More...
 
__STATIC_INLINE uint32_t GPIO_GetOutData (GPIO_T *gpio)
 Get GPIO Port OUT Data. More...
 
__STATIC_INLINE void GPIO_Toggle (GPIO_T *gpio, uint32_t u32PinMask)
 Toggle Specified GPIO pin. More...
 
__STATIC_INLINE void GPIO_TogglePin (uint32_t u32Pin)
 Toggle Specified GPIO pin. More...
 
__STATIC_INLINE void GPIO_EnableInt (GPIO_T *gpio, uint32_t Pin, GPIO_IntAttrDef IntAttribs)
 Enable GPIO interrupt. More...
 
__STATIC_INLINE void GPIO_DisableInt (GPIO_T *gpio, uint32_t Pin)
 Disable GPIO interrupt. More...
 
void GPIO_SetMode (GPIO_T *gpio, uint32_t PinMask, GPIO_ModeDef Mode)
 Set GPIO Work Mode. More...
 

Detailed Description

Gpio Interface.

Macro Definition Documentation

◆ GPIO_DisableEINT0

#define GPIO_DisableEINT0   GPIO_DisableInt

Disable External GPIO interrupt 0.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinThe pin of specified GPIO port. It could be 0 ~ 7.
Returns
None

This function is used to disable specified GPIO pin interrupt.

◆ GPIO_DisableEINT1

#define GPIO_DisableEINT1   GPIO_DisableInt

Disable External GPIO interrupt 1.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinThe pin of specified GPIO port. It could be 0 ~ 7.
Returns
None

This function is used to disable specified GPIO pin interrupt.

◆ GPIO_EnableEINT0

#define GPIO_EnableEINT0   GPIO_EnableInt

Enable External GPIO interrupt 0.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinThe pin of specified GPIO port.
[in]IntAttribsThe interrupt attribute of specified GPIO pin. It could be
Returns
None

This function is used to enable specified GPIO pin interrupt.

◆ GPIO_EnableEINT1

#define GPIO_EnableEINT1   GPIO_EnableInt

Enable External GPIO interrupt 1.

Parameters
[in]gpioGPIO port. It could P0, P1, P2, P3, P4 or P5.
[in]PinThe pin of specified GPIO port.
[in]IntAttribsThe interrupt attribute of specified GPIO pin. It could be
Returns
None

This function is used to enable specified GPIO pin interrupt.

◆ GPIO_PIN_MAX

#define GPIO_PIN_MAX   8

Specify Maximum Pins of Each GPIO Port

Function Documentation

◆ GPIO_ClrAllIntFlag()

__STATIC_INLINE void GPIO_ClrAllIntFlag ( GPIO_T *  gpio)

Clear GPIO Pin Interrupt Flag.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
Returns
None

Clear the interrupt status of All GPIO pin.

◆ GPIO_ClrIntFlag()

__STATIC_INLINE void GPIO_ClrIntFlag ( GPIO_T *  gpio,
uint32_t  PinMask 
)

Clear GPIO Pin Interrupt Flag.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinMaskThe single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7
Returns
None

Clear the interrupt status of specified GPIO pin.

◆ GPIO_DisableDebounce()

__STATIC_INLINE void GPIO_DisableDebounce ( GPIO_T *  gpio,
uint32_t  PinMask 
)

Disable Pin De-bounce Function.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinMaskThe single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7
Returns
None

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

◆ GPIO_DisableDigitalPath()

__STATIC_INLINE void GPIO_DisableDigitalPath ( GPIO_T *  gpio,
uint32_t  PinMask 
)

Disable I/O Digital Input Path.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinMaskThe single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7
Returns
None

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

◆ GPIO_DisableDoutMask()

__STATIC_INLINE void GPIO_DisableDoutMask ( GPIO_T *  gpio,
uint32_t  PinMask 
)

Disable I/O DOUT mask.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinMaskThe single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7
Returns
None

Disable I/O DOUT mask of specified GPIO pin.

◆ GPIO_DisableInt()

__STATIC_INLINE void GPIO_DisableInt ( GPIO_T *  gpio,
uint32_t  Pin 
)

Disable GPIO interrupt.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinThe pin of specified GPIO port. It could be 0 ~ 7.
Returns
None

This function is used to enable specified GPIO pin interrupt.

◆ GPIO_DisablePulldownPath()

__STATIC_INLINE void GPIO_DisablePulldownPath ( GPIO_T *  gpio,
uint32_t  PinMask 
)

Disable I/O Digital pull down Path.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinMaskThe single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7
Returns
None

Disable I/O Digital pull down Path of specified GPIO pin.

◆ GPIO_DisablePullupPath()

__STATIC_INLINE void GPIO_DisablePullupPath ( GPIO_T *  gpio,
uint32_t  PinMask 
)

Disable I/O Digital pull up Path.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinMaskThe single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7
Returns
None

Disable I/O Digital pull up Path of specified GPIO pin.

◆ GPIO_EnableDebounce()

__STATIC_INLINE void GPIO_EnableDebounce ( GPIO_T *  gpio,
uint32_t  PinMask 
)

Enable Pin De-bounce Function.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinMaskThe single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7
Returns
None

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

◆ GPIO_EnableDigitalPath()

__STATIC_INLINE void GPIO_EnableDigitalPath ( GPIO_T *  gpio,
uint32_t  PinMask 
)

Enable I/O Digital Input Path.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinMaskThe single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7
Returns
None

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

◆ GPIO_EnableDoutMask()

__STATIC_INLINE void GPIO_EnableDoutMask ( GPIO_T *  gpio,
uint32_t  PinMask 
)

Enable I/O DOUT mask.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinMaskThe single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7
Returns
None

Enable I/O DOUT mask of specified GPIO pin.

◆ GPIO_EnableInt()

__STATIC_INLINE void GPIO_EnableInt ( GPIO_T *  gpio,
uint32_t  Pin,
GPIO_IntAttrDef  IntAttribs 
)

Enable GPIO interrupt.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinThe pin of specified GPIO port. It could be 0 ~ 7.
[in]IntAttribsThe interrupt attribute of specified GPIO pin. It could be
Returns
None

This function is used to enable specified GPIO pin interrupt.

◆ GPIO_EnablePulldownPath()

__STATIC_INLINE void GPIO_EnablePulldownPath ( GPIO_T *  gpio,
uint32_t  PinMask 
)

Enable I/O Digital pull down Path.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinMaskThe single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7
Returns
None

Enable I/O Digital pull down Path of specified GPIO pin.

◆ GPIO_EnablePullupPath()

__STATIC_INLINE void GPIO_EnablePullupPath ( GPIO_T *  gpio,
uint32_t  PinMask 
)

Enable I/O Digital pull up Path.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinMaskThe single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7
Returns
None

Enable I/O Digital pull up Path of specified GPIO pin.

◆ GPIO_GetInData()

__STATIC_INLINE uint32_t GPIO_GetInData ( GPIO_T *  gpio)

Get GPIO Port IN Data.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
Returns
The specified port data

Get the PIN register of specified GPIO port.

◆ GPIO_GetIntFlag()

__STATIC_INLINE bool GPIO_GetIntFlag ( GPIO_T *  gpio,
uint32_t  PinMask 
)

Get GPIO Pin Interrupt Flag.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinMaskThe single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7
Return values
falseNo interrupt at specified GPIO pin
trueThe specified GPIO pin generate an interrupt

Get the interrupt status of specified GPIO pin.

◆ GPIO_GetOutData()

__STATIC_INLINE uint32_t GPIO_GetOutData ( GPIO_T *  gpio)

Get GPIO Port OUT Data.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
Returns
The specified port data

Get the DOUT register of specified GPIO port.

◆ GPIO_SetDebounceTime()

__STATIC_INLINE void GPIO_SetDebounceTime ( GPIO_ClkSrcDef  ClkSrc,
GPIO_ClkSelDef  ClkSel 
)

Set De-bounce Sampling Cycle Time.

Parameters
[in]clksrcThe de-bounce counter clock source. It could be GPIO_DBCTL_DBCLKSRC_HCLK
  • or GPIO_DBCTL_DBCLKSRC_RCL.
[in]clkselThe de-bounce sampling cycle selection. It could be
Returns
None

Set the interrupt de-bounce sampling cycle time based on the debounce counter clock source.
Example: GPIO_SET_DEBOUNCE_TIME(GPIO_DBCTL_DBCLKSRC_RCL, GPIO_DBCTL_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.

◆ GPIO_SetMode()

void GPIO_SetMode ( GPIO_T *  gpio,
uint32_t  PinMask,
GPIO_ModeDef  Mode 
)

Set GPIO Work Mode.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]PinMaskThe single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7.
[in]ModeGpio mode definitions (see GPIO_ModeDef).
Return values
None

Set the GPIO pin work mode.

◆ GPIO_SetOutData()

__STATIC_INLINE void GPIO_SetOutData ( GPIO_T *  gpio,
uint32_t  data 
)

Set GPIO Port OUT Data.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]dataGPIO port data.
Return values
None

Set the Data into specified GPIO port.

◆ GPIO_Toggle()

__STATIC_INLINE void GPIO_Toggle ( GPIO_T *  gpio,
uint32_t  u32PinMask 
)

Toggle Specified GPIO pin.

Parameters
[in]gpioGPIO port. It could be P0, P1, P2, P3, P4 or P5.
[in]u32PinMaskThe single or multiple pins of specified GPIO port. BIT0, BIT1, BIT2,.. BIT7
Return values
None

Toggle the specified GPIO pin output.

◆ GPIO_TogglePin()

__STATIC_INLINE void GPIO_TogglePin ( uint32_t  u32Pin)

Toggle Specified GPIO pin.

Parameters
[in]u32PinPxy
Note
This API only takes effect when the Digital Input Path of current pin is enabled.
Return values
None

Toggle the specified GPIO pin output.