IP2761 PIN13 ( GPIO9 ) 作为输入的验证

目的

检查有客户反馈的 IP2761 GPIO9 无法作为输入使用。

使用代码

GPIO10_AFConfig(1);//GPIO10复用为串口Tx	
GPIO9_AFConfig(0); //GPIO9 为普通 IO
GPIO9_GPI_EN(1); //将 GPIO9 使能 GPIO9 的输入
UART_Init(115200,8,0,1); //串口初始化,波特率:115200,数据位:8,停止位:1,无校验位。
status = GPIO9_ReadData();
if (oldStatus != status)
	{
		oldStatus = status;
		rec_flag = 1;
	}
if(rec_flag) 
	{
		SendData[2] = (GetAdcVIN()&0xff);//ADC采集数据
		SendData[1] = (GetAdcVIN()>>8)&0xff;
		SendData[4] = (GetAdcISENSE()&0xff);
		SendData[3] = (GetAdcISENSE()>>8)&0xff;
		SendData[0] = 0xaa;
		SendData[9] = 0x55;
		SendData[5] = cc;
		SendData[6] = cv;
		SendData[7] = rzero;
		SendData[8] = rfrq;
		UART_SendData(SendData,10);
		rec_flag = 0;
	}

代码的预期效果是:

通过设置 GPIO9 为输入状态,并在 while 循环中不同读取 GPIO9 的状态,如果状态有更新,就从 TX 引脚发送一次数据包。

以上代码的运行效果:

以上结果显示

GPIO9 可以作为输入脚使用。

IP2761 PIN13 ( GPIO9 ) 作为输入的验证

One thought on “IP2761 PIN13 ( GPIO9 ) 作为输入的验证

发表回复

Scroll to top