Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
data_board.cpp
00001 #include "data_board.h" 00002 00003 00004 00005 00006 Serial foot(PA_9, PA_10); // tx, rx U1 00007 00008 unsigned int flag_foot_A = 0, flag_foot_B = 0; 00009 unsigned int Sfootnum = 0; 00010 00011 uint16_t Sfootget[10] = {0}; 00012 uint16_t Sfootuse[10] = {0}; 00013 00014 //////////////////////////////////////////////////////////////////////////////// 00015 // Gait_now 当前相位 Gait_per_now 当前步态时刻 Gait_change 步态改变标志位 00016 // Gait_num_valid 步数统计 time_portion_now 当前相位时间段 00017 //////////////////////////////////////////////////////////////////////////////// 00018 00019 unsigned int Gait_num_valid = 0, Gait_now = 0, Gait_per_now = 0, Gait_cycle_now = 0, time_portion_now=0; 00020 uint16_t Gait_per_now_int = 0, COP_Y_int = 0, COP_X_int = 0, Gait_cycle_now_int = 0, time_portion_now_int=0; 00021 00022 00023 unsigned int Gait_num_valid_0before = 0, Gait_now_0before = 0; 00024 float Gait_per_now_0before = 0.0f, COP_Y_0before = 0.0f, COP_X_0before = 0.0f, Gait_cycle_now_0before = 0.0f; 00025 00026 unsigned int Gait_num_valid_real = 0, Gait_now_real = 0, Gait_per_now_real = 0, Gait_cycle_now_real = 0.0f, time_portion_now_real=0.0f; 00027 00028 00029 void gait_decode() 00030 { 00031 Gait_now = Sfootuse[0]; 00032 Gait_per_now = Sfootuse[1]*100 + Sfootuse[2]*10 + Sfootuse[3]; 00033 time_portion_now = Sfootuse[4]*100000 + Sfootuse[5]*10000 + Sfootuse[6]*1000 + Sfootuse[7]*100 + Sfootuse[8]*10 + Sfootuse[9]; 00034 00035 00036 Gait_num_valid_real = Gait_num_valid; 00037 Gait_now_real = Gait_now; 00038 Gait_per_now_real = Gait_per_now; 00039 Gait_cycle_now_real = Gait_cycle_now; 00040 time_portion_now_real=time_portion_now; 00041 00042 command.printf("%01d---%03d---%06d\n",Gait_now_real,Gait_per_now_real,time_portion_now_real); 00043 } 00044 00045 void gait_clear() 00046 { 00047 for(int i = 0; i < 10; i++){ 00048 Sfootuse[i] = 0; 00049 } 00050 } 00051 00052 00053 void serial_board_isr(void) 00054 { 00055 // pc.printf("begin\n"); 00056 while(foot.readable()) 00057 { 00058 uint16_t c = foot.getc(); 00059 if(c == 'A') 00060 { 00061 flag_foot_A = 1; 00062 00063 flag_foot_B = 0; 00064 Sfootnum = 0; 00065 for(unsigned int i = 0; i < 10; i++) 00066 { 00067 Sfootget[i] = 0; 00068 } 00069 00070 break; 00071 } 00072 if(c == 'B') 00073 { 00074 flag_foot_B = 1; 00075 } 00076 00077 if(flag_foot_A == 1) 00078 { 00079 if((flag_foot_B != 1) && (Sfootnum < 10)) 00080 { 00081 Sfootget[Sfootnum] = c; 00082 } 00083 00084 Sfootnum++; 00085 00086 if((flag_foot_B == 1) && (Sfootnum != 11)) 00087 { 00088 flag_foot_A = 0; 00089 flag_foot_B = 0; 00090 Sfootnum = 0; 00091 } 00092 00093 if((flag_foot_B == 1) && (Sfootnum == 11)) 00094 { 00095 flag_foot_A = 0; 00096 flag_foot_B = 0; 00097 Sfootnum = 0; 00098 00099 for(unsigned int i = 0; i < 10; i++) 00100 { 00101 Sfootuse[i] = Sfootget[i] - '0'; 00102 } 00103 00104 gait_decode(); 00105 gait_clear(); 00106 } 00107 } 00108 } 00109 }
Generated on Wed Jul 13 2022 08:32:47 by
