21ic问答首页 - 想通过初始化GPIO口采集外部电平信号但总是初始化不成功。
想通过初始化GPIO口采集外部电平信号但总是初始化不成功。
7391145052021-03-23
Sysctrl_SetPeripheralGate(SysctrlPeripheralGpio, TRUE); //timer
stc_gpio_cfg_t stcGpioCfg;
stcGpioCfg.enDir = GpioDirIn;
stcGpioCfg.enPu = GpioPuEnable;
stcGpioCfg.enCtrlMode = GpioAHB;
Gpio_Init(GpioPortB, GpioPin6,&stcGpioCfg);
while (1) {
rev_len = DevUART_Read(&gDebugUart, recv_buf, MEM_POOL_BLOCK_SIZE, OS_ALWAYS_DELAY);
uint8_t dian;
//unsigned char *G;
uint8_t *G;
dian=Gpio_GetInputIO(GpioPortB,GpioPin6);
sprintf(G,"%d",dian);
AT_TxFreq(0, G, rev_len);
gEnableRadioRx = true;
osDelayMs(10);
stc_gpio_cfg_t stcGpioCfg;
stcGpioCfg.enDir = GpioDirIn;
stcGpioCfg.enPu = GpioPuEnable;
stcGpioCfg.enCtrlMode = GpioAHB;
Gpio_Init(GpioPortB, GpioPin6,&stcGpioCfg);
while (1) {
rev_len = DevUART_Read(&gDebugUart, recv_buf, MEM_POOL_BLOCK_SIZE, OS_ALWAYS_DELAY);
uint8_t dian;
//unsigned char *G;
uint8_t *G;
dian=Gpio_GetInputIO(GpioPortB,GpioPin6);
sprintf(G,"%d",dian);
AT_TxFreq(0, G, rev_len);
gEnableRadioRx = true;
osDelayMs(10);
您需要登录后才可以回复 登录 | 注册