|
板凳
楼主 |
发表于 2020-2-16 03:38:11
|
只看该作者
#define Trigger1_GPIO_PORT GPIOB
#define Trigger1_GPIO_CLK RCC_APB2Periph_GPIOB
#define Trigger1 GPIO_Pin_9
#define Trigger2_GPIO_PORT GPIOB
#define Trigger2_GPIO_CLK RCC_APB2Periph_GPIOB
#define Trigger2 GPIO_Pin_10
#define High(p,i) {p->BSRR=i}
#define LOW(p,i) {p->BRR=i}
#define On1 High(Trigger1_GPIO_PORT,Trigger1)
#define Off1 LOW(Trigger1_GPIO_PORT,Trigger1)
#define On2 High(Trigger2_GPIO_PORT,Trigger2)
#define Off2 LOW(Trigger2_GPIO_PORT,Trigger2)
#define initialize Off1;Off2;SOFT_DELAY
#define serious injury On1;SOFT_DELAY;Off1
#define slight injury On2;SOFT_DELAY;Off2
void Trigger_Config(void)
{ GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(Trigger1_GPIO_CLK |Trigger2_GPIO_CLK,ENABLE);
GPIO_InitStructure.GPIO_Pin=Trigger1|Trigger2;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(Trigger1_GPIO_PORT,&GPIO_InitStructure);
GPIO_Init(Trigger2_GPIO_PORT,&GPIO_InitStructure);
GPIO_RsetBits(Trigger1_GPIO_PORT,Trigger1);
GPIO_RsetBits(Trigger2_GPIO_PORT,Trigger2);
} |
|