#define PASet(n) GPIOA->BSRR = (1<<n)
#define PAReset(n) GPIOA->BRR = (1<<n)
#define PBSet(n) GPIOB->BSRR = (1<<n)
#define PBReset(n) GPIOB->BRR = (1<<n)
#define PCSet(n) GPIOC->BSRR = (1<<n)
#define PCReset(n) GPIOC->BRR = (1<<n)
#define PDSet(n) GPIOD->BSRR = (1<<n)
#define PDReset(n) GPIOD->BRR = (1<<n)
#define PFSet(n) GPIOF->BSRR = (1<<n)
#define PFReset(n) GPIOF->BRR = (1<<n)
#define PAin(n) (GPIOA->IDR &(1<<n))>>n
#define PBin(n) (GPIOB->IDR &(1<<n))>>n
#define PCin(n) (GPIOC->IDR &(1<<n))>>n
#define PDin(n) (GPIOD->IDR &(1<<n))>>n
手里没板子,来个兄弟试试 |