一、多行宏定义的使用
最近在跟STM32L011K4T6低功耗的源代码,发现使用了多行的宏定义来封装函数,记得之前把给删除掉,编译程序就一直报错。
是续行操作符,也就是宏定义一行写不完,需要多行写,就需要在每一行的后面加上续行操作符,注意字符
后要紧跟回车键,中间不能有空格或其他字符。
#define __HAL_RCC_GPIOC_CLK_ENABLE() do {
__IO uint32_t tmpreg;
SET_BIT(RCC->IOPENR, RCC_IOPENR_GPIOCEN);
/* Delay after an RCC peripheral clock enabling */
tmpreg = READ_BIT(RCC->IOPENR, RCC_IOPENR_GPIOCEN);
UNUSED(tmpreg);
} while(0)
二、参考文档
http://www.xuebuyuan.com/2039830.html
http://blog.csdn.net/shaodongju/article/details/51578186
http://www.cnblogs.com/doctorqbw/archive/2011/11/14/2248628.html
by 羊羊得亿
2017-10-10 ShenZhen