forked from logzhan/RobotHardware-UESTC
50 lines
1.2 KiB
C
50 lines
1.2 KiB
C
|
#ifndef __BSP_GPIO_H
|
|||
|
#define __BSP_GPIO_H
|
|||
|
|
|||
|
#include "stm32f10x.h"
|
|||
|
|
|||
|
/** the macro definition to trigger the led on or off
|
|||
|
* 1 - off
|
|||
|
*0 - on
|
|||
|
*/
|
|||
|
#define ON 0
|
|||
|
#define OFF 1
|
|||
|
//<2F><><EFBFBD><EFBFBD>LED1
|
|||
|
#define LED1_CLK RCC_APB2Periph_GPIOC
|
|||
|
#define LED1_PORT GPIOC
|
|||
|
#define LED1_Pin GPIO_Pin_13
|
|||
|
|
|||
|
|
|||
|
/* <20><><EFBFBD>κ꣬<CEBA><EAA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ʹ<EFBFBD><CAB9> */
|
|||
|
#define LED1(a) if (a) \
|
|||
|
GPIO_SetBits(LED1_PORT,LED1_Pin);\
|
|||
|
else \
|
|||
|
GPIO_ResetBits(LED1_PORT,LED1_Pin)
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
///* ֱ<>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IO */
|
|||
|
//#define digitalHi(p,i) {p->BSRR=i;} //<2F><><EFBFBD><EFBFBD>Ϊ<EFBFBD>ߵ<EFBFBD>ƽ
|
|||
|
//#define digitalLo(p,i) {p->BRR=i;} //<2F><><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>ƽ
|
|||
|
//#define digitalToggle(p,i) {p->ODR ^=i;} //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת״̬
|
|||
|
//
|
|||
|
//
|
|||
|
///* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IO<49>ĺ<EFBFBD> */
|
|||
|
//#define LED1_TOGGLE digitalToggle(GPIOB,GPIO_Pin_0)
|
|||
|
//#define LED1_OFF digitalHi(GPIOB,GPIO_Pin_0)
|
|||
|
//#define LED1_ON digitalLo(GPIOB,GPIO_Pin_0)
|
|||
|
//
|
|||
|
//#define LED2_TOGGLE digitalToggle(GPIOF,GPIO_Pin_7)
|
|||
|
//#define LED2_OFF digitalHi(GPIOF,GPIO_Pin_7)
|
|||
|
//#define LED2_ON digitalLo(GPIOF,GPIO_Pin_7)
|
|||
|
//
|
|||
|
//#define LED3_TOGGLE digitalToggle(GPIOF,GPIO_Pin_8)
|
|||
|
//#define LED3_OFF digitalHi(GPIOF,GPIO_Pin_8)
|
|||
|
//#define LED3_ON digitalLo(GPIOF,GPIO_Pin_8)
|
|||
|
|
|||
|
void LED_GPIO_Config(void);
|
|||
|
void LED_Flash(int timer);
|
|||
|
|
|||
|
#endif /* __LED_H */
|