diff options
author | imushir | 2015-12-28 16:08:36 +0530 |
---|---|---|
committer | imushir | 2015-12-28 16:08:36 +0530 |
commit | eb760e0368b6be3bc0f0a7f076bc74d25df0df62 (patch) | |
tree | 64d0fdc06c92478f9e15dd2b6def6fe4b369383b /macros/Scilab-Arduino/GenerateSetupFunction.sci | |
parent | b8c97a6580ea62ca9480504e66be2b2f5b1dc2ef (diff) | |
parent | d166736e0eb384156d30bcea45711d4c8d474ee1 (diff) | |
download | Scilab2C_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/GenerateSetupFunction.sci')
-rw-r--r-- | macros/Scilab-Arduino/GenerateSetupFunction.sci | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/macros/Scilab-Arduino/GenerateSetupFunction.sci b/macros/Scilab-Arduino/GenerateSetupFunction.sci new file mode 100644 index 0000000..db96e19 --- /dev/null +++ b/macros/Scilab-Arduino/GenerateSetupFunction.sci @@ -0,0 +1,34 @@ +function GenerateSetupFunction(FileInfo) + +SetupListFile = FileInfo.SetupListFile; + +load(SetupListFile,'SetupList'); + +SetupArduinoFile = fullfile(FileInfo.CStyleOutCCCodeDir,'setup_arduino.c'); +C_SCI2CHeader(SetupArduinoFile); + +PrintStringInfo('#include ""setup_arduino.h""',SetupArduinoFile,'file','y'); +PrintStringInfo(' ',SetupArduinoFile,'file','y'); +PrintStringInfo('int setup_arduino()',SetupArduinoFile,'file','y'); +PrintStringInfo('{',SetupArduinoFile,'file','y'); + +nelements=size(SetupList); + +for i=1:nelements + funcall = ' '; + funcall = funcall + SetupList(i)(1); + funcall = funcall + '('; + NInArg = size(SetupList(i))-1; + for j=1:NInArg-1 + funcall = funcall + SetupList(i)(j+1); + funcall = funcall + ', '; + end + funcall = funcall + SetupList(i)(NInArg+1); + funcall = funcall + ');'; + PrintStringInfo(funcall,SetupArduinoFile,'file','y'); +end +PrintStringInfo(' ',SetupArduinoFile,'file','y'); +PrintStringInfo(' return (0); ',SetupArduinoFile,'file','y'); +PrintStringInfo('}',SetupArduinoFile,'file','y'); + +endfunction |