1.HC32L130外部端口PB2
#include "app_SD3078.h"
#define RCC_RTC_INT_PORT SysctrlPeripheralGpio /* GPIO端口时钟 */
#define PORT_RTC_INT GpioPortB /* GPIO端口 */
#define PIN_RTC_INT GpioPin2 /* GPIO引脚 */
void App_RTC_INTInit(void){
stc_gpio_cfg_t stcGpioCfg;
///< 打开GPIO外设时钟门控
Sysctrl_SetPeripheralGate(RCC_RTC_INT_PORT, TRUE);
///< 端口方向配置->输入
stcGpioCfg.enDir = GpioDirIn;
///< 端口驱动能力配置->高驱动能力
stcGpioCfg.enDrv = GpioDrvL;
///< 端口上下拉配置->无
stcGpioCfg.enPu = GpioPuDisable;
stcGpioCfg.enPd = GpioPdDisable;
///< 端口开漏输出配置->开漏输出关闭
stcGpioCfg.enOD = GpioOdDisable;
///< 端口输入/输出值寄存器总线控制模式配置->AHB
stcGpioCfg.enCtrlMode = GpioAHB;
///< GPIO IO USER KEY初始化
Gpio_Init(PORT_RTC_INT, PIN_RTC_INT, &stcGpioCfg);
///< 打开并配置USER KEY为下降沿中断
Gpio_EnableIrq(PORT_RTC_INT, PIN_RTC_INT, GpioIrqFalling);
///< 使能端口PORTA系统中断
EnableNvic(PORTB_IRQn, IrqLevel2, TRUE);
}
///< PortB中断服务函数
void PortB_IRQHandler(void)
{
if(TRUE == Gpio_GetIrqStatus(PORT_RTC_INT, PIN_RTC_INT))
{
printf("PortB_IRQHandler");
Gpio_ClearIrq(PORT_RTC_INT, PIN_RTC_INT);
}
}
标签:RTC,HC32L130,端口,PORT,中断,IO,GPIO,INT,stcGpioCfg
From: https://blog.csdn.net/mtyterry/article/details/139874357