summaryrefslogtreecommitdiff
path: root/macros/Scilab-Arduino/InsertSetupInList.sci
diff options
context:
space:
mode:
authorimushir2016-02-09 16:38:27 +0530
committerimushir2016-02-09 16:38:27 +0530
commitee5bf4d90f78673d1e4d5a9dd304ee53c503c085 (patch)
tree696221a8f8a3dffeb50d12ea287dfbdfab919fc6 /macros/Scilab-Arduino/InsertSetupInList.sci
parent8ee41aca4183a0239b9cb220de3f159b1f0910fb (diff)
downloadscilab2c-ee5bf4d90f78673d1e4d5a9dd304ee53c503c085.tar.gz
scilab2c-ee5bf4d90f78673d1e4d5a9dd304ee53c503c085.tar.bz2
scilab2c-ee5bf4d90f78673d1e4d5a9dd304ee53c503c085.zip
Support for Servo motor for Arduino. Support for'diag' in c
Diffstat (limited to 'macros/Scilab-Arduino/InsertSetupInList.sci')
-rw-r--r--macros/Scilab-Arduino/InsertSetupInList.sci118
1 files changed, 63 insertions, 55 deletions
diff --git a/macros/Scilab-Arduino/InsertSetupInList.sci b/macros/Scilab-Arduino/InsertSetupInList.sci
index 5c6be8bb..b73910f2 100644
--- a/macros/Scilab-Arduino/InsertSetupInList.sci
+++ b/macros/Scilab-Arduino/InsertSetupInList.sci
@@ -1,58 +1,66 @@
function InsertSetupInList(FunName,InArg,NInArg,SetupListFile,FunType)
-load(SetupListFile,'SetupList');
-
-//Check first if current input function already exists in the list
-nelements = size(SetupList);
-found=%F;
-
-if(FunType=='Setup')
- for i=1:nelements
- if(SetupList(i)(1) == FunName)
- for j=1:NInArg
- if(SetupList(i)(j+1) ~= InArg(j).Name)
- found = %F
- break;
- else
- found = %T;
- end
- end
- end
- if (found == %T)
- break; //One match found. No need to check further.
- end
- end
-
- if(found == %F)
- temp = list(FunName);
- for i=1:NInArg
- temp($+1) = InArg(i).Name;
- end
- end
- SetupList($+1) = temp;
-elseif((FunType=='Init')&((FunName=='cmd_digital_out')|(FunName=='cmd_analog_out')|(FunName=='cmd_digital_in')))
- for i=1:nelements
- if(SetupList(i)(1) == FunName)
- if(SetupList(i)(2) == InArg(2).Name)
- found = %T
- break;
- else
- found = %F;
- end
- end
- end
-
- if(found == %F)
- temp = list('pinMode');
- temp($+1) = InArg(2).Name;
- if ((FunName=='cmd_digital_out')|(FunName=='cmd_analog_out'))
- temp($+1) = 'OUTPUT';
- elseif (FunName == 'cmd_digital_in')
- temp($+1) = 'INPUT';
- end
- end
- SetupList($+1) = temp;
-end
-
-save(SetupListFile,'SetupList');
+ load(SetupListFile,'SetupList');
+
+ //Check first if current input function already exists in the list
+ nelements = size(SetupList);
+
+ found=%F;
+ if(FunType=='Setup')
+ for i=1:nelements
+ if(SetupList(i)(1) == FunName)
+ for j=1:NInArg
+ if(SetupList(i)(j+1) ~= InArg(j).Name)
+ found = %F
+ break;
+ else
+ found = %T;
+ end
+ end
+ end
+ if (found == %T)
+ break; //One match found. No need to check further.
+ end
+ end
+
+ if(found == %F)
+ temp = list(FunName);
+ for i=1:NInArg
+ temp($+1) = InArg(i).Name;
+ end
+ end
+ SetupList($+1) = temp;
+ elseif((FunType=='Init')&((FunName=='cmd_digital_out')|(FunName=='cmd_analog_out')|(FunName=='cmd_digital_in')))
+ for i=1:nelements
+ if(SetupList(i)(1) == "pinMode")
+ if(SetupList(i)(2) == InArg(2).Name)
+ found = %T
+ break;
+ else
+ found = %F;
+ end
+ else
+
+ found = %F;
+
+ end
+
+ end
+
+ if(found == %F)
+ temp = list('pinMode');
+ temp($+1) = InArg(2).Name;
+ if ((FunName=='cmd_digital_out')|(FunName=='cmd_analog_out'))
+ temp($+1) = 'OUTPUT';
+ elseif ((FunName == 'cmd_digital_in') | (FunName=='cmd_analog_in'))
+ temp($+1) = 'INPUT';
+ end
+ SetupList($+1) = temp;
+
+ end
+
+
+ end
+ save(SetupListFile,'SetupList');
+
endfunction