1 /*---------------------------------------------------------------
\r
2 ## Receive Interruption of the Serial ##
\r
3 -> used to receive & process user command
\r
4 -> and configure the board accordingly
\r
5 ---------------------------------------------------------------*/
\r
6 /*void serialRx_interrupt_userFriendlyVersion(){
\r
7 clock1.detach(); // close the interrupt
\r
8 serial.printf("\r\n");
\r
10 // Receive the Serial Input
\r
14 char ch = serial.getc();
\r
16 for (i=0 ; ch!='\n' && ch!='\r'; i++){
\r
19 if (ch==127){ // BackSpace
\r
26 serial.printf("\r\nBUFFER: %s %d\r\n", buffer,i);
\r
27 // TODO: buffer -> lower case
\r
29 // Process the Serial Input
\r
30 // Set-Interval Command
\r
31 if (strstr(buffer, "set")!=NULL && strstr(buffer, "int")!= NULL){
\r
32 sscanf(buffer, "%*[^0123456789.]%s", temp); // find the number in buffer
\r
33 sscanf(temp, "%f", &interval); // translate into float
\r
34 if (interval<0.1 || interval>5){
\r
37 if (strstr(buffer, "acc")){
\r
40 if (strstr(buffer, "mag")){
\r
43 if (strstr(buffer, "light")){
\r
46 if (strstr(buffer, "touch")){
\r
52 else if (strstr(buffer, "stop")!= NULL){
\r
53 serial.printf("STOP\r\n");
\r
54 if (strstr(buffer, "acc")){
\r
56 accTmr = ACC_SNS_DEFAULT;
\r
58 if (strstr(buffer, "mag")){
\r
60 magTmr = MAG_SNS_DEFAULT;
\r
62 if (strstr(buffer, "light")){
\r
64 lgtTmr = LGT_SNS_DEFAULT;
\r
66 if (strstr(buffer, "touch")){
\r
68 tchTmr = TCH_SNS_DEFAULT;
\r
73 else if (strstr(buffer, "start")!=NULL){
\r
74 if (strstr(buffer, "acc") && !accEnable){
\r
76 accTmr = ACC_SNS_DEFAULT;
\r
78 if (strstr(buffer, "mag") && !magEnable){
\r
80 magTmr = MAG_SNS_DEFAULT;
\r
82 if (strstr(buffer, "light") && !lgtEnable){
\r
84 lgtTmr = LGT_SNS_DEFAULT;
\r
86 if (strstr(buffer, "touch") && !tchEnable){
\r
88 tchTmr = TCH_SNS_DEFAULT;
\r
91 clock1.attach(&clock1_interrupt,TIME_ACCURACY);
\r