diff options
Diffstat (limited to 'macros/Scilab-Arduino')
-rw-r--r-- | macros/Scilab-Arduino/GenerateSetupFunction.bin | bin | 0 -> 6136 bytes | |||
-rw-r--r-- | macros/Scilab-Arduino/GenerateSetupFunction.sci | 56 | ||||
-rw-r--r-- | macros/Scilab-Arduino/GetArduinoFunctions.bin | bin | 0 -> 2100 bytes | |||
-rw-r--r-- | macros/Scilab-Arduino/GetArduinoFunctions.sci | 35 | ||||
-rw-r--r-- | macros/Scilab-Arduino/GetArduinoSetupFunctions.bin | bin | 0 -> 1640 bytes | |||
-rw-r--r-- | macros/Scilab-Arduino/GetArduinoSetupFunctions.sci | 29 | ||||
-rw-r--r-- | macros/Scilab-Arduino/InsertSetupInList.bin | bin | 0 -> 8832 bytes | |||
-rw-r--r-- | macros/Scilab-Arduino/InsertSetupInList.sci | 91 | ||||
-rw-r--r-- | macros/Scilab-Arduino/IsArduinoFunction.bin | bin | 0 -> 2664 bytes | |||
-rw-r--r-- | macros/Scilab-Arduino/IsArduinoFunction.sci | 32 | ||||
-rw-r--r-- | macros/Scilab-Arduino/IsArduinoSetupFunction.bin | bin | 0 -> 2712 bytes | |||
-rw-r--r-- | macros/Scilab-Arduino/IsArduinoSetupFunction.sci | 32 | ||||
-rw-r--r-- | macros/Scilab-Arduino/buildmacros.sce | 29 | ||||
-rw-r--r-- | macros/Scilab-Arduino/lib | bin | 0 -> 552 bytes | |||
-rw-r--r-- | macros/Scilab-Arduino/names | 6 |
15 files changed, 310 insertions, 0 deletions
diff --git a/macros/Scilab-Arduino/GenerateSetupFunction.bin b/macros/Scilab-Arduino/GenerateSetupFunction.bin Binary files differnew file mode 100644 index 0000000..0051630 --- /dev/null +++ b/macros/Scilab-Arduino/GenerateSetupFunction.bin diff --git a/macros/Scilab-Arduino/GenerateSetupFunction.sci b/macros/Scilab-Arduino/GenerateSetupFunction.sci new file mode 100644 index 0000000..19cf4b8 --- /dev/null +++ b/macros/Scilab-Arduino/GenerateSetupFunction.sci @@ -0,0 +1,56 @@ +// Copyright (C) 2016 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function GenerateSetupFunction(FileInfo) +// ----------------------------------------------------------------- +// Generate setup functions for Arduino peripherals according to +// entries in given input file +// +// Input data: +// File containing required peripheral initialisation +// +// Output data: +// generates file with setup functions +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + + +SetupListFile = FileInfo.SetupListFile; +load(SetupListFile,'SetupList'); + +SetupArduinoFile = fullfile(FileInfo.CStyleOutCCCodeDir,'setup_arduino.c'); +SetupArduinoFile = fullfile(FileInfo.CStyleOutCCCodeDir,'setup_arduino.cpp'); +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 diff --git a/macros/Scilab-Arduino/GetArduinoFunctions.bin b/macros/Scilab-Arduino/GetArduinoFunctions.bin Binary files differnew file mode 100644 index 0000000..fe9e204 --- /dev/null +++ b/macros/Scilab-Arduino/GetArduinoFunctions.bin diff --git a/macros/Scilab-Arduino/GetArduinoFunctions.sci b/macros/Scilab-Arduino/GetArduinoFunctions.sci new file mode 100644 index 0000000..a112fe6 --- /dev/null +++ b/macros/Scilab-Arduino/GetArduinoFunctions.sci @@ -0,0 +1,35 @@ +// Copyright (C) 2016 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function ArduinoFunctions = GetArduinoFunctions() +// ----------------------------------------------------------------- +// Get list of Arduino functions supported +// +// Input data: +// None +// +// Output data: +// List of Arduino functions supported +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +ArduinoFunctions = [ + "cmd_digital_out" + "cmd_digital_in" + "cmd_analog_out" + "cmd_analog_in" + "cmd_dcmotor_setup" + "cmd_dcmotor_run" + "cmd_servo_attach" + "cmd_servo_detach" + "cmd_servo_move"]; + +endfunction diff --git a/macros/Scilab-Arduino/GetArduinoSetupFunctions.bin b/macros/Scilab-Arduino/GetArduinoSetupFunctions.bin Binary files differnew file mode 100644 index 0000000..67f9fad --- /dev/null +++ b/macros/Scilab-Arduino/GetArduinoSetupFunctions.bin diff --git a/macros/Scilab-Arduino/GetArduinoSetupFunctions.sci b/macros/Scilab-Arduino/GetArduinoSetupFunctions.sci new file mode 100644 index 0000000..d2cd0c7 --- /dev/null +++ b/macros/Scilab-Arduino/GetArduinoSetupFunctions.sci @@ -0,0 +1,29 @@ +// Copyright (C) 2016 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function ArduinoSetupFunctions = GetArduinoSetupFunctions() +// ----------------------------------------------------------------- +// Get list of Arduino setup functions supported +// +// Input data: +// None +// +// Output data: +// List of Arduino setup functions supported +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +ArduinoSetupFunctions = [ + "cmd_dcmotor_setup" + "cmd_servo_attach" + "cmd_servo_detach"]; + +endfunction diff --git a/macros/Scilab-Arduino/InsertSetupInList.bin b/macros/Scilab-Arduino/InsertSetupInList.bin Binary files differnew file mode 100644 index 0000000..29e3731 --- /dev/null +++ b/macros/Scilab-Arduino/InsertSetupInList.bin diff --git a/macros/Scilab-Arduino/InsertSetupInList.sci b/macros/Scilab-Arduino/InsertSetupInList.sci new file mode 100644 index 0000000..6584f29 --- /dev/null +++ b/macros/Scilab-Arduino/InsertSetupInList.sci @@ -0,0 +1,91 @@ +// Copyright (C) 2016 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function InsertSetupInList(FunName,InArg,NInArg,SetupListFile,FunType) +// ----------------------------------------------------------------- +// Generate list of setup functions required acorginto peripherals used +// +// Input data: +// FunName: scilab-arduino toolbox function +// InArg: input arguments for above mentioned function +// NInArg: no of input arguments for above mentioned function +// SetupListFile: file containing list of setup functions +// FunType: Gpio function or initialisation function for any other perpheral +// +// Output data: +// List of setup functions for Arduino +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + + 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 diff --git a/macros/Scilab-Arduino/IsArduinoFunction.bin b/macros/Scilab-Arduino/IsArduinoFunction.bin Binary files differnew file mode 100644 index 0000000..5dbfaca --- /dev/null +++ b/macros/Scilab-Arduino/IsArduinoFunction.bin diff --git a/macros/Scilab-Arduino/IsArduinoFunction.sci b/macros/Scilab-Arduino/IsArduinoFunction.sci new file mode 100644 index 0000000..d98f5cd --- /dev/null +++ b/macros/Scilab-Arduino/IsArduinoFunction.sci @@ -0,0 +1,32 @@ +// Copyright (C) 2016 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function Output = IsArduinoFunction(FunName) +// ----------------------------------------------------------------- +// Check whether input function name is an Arduino function or not. +// +// Input data: +// FunName: Name of the function to be checked +// +// Output data: +// Output: True or False depending whether given function is an +// Arduino function or not +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +//Get list of supported functions for Arduino +ArduinoFunctions = GetArduinoFunctions(); + +//Check whether input function is present in above list or not +FunNameInArduino = members(FunName,ArduinoFunctions); +Output = bool2s(FunNameInArduino~=0); + +endfunction diff --git a/macros/Scilab-Arduino/IsArduinoSetupFunction.bin b/macros/Scilab-Arduino/IsArduinoSetupFunction.bin Binary files differnew file mode 100644 index 0000000..8948d1a --- /dev/null +++ b/macros/Scilab-Arduino/IsArduinoSetupFunction.bin diff --git a/macros/Scilab-Arduino/IsArduinoSetupFunction.sci b/macros/Scilab-Arduino/IsArduinoSetupFunction.sci new file mode 100644 index 0000000..3e1c18f --- /dev/null +++ b/macros/Scilab-Arduino/IsArduinoSetupFunction.sci @@ -0,0 +1,32 @@ +// Copyright (C) 2016 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function Output = IsArduinoSetupFunction(FunName) +// ----------------------------------------------------------------- +// Check whether input function name is an Arduino setup function or not. +// +// Input data: +// FunName: Name of the function to be checked +// +// Output data: +// Output: True or False depending whether given function is an +// Arduino setup function or not +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +//Get list of supported functions for Arduino +ArduinoSetupFunctions = GetArduinoSetupFunctions(); + +//Check whether input function is present in above list or not +FunNameInArduinoSetup = members(FunName,ArduinoSetupFunctions); +Output = bool2s(FunNameInArduinoSetup~=0); + +endfunction diff --git a/macros/Scilab-Arduino/buildmacros.sce b/macros/Scilab-Arduino/buildmacros.sce new file mode 100644 index 0000000..dfeb475 --- /dev/null +++ b/macros/Scilab-Arduino/buildmacros.sce @@ -0,0 +1,29 @@ +// This file is released into the public domain + +Directories = [ "ASTManagement", ... + "CCodeGeneration", ... + "ErrorMessages", ... + "findDeps", ... + "FunctionAnnotation", ... + "FunctionList", ... + "GeneralFunctions", ... + "SymbolTable", ... + "ToolInitialization"... + "Hardware/AVR"... + "Scilab-Arduino" ]; + + +current_path_buildmacros = get_absolute_file_path("buildmacros.sce"); + +for K=1:size(Directories,"*") + myfile = current_path_buildmacros + filesep() + Directories(K) + filesep() + "buildmacros.sce"; + if isfile(myfile) then + exec(myfile); + end +end + +clear current_path_buildmacros; + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/Scilab-Arduino/lib b/macros/Scilab-Arduino/lib Binary files differnew file mode 100644 index 0000000..cd911ee --- /dev/null +++ b/macros/Scilab-Arduino/lib diff --git a/macros/Scilab-Arduino/names b/macros/Scilab-Arduino/names new file mode 100644 index 0000000..55eb6fe --- /dev/null +++ b/macros/Scilab-Arduino/names @@ -0,0 +1,6 @@ +GenerateSetupFunction +GetArduinoFunctions +GetArduinoSetupFunctions +InsertSetupInList +IsArduinoFunction +IsArduinoSetupFunction |