![]() |
NANO102/112 BSP V3.03.003
The Board Support Package for Nano102/112 Series
|
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(u32ClkSrc, u32ClkSel) (GPIO->DBNCECON = (GP_DBNCECON_DBCLK_ON_Msk | u32ClkSrc | u32ClkSel)) |
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, u32Data) ((gpio)->DOUT = (u32Data)) |
Set GPIO Port OUT Data. More... | |
#define | GPIO_DISABLE_PULL_UP(gpio, u32PinMask) ((gpio)->PUEN &= ~u32PinMask) |
Disable Pin Pull-up resistor Function. More... | |
#define | GPIO_ENABLE_PULL_UP(gpio, u32PinMask) ((gpio)->PUEN |= u32PinMask) |
Enable Pin Pull-up resistor Function. 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... | |
#define GPIO_CLR_INT_FLAG | ( | gpio, | |
u32PinMask | |||
) | ((gpio)->ISRC = u32PinMask) |
#define GPIO_DISABLE_DEBOUNCE | ( | gpio, | |
u32PinMask | |||
) | ((gpio)->DBEN &= ~u32PinMask) |
#define GPIO_DISABLE_DIGITAL_PATH | ( | gpio, | |
u32PinMask | |||
) | ((gpio)->OFFD |= (u32PinMask << 16)) |
#define GPIO_DISABLE_DOUT_MASK | ( | gpio, | |
u32PinMask | |||
) | ((gpio)->DMASK &= ~u32PinMask) |
#define GPIO_DISABLE_PULL_UP | ( | gpio, | |
u32PinMask | |||
) | ((gpio)->PUEN &= ~u32PinMask) |
#define GPIO_DisableEINT0 GPIO_DisableInt |
#define GPIO_DisableEINT1 GPIO_DisableInt |
#define GPIO_ENABLE_DEBOUNCE | ( | gpio, | |
u32PinMask | |||
) | ((gpio)->DBEN |= u32PinMask) |
#define GPIO_ENABLE_DIGITAL_PATH | ( | gpio, | |
u32PinMask | |||
) | ((gpio)->OFFD &= ~(u32PinMask << 16)) |
#define GPIO_ENABLE_DOUT_MASK | ( | gpio, | |
u32PinMask | |||
) | ((gpio)->DMASK |= u32PinMask) |
#define GPIO_ENABLE_PULL_UP | ( | gpio, | |
u32PinMask | |||
) | ((gpio)->PUEN |= u32PinMask) |
#define GPIO_EnableEINT0 GPIO_EnableInt |
Enable External GPIO interrupt 0.
[in] | gpio | GPIO port. It could be PA, PB, PC, PD, PE or PF |
[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 |
This function is used to enable specified GPIO pin interrupt.
#define GPIO_EnableEINT1 GPIO_EnableInt |
Enable External GPIO interrupt 1.
[in] | gpio | GPIO port. It could be PA, PB, PC, PD, PE or PF |
[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 |
This function is used to enable specified GPIO pin interrupt.
#define GPIO_GET_IN_DATA | ( | gpio | ) | ((gpio)->PIN) |
#define GPIO_GET_INT_FLAG | ( | gpio, | |
u32PinMask | |||
) | ((gpio)->ISRC & u32PinMask) |
Get GPIO Pin Interrupt Flag.
[in] | gpio | GPIO port. It could be PA, PB, PC, PD, PE or PF |
[in] | u32PinMask | The single or multiple pins of specified GPIO port |
0 | No interrupt at specified GPIO pin |
1 | The specified GPIO pin generate an interrupt |
Get the interrupt status of specified GPIO pin.
#define GPIO_SET_DEBOUNCE_TIME | ( | u32ClkSrc, | |
u32ClkSel | |||
) | (GPIO->DBNCECON = (GP_DBNCECON_DBCLK_ON_Msk | u32ClkSrc | u32ClkSel)) |
Set De-bounce Sampling Cycle Time.
[in] | u32ClkSrc | The de-bounce counter clock source. It could be GPIO_DBCLKSRC_HCLK or GPIO_DBCLKSRC_IRC10K |
[in] | u32ClkSel | The de-bounce sampling cycle selection. It could be GPIO_DBCLKSEL_1, GPIO_DBCLKSEL_2, GPIO_DBCLKSEL_4, GPIO_DBCLKSEL_8, GPIO_DBCLKSEL_16, GPIO_DBCLKSEL_32, GPIO_DBCLKSEL_64, GPIO_DBCLKSEL_128, GPIO_DBCLKSEL_256, GPIO_DBCLKSEL_512, GPIO_DBCLKSEL_1024, GPIO_DBCLKSEL_2048, GPIO_DBCLKSEL_4096, GPIO_DBCLKSEL_8192, GPIO_DBCLKSEL_16384, GPIO_DBCLKSEL_32768 |
Set the interrupt de-bounce sampling cycle time based on the debounce counter clock source.
Example: GPIO_SET_DEBOUNCE_TIME(GPIO_DBCLKSRC_IRC10K, GPIO_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.
#define GPIO_SET_OUT_DATA | ( | gpio, | |
u32Data | |||
) | ((gpio)->DOUT = (u32Data)) |
#define GPIO_TOGGLE | ( | u32Pin | ) | ((u32Pin) ^= 1) |
void GPIO_DisableInt | ( | GPIO_T * | gpio, |
uint32_t | u32Pin | ||
) |
void GPIO_EnableInt | ( | GPIO_T * | gpio, |
uint32_t | u32Pin, | ||
uint32_t | u32IntAttribs | ||
) |
Enable GPIO interrupt.
[in] | gpio | GPIO port. It could be PA, PB, PC, PD, PE or PF. |
[in] | u32Pin | The pin of specified GPIO port. It could be 0 ~ 15. |
[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. |
This function is used to enable specified GPIO pin interrupt.
void GPIO_SetMode | ( | GPIO_T * | gpio, |
uint32_t | u32PinMask, | ||
uint32_t | u32Mode | ||
) |
Set GPIO operation mode.
[in] | gpio | GPIO port. It could be PA, PB, PC, PD, PE or PF. |
[in] | u32PinMask | The single or multiple pins of specified GPIO port. |
[in] | u32Mode | Operation mode. GPIO_PMD_INPUT, GPIO_PMD_OUTPUT, GPIO_PMD_OPEN_DRAIN |
This function is used to set specified GPIO operation mode.