mirror of
https://github.com/avem-labs/Avem.git
synced 2023-09-01 15:18:49 +08:00
refactor:(define) Syntax Enhancement
This commit is contained in:
parent
a1685191f4
commit
b566c7de4d
@ -13,7 +13,7 @@
|
||||
#define GPIOB_IDR_Addr (GPIOB_BASE + 8)
|
||||
#define READ_SDA BIT_ADDR(GPIOB_IDR_Addr, SDA_PINNUM)
|
||||
|
||||
#define IIC_DELAY() {delay_us(1);}
|
||||
#define IIC_DELAY() delay_us(1)
|
||||
|
||||
|
||||
|
||||
|
@ -16,20 +16,20 @@
|
||||
#define THROTTLE_MID (unsigned short)1650
|
||||
|
||||
#ifdef MOTOR_NORMAL_STARTUP
|
||||
#define MOTOR_SETTING() {\
|
||||
#define MOTOR_SETTING() do {\
|
||||
motor_PWM_Init(36000,40);\
|
||||
MOTOR_ALL = THROTTLE_MIN;\
|
||||
delay(4000);\
|
||||
MOTOR_ALL = THROTTLE_MID;\
|
||||
}
|
||||
} while(0)
|
||||
#else
|
||||
#define MOTOR_SETTING() {\
|
||||
#define MOTOR_SETTING() do {\
|
||||
motor_PWM_Init(36000,40);\
|
||||
MOTOR_ALL = THROTTLE_MAX;\
|
||||
delay(3000);\
|
||||
MOTOR_ALL = THROTTLE_MIN;\
|
||||
delay(8000);\
|
||||
}
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
void motor_PWM_Init(unsigned short arr, unsigned short psc); //72MHz / (arr + 1)*(psc + 1)
|
||||
|
@ -7,10 +7,10 @@ void uart_showData(short k); //THIS FUNCTION IS NOT SO GOOD, EG: uart_showDat
|
||||
unsigned char uart_Float2Char(float value);
|
||||
void uart_sendStr(char * cmd);
|
||||
|
||||
#define UART_CR() {\
|
||||
#define UART_CR() do {\
|
||||
uart_sendData(0x0D);\
|
||||
uart_sendData(0x0A);\
|
||||
}
|
||||
#define UART_CLEAR() {uart_sendStr("\033[H\033[J");}
|
||||
} while(0)
|
||||
#define UART_CLEAR() uart_sendStr("\033[H\033[J")
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user