12、stm32F103 GPIO写操作
函数GPIO_SetBits
设置高电平
例:
/* Set the GPIOA port pin 10 and pin 15 */
GPIO_SetBits(GPIOA, GPIO_Pin_10 | GPIO_Pin_15);
函数GPIO_ResetBits
设置低电平
例:
/* Clears the GPIOA port pin 10 and pin 15 */
GPIO_ResetBits(GPIOA, GPIO_Pin_10 | GPIO_Pin_15);
函数GPIO_WriteBit
设置高或低电平
例:
/* Set the GPIOA port pin 15 */
GPIO_WriteBit(GPIOA, GPIO_Pin_15, Bit_SET); // 高
GPIO_WriteBit(GPIOA, GPIO_Pin_15, Bit_RESET); //低
函数GPIO_Write
整组IO口设置
例:
/* Write data to GPIOA data port */
GPIO_Write(GPIOA, 0x1101);