标签:val NPU shp pull signed 输入 led div type
配置时钟:
void CMU_ClockEnable(CMU_Clock_TypeDef clock, bool enable) CMU_ClockEnable(cmuClock_HFPER, true); /* Enable GPIO in CMU */ CMU_ClockEnable(cmuClock_GPIO, true);
配置引脚为输入:
void GPIO_PinModeSet(GPIO_Port_TypeDef port, unsigned int pin, GPIO_Mode_TypeDef mode, unsigned int out) /* Configure PB9 and PB10 as input */ GPIO_PinModeSet(gpioPortB, 9, gpioModeInput, 0); GPIO_PinModeSet(gpioPortB, 10, gpioModeInput, 0);
配置引脚为输出:
void GPIO_PinModeSet(GPIO_Port_TypeDef port, unsigned int pin, GPIO_Mode_TypeDef mode, unsigned int out) GPIO_PinModeSet(ledArray[ledNo].port, ledArray[ledNo].pin, gpioModePushPull, 0);
配置引脚为中断输入:
先配置为输入,再配置中断
__STATIC_INLINE void GPIO_IntConfig(GPIO_Port_TypeDef port, unsigned int pin, bool risingEdge, bool fallingEdge, bool enable) /* Set falling edge interrupt for both ports */ GPIO_IntConfig(gpioPortB, 9, false, true, true); GPIO_IntConfig(gpioPortB, 10, false, true, true);
引脚输出高电平:
__STATIC_INLINE void GPIO_PinOutSet(GPIO_Port_TypeDef port, unsigned int pin) GPIO_PinOutSet(ledArray[ledNo].port, ledArray[ledNo].pin);
引脚输出低电平:
__STATIC_INLINE void GPIO_PinOutClear(GPIO_Port_TypeDef port, unsigned int pin) GPIO_PinOutClear(ledArray[ledNo].port, ledArray[ledNo].pin);
引脚翻转输出电平:
__STATIC_INLINE void GPIO_PinOutToggle(GPIO_Port_TypeDef port, unsigned int pin) GPIO_PinOutToggle(ledArray[ledNo].port, ledArray[ledNo].pin);
读取输出引脚电平:
__STATIC_INLINE unsigned int GPIO_PinOutGet(GPIO_Port_TypeDef port, unsigned int pin) retVal = (int)GPIO_PinOutGet(ledArray[ledNo].port, ledArray[ledNo].pin);
读取输入引脚电平:
__STATIC_INLINE unsigned int GPIO_PinInGet(GPIO_Port_TypeDef port, unsigned int pin)
读取输入端口:
__STATIC_INLINE uint32_t GPIO_PortInGet(GPIO_Port_TypeDef port)
标签:val NPU shp pull signed 输入 led div type
原文地址:https://www.cnblogs.com/jxndsfss/p/10127897.html