summaryrefslogtreecommitdiff
path: root/macros/Scilab-Arduino/InsertSetupInList.sci
diff options
context:
space:
mode:
authorimushir2015-12-28 16:08:36 +0530
committerimushir2015-12-28 16:08:36 +0530
commiteb760e0368b6be3bc0f0a7f076bc74d25df0df62 (patch)
tree64d0fdc06c92478f9e15dd2b6def6fe4b369383b /macros/Scilab-Arduino/InsertSetupInList.sci
parentb8c97a6580ea62ca9480504e66be2b2f5b1dc2ef (diff)
parentd166736e0eb384156d30bcea45711d4c8d474ee1 (diff)
downloadScilab2C_fossee_old-eb760e0368b6be3bc0f0a7f076bc74d25df0df62.tar.gz
Scilab2C_fossee_old-eb760e0368b6be3bc0f0a7f076bc74d25df0df62.tar.bz2
Scilab2C_fossee_old-eb760e0368b6be3bc0f0a7f076bc74d25df0df62.zip
Merge branch 'master' of https://github.com/siddhu8990/Scilab2C
Fetching master
Diffstat (limited to 'macros/Scilab-Arduino/InsertSetupInList.sci')
-rw-r--r--macros/Scilab-Arduino/InsertSetupInList.sci58
1 files changed, 58 insertions, 0 deletions
diff --git a/macros/Scilab-Arduino/InsertSetupInList.sci b/macros/Scilab-Arduino/InsertSetupInList.sci
new file mode 100644
index 0000000..5c6be8b
--- /dev/null
+++ b/macros/Scilab-Arduino/InsertSetupInList.sci
@@ -0,0 +1,58 @@
+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');
+endfunction