|
|
@ -43,42 +43,68 @@ void start_up(void) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//================================================================ |
|
|
|
//================================================================ |
|
|
|
//屏幕串口部分 |
|
|
|
extern uint8_t g_lcd_rxbuf_isready;//lcd数据接收过程中为真,接收完成为假 |
|
|
|
extern volatile char lcd_rxbuff[50] = {0}; |
|
|
|
extern volatile int32_t lcd_count = 0; |
|
|
|
extern uint8_t g_lcd_rxbuf_isready;//lcd数据接收过程中为真,接收完成为假 |
|
|
|
extern uint32_t g_process_recv_lcd_data_time = 0; |
|
|
|
|
|
|
|
uint32_t judge_recv_lcd_data_finish_main(uint32_t time) |
|
|
|
void judge_recv_lcd_data_finish_main(uint32_t time) |
|
|
|
{ |
|
|
|
/** |
|
|
|
* @brief 接收LCD的数据完成 |
|
|
|
*/ |
|
|
|
static uint32_t recv_lcd_data_time = 0; |
|
|
|
recv_lcd_data_time = time; |
|
|
|
if(recv_lcd_data_time=0) |
|
|
|
{ |
|
|
|
recv_lcd_data_time = hal_get_ticket(); |
|
|
|
return recv_lcd_data_time; |
|
|
|
} |
|
|
|
else if (hal_has_passedms(recv_lcd_data_time) > 10) { |
|
|
|
g_lcd_rxbuf_isready=false; |
|
|
|
recv_lcd_data_time = hal_get_ticket(); |
|
|
|
send_cmd_to_lcd(lcd_rxbuff,lcd_count);//接收完成将数据发给电脑 |
|
|
|
lcd_count=0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
static uint32_t recv_lcd_data_time = 0; |
|
|
|
recv_lcd_data_time = time; |
|
|
|
if (hal_has_passedms(recv_lcd_data_time) > 10) { |
|
|
|
g_lcd_rxbuf_isready=false; |
|
|
|
recv_lcd_data_time = hal_get_ticket(); |
|
|
|
send_cmd_to_lcd(lcd_rxbuff,lcd_count);//接收完成将数据发给电脑 |
|
|
|
lcd_count=0; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//================================================================ |
|
|
|
//================================================================ |
|
|
|
//电机串口部分 |
|
|
|
extern uint8_t g_motor_rxbuf_isready;//lcd数据接收过程中为真,接收完成为假 |
|
|
|
extern volatile char motor_rxbuff[50] = {0}; |
|
|
|
extern volatile int32_t motor_count = 0; |
|
|
|
extern uint32_t g_process_recv_motor_data_time = 0; |
|
|
|
void judge_recv_motor_data_finish_main(uint32_t time) |
|
|
|
{ |
|
|
|
/** |
|
|
|
* @brief 接收motor的数据完成 |
|
|
|
*/ |
|
|
|
static uint32_t recv_motor_data_time = 0; |
|
|
|
recv_motor_data_time = time; |
|
|
|
if (hal_has_passedms(recv_motor_data_time) > 10) { |
|
|
|
g_lcd_rxbuf_isready=false; |
|
|
|
recv_motor_data_time = hal_get_ticket(); |
|
|
|
send_cmd_to_motor(motor_rxbuff,motor_count);//接收完成将数据发给电脑 |
|
|
|
send_cmd_to_lcd(motor_rxbuff,motor_count);//接收完成将数据发给电脑 |
|
|
|
motor_count=0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void main() |
|
|
|
{ |
|
|
|
peripheral_config();//各种初始化包括ram清零 |
|
|
|
uint32_t record_last_time=0; |
|
|
|
while (1) |
|
|
|
{ |
|
|
|
debug_light_ctrl_process_in_main_loop();//闪灯效果 |
|
|
|
if(g_lcd_rxbuf_isready)//接收开始 |
|
|
|
{ |
|
|
|
record_last_time = judge_recv_lcd_data_finish_main(record_last_time); |
|
|
|
judge_recv_lcd_data_finish_main(g_process_recv_lcd_data_time); |
|
|
|
} |
|
|
|
if(g_motor_rxbuf_isready) |
|
|
|
{ |
|
|
|
judge_recv_motor_data_finish_main(g_process_recv_motor_data_time); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|