|
发表于 2023-3-14 10:54:58
|
显示全部楼层
自己配置 io口的 功能
FL_GPIO_InitTypeDef gpioInitStruct= {0};
//用到的GPIO引脚 设为输入
gpioInitStruct.pin = FL_GPIO_PIN_6;
gpioInitStruct.mode = FL_GPIO_MODE_INPUT;//输入
gpioInitStruct.outputType = FL_GPIO_OUTPUT_PUSHPULL;
gpioInitStruct.pull = FL_ENABLE;
gpioInitStruct.remapPin = FL_DISABLE;
FL_GPIO_Init(GPIOC, &gpioInitStruct);
FL_GPIO_GetInputPin(GPIOC, FL_GPIO_PIN_6); //获取输入
//用到的GPIO引脚 设为输出
gpioInitStruct.pin = FL_GPIO_PIN_6;
gpioInitStruct.mode = FL_GPIO_MODE_OUTPUT//输出
gpioInitStruct.outputType = FL_GPIO_OUTPUT_PUSHPULL;
gpioInitStruct.pull = FL_ENABLE;
gpioInitStruct.remapPin = FL_DISABLE;
FL_GPIO_Init(GPIOC, &gpioInitStruct);
FL_GPIO_SetOutputPin((GPIOC, FL_GPIO_PIN_6); //输出高
FL_GPIO_ResetOutputPin((GPIOC, FL_GPIO_PIN_6); //输出低
//用到的GPIO引脚 设为模拟
gpioInitStruct.pin = FL_GPIO_PIN_6;
gpioInitStruct.mode = FL_GPIO_MODE_ANALOG//模拟
gpioInitStruct.outputType = FL_GPIO_OUTPUT_PUSHPULL;
gpioInitStruct.pull = FL_ENABLE;
gpioInitStruct.remapPin = FL_DISABLE;
FL_GPIO_Init(GPIOC, &gpioInitStruct);
//用到的GPIO引脚 设为数字
gpioInitStruct.pin = FL_GPIO_PIN_6;
gpioInitStruct.mode = FL_GPIO_MODE_DIGITAL//数字
gpioInitStruct.outputType = FL_GPIO_OUTPUT_PUSHPULL;
gpioInitStruct.pull = FL_ENABLE;
gpioInitStruct.remapPin = FL_DISABLE;//如果同一端口有两个数字功能,通过这里选
FL_GPIO_Init(GPIOC, &gpioInitStruct); |
|