stm32f030可以进行位带操作吗,像51一样的控制IO
//IO¿Ú²Ù×÷ºê¶¨Òå
#define BITBAND(addr, bitnum) ((addr & 0xF0000000)+0x2000000+((addr &0xFFFFF)<<5)+(bitnum<<2))
#define MEM_ADDR(addr) *((volatile unsigned long *)(addr))
#define BIT_ADDR(addr, bitnum) MEM_ADDR(BITBAND(addr, bitnum))
//IO¿ÚµØÖ·Ó³Éä
#define GPIOA_ODR_Addr (GPIOA_BASE+20) //0x48000014
#define GPIOB_ODR_Addr (GPIOB_BASE+20) //0x48000414
#define GPIOC_ODR_Addr (GPIOC_BASE+20) //0x48000814
#define GPIOD_ODR_Addr (GPIOD_BASE+20) //0x48000C14
#define GPIOE_ODR_Addr (GPIOE_BASE+20) //0x48001014
#define GPIOF_ODR_Addr (GPIOF_BASE+20) //0x48001414
#define GPIOA_IDR_Addr (GPIOA_BASE+16) //0x48000010
#define GPIOB_IDR_Addr (GPIOB_BASE+16) //0x48000410
#define GPIOC_IDR_Addr (GPIOC_BASE+16) //0x48000810
#define GPIOD_IDR_Addr (GPIOD_BASE+16) //0x48000C10
#define GPIOE_IDR_Addr (GPIOE_BASE+16) //0x48001010
#define GPIOF_IDR_Addr (GPIOF_BASE+16) //0x48001410
//IO¿Ú²Ù×÷,Ö»¶Ôµ¥Ò»µÄIO¿Ú!
//È·±£nµÄֵСÓÚ16!
#define PAout(n) BIT_ADDR(GPIOA_ODR_Addr,n) //Êä³ö
#define PAin(n) BIT_ADDR(GPIOA_IDR_Addr,n) //ÊäÈë
#define PBout(n) BIT_ADDR(GPIOB_ODR_Addr,n) //Êä³ö
#define PBin(n) BIT_ADDR(GPIOB_IDR_Addr,n) //ÊäÈë
#define PCout(n) BIT_ADDR(GPIOC_ODR_Addr,n) //Êä³ö
#define PCin(n) BIT_ADDR(GPIOC_IDR_Addr,n) //ÊäÈë
#define PDout(n) BIT_ADDR(GPIOD_ODR_Addr,n) //Êä³ö
#define PDin(n) BIT_ADDR(GPIOD_IDR_Addr,n) //ÊäÈë
#define PEout(n) BIT_ADDR(GPIOE_ODR_Addr,n) //Êä³ö
#define PEin(n) BIT_ADDR(GPIOE_IDR_Addr,n) //ÊäÈë
#define PFout(n) BIT_ADDR(GPIOF_ODR_Addr,n) //Êä³ö
#define PFin(n) BIT_ADDR(GPIOF_IDR_Addr,n) //ÊäÈë |