void usart_sendString(char * str) { unsigned int i = 0; unsigned int l = strlen(str); for (i = 0; i < l; i++) { usart_sendByte(str[i]); } }
void usart_sendBytes(USART_TypeDef *usart, u8 *buffer, u16 len) { u16 i; for(i=0; i<len; i++){ usart_sendByte(usart, buffer[i]); } }
int main() { rcc_clock_enable(); delay_config(); usart6_init(115200); STM_EVAL_LEDInit(LED3); STM_EVAL_LEDInit(LED4); STM_EVAL_LEDInit(LED5); STM_EVAL_LEDInit(LED6); //android远程控制初始化 remote_control_init(); //红外测距模块ADC初始化 adc_tim_trig_config(500, 8400); //电机初始化 motor_init(); //光电开关初始化 light_senser_init(); //编码器初始化 capture_config(); //系统运行时间初始化 micros_time_init(); #ifndef DEBUG_HAHA // //等待开始信号 // usart_wait_signal(); // //发送应答信号 // usart_send_signal(); while(remote_flag == 0); if(car_mode == MODE_SINGLE){ usart_sendByte(USART6, '1'); } else{ usart_sendByte(USART6, '0'); } //设置小车前进速度 car_set_global_speed(); #endif STM_EVAL_LEDOn(LED3); while(1){ #ifdef DEBUG_HAHA my_debug(); #else control_process(); #endif } }
void usart_send_signal(void) { usart_sendByte(USART6, 'a'); }