|
是驱动LED小灯的代码,小弟不明白里面定义的这个变量啥意思, pdatabuf,gpioNum, gpioState,还有
pdatabuf = (BYTE*)pBuf;
gpioNum = *pdatabuf++;
gpioState = *pdatabuf;
这三句具体什么作用。
if(gpioNum == 0 ) //这里可以选择你要用的gpio口 GPFO3,4,5,6
if(gpioState == 1)
这两句也看不懂。麻烦老大帮忙解答一下。
DWORD GPI_Write(DWORD dwData, LPCVOID pBuf, DWORD Len)
{
BYTE* pdatabuf;
BYTE gpioNum;
BYTE gpioState;
pdatabuf = (BYTE*)pBuf;
gpioNum = *pdatabuf++;
gpioState = *pdatabuf;
RETAILMSG(1,(TEXT("*****GPILED: GPI_Write\r\n")));
if(gpioNum == 0 ) //这里可以选择你要用的gpio口 GPFO3,4,5,6
{
v_pIOPregs->GPBCON |= (1<<(gpioNum*2+10));
v_pIOPregs->GPBCON &= ~(1<<(gpioNum*2+11));
v_pIOPregs->GPBUP &= ~(1<
if(gpioState == 1)
{
v_pIOPregs->GPBDAT &= ~(1<
RETAILMSG(1,(TEXT("*****GPILED: led011111111111111\r\n")));
}
else
{
v_pIOPregs->GPBDAT |= (1<
RETAILMSG(1,(TEXT("*****GPILED: led0222222222222222222\r\n")));
}
}
|
|