you will need the STM provided CMSIS headers with datatypes declarations and human readable #defines and the reference manual启用GPIO端口时钟.营地: RCC->APB2ENR | = RCC_APB2ENR_IOPAEN; 使用CRL/CRH GPIO寄存器配置引脚#define GPIO_OUTPUT_2MHz (0b10)#define GPIO_OUTPUT_PUSH_PULL (0 << 2) GPIOA -> CRL &= ~(GPIO_CRL_MODE0 | GPIO_CRL_CNF0); GPIOA -> CRL |= GPIO_OUTPUT_2MHz | GPIO_OUTPUT_PUSH_PULL;操纵输出 /* to toggle */ GPIOA -> ODR ^= (1 << pinNummer); /* to set */ GPIOA -> BSRR = (1 << pinNummer); /* to reset */ GPIOA -> BRR = (1 << pinNummer); //or GPIOA -> BSRR = (1 << (pinNummer + 16)); 这篇关于STM32F103 GPIO端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
06-13 13:05