佚名通过本文主要向大家介绍了stm32宏定义,stm32相关书籍,stm32相关论文,stm32相关文献,带参宏等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: STM32带参宏相关问题
描述:
解决方案1:
描述:
各位大大小弟刚开始学32,其中下面这段代码不太理解,能帮忙看看嘛?非常感谢
#include "stm32f10x.h"
/** the macro definition to trigger the led on or off
* 1 - off
#define ON 0
GPIO_SetBits(GPIOF,GPIO_Pin_7);\
else \
GPIO_ResetBits(GPIOF,GPIO_Pin_7)
#define LED3(a) if (a) \
解决方案1:
#define LED1(a) if (a) \
GPIO_SetBits(GPIOB,GPIO_Pin_0);\
else \
GPIO_ResetBits(GPIOB,GPIO_Pin_0)
这么写你就明白了
void LED1(unsigned char a)
{
if( a )
{
GPIO_SetBits(GPIOB,GPIO_Pin_0);
}
else
{
GPIO_ResetBits(GPIOB,GPIO_Pin_0);
}
}