/*--------------------------------------------------------------- ## Receive Interruption of the Serial ## -> used to receive & process user command -> and configure the board accordingly ---------------------------------------------------------------*/ /*void serialRx_interrupt_userFriendlyVersion(){ clock1.detach(); // close the interrupt serial.printf("\r\n"); // Receive the Serial Input float interval; char buffer[255]; char temp[255]; char ch = serial.getc(); int i; for (i=0 ; ch!='\n' && ch!='\r'; i++){ serial.putc(ch); buffer[i] = ch; if (ch==127){ // BackSpace i--; i--; } ch = serial.getc(); } buffer[i] = '\0'; serial.printf("\r\nBUFFER: %s %d\r\n", buffer,i); // TODO: buffer -> lower case // Process the Serial Input // Set-Interval Command if (strstr(buffer, "set")!=NULL && strstr(buffer, "int")!= NULL){ sscanf(buffer, "%*[^0123456789.]%s", temp); // find the number in buffer sscanf(temp, "%f", &interval); // translate into float if (interval<0.1 || interval>5){ interval = 1; } if (strstr(buffer, "acc")){ accTmr = interval; } if (strstr(buffer, "mag")){ magTmr = interval; } if (strstr(buffer, "light")){ lgtTmr = interval; } if (strstr(buffer, "touch")){ tchTmr = interval; } } // Stop Command else if (strstr(buffer, "stop")!= NULL){ serial.printf("STOP\r\n"); if (strstr(buffer, "acc")){ accEnable = false; accTmr = ACC_SNS_DEFAULT; } if (strstr(buffer, "mag")){ magEnable = false; magTmr = MAG_SNS_DEFAULT; } if (strstr(buffer, "light")){ lgtEnable = false; lgtTmr = LGT_SNS_DEFAULT; } if (strstr(buffer, "touch")){ tchEnable = false; tchTmr = TCH_SNS_DEFAULT; } } // Start Command else if (strstr(buffer, "start")!=NULL){ if (strstr(buffer, "acc") && !accEnable){ accEnable = true; accTmr = ACC_SNS_DEFAULT; } if (strstr(buffer, "mag") && !magEnable){ magEnable = true; magTmr = MAG_SNS_DEFAULT; } if (strstr(buffer, "light") && !lgtEnable){ lgtEnable = true; lgtTmr = LGT_SNS_DEFAULT; } if (strstr(buffer, "touch") && !tchEnable){ tchEnable = true; tchTmr = TCH_SNS_DEFAULT; } } clock1.attach(&clock1_interrupt,TIME_ACCURACY); } */