![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Trying to encode a configuration file and a set of instructions to be passed to a microcontroller
Dependencies: MODSERIAL Nanopb
Diff: main.cpp
- Revision:
- 2:89156c267f7a
- Parent:
- 1:5752892425a3
- Child:
- 3:49faa91b696e
--- a/main.cpp Sun Aug 18 19:03:28 2019 +0000 +++ b/main.cpp Sun Aug 18 19:14:59 2019 +0000 @@ -17,6 +17,8 @@ char cn = 0; char cnn = 0; volatile bool sent_flag = false; +Configuration config_o; +Configuration config_i; SetPoint set_point; SetPoint set_point_in; @@ -26,7 +28,10 @@ DigitalOut signal1(p26); //Green DigitalOut signal2(p25); //Red - +//Parameters +float r_set_array[5] = {0.5,0.53,0.55,0.56,0.5}; +int time_array[5] = {500,1000,1500,2500,3000}; +int trig_array[5] = {50,250,0,100,100}; void read_setpoint(){ if (pc.scanf("%d",&set_point_in_length) < 0){pc.printf("Error in reading message length");} @@ -82,14 +87,14 @@ { /* This is the buffer where we will store our message. */ pc.baud(115200); - + pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - + set_point.r_set_point = 0.5; set_point.time_point = 100; set_point.trig_time = 101; @@ -110,16 +115,7 @@ pc.getc(); pc.printf("\n Input your set point:\n"); read_setpoint(); - for (i=0;i<20;i++){ - pc.putc(buffer[i]); - pc.putc(buffer_in[i]); - if(buffer_in[i] == buffer[i]) {pc.putc('y');} - else {pc.putc('n');} - pc.printf("\n"); - } decode_setpoint(); - - return 0; }