summaryrefslogtreecommitdiff
path: root/2.3-1/macros/Scilab-Arduino
diff options
context:
space:
mode:
authoryash11122017-07-07 21:20:49 +0530
committeryash11122017-07-07 21:20:49 +0530
commit9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 (patch)
treef50d6e06d8fe6bc1a9053ef10d4b4d857800ab51 /2.3-1/macros/Scilab-Arduino
downloadScilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.tar.gz
Scilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.tar.bz2
Scilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.zip
sci2c arduino updated
Diffstat (limited to '2.3-1/macros/Scilab-Arduino')
-rw-r--r--2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci56
-rw-r--r--2.3-1/macros/Scilab-Arduino/GetArduinoFunctions.sci36
-rw-r--r--2.3-1/macros/Scilab-Arduino/GetArduinoSetupFunctions.sci31
-rw-r--r--2.3-1/macros/Scilab-Arduino/InsertSetupInList.sci91
-rw-r--r--2.3-1/macros/Scilab-Arduino/IsArduinoFunction.sci32
-rw-r--r--2.3-1/macros/Scilab-Arduino/IsArduinoSetupFunction.sci34
-rw-r--r--2.3-1/macros/Scilab-Arduino/buildmacros.sce29
-rw-r--r--2.3-1/macros/Scilab-Arduino/cmd_i2c_dev.sci3
-rw-r--r--2.3-1/macros/Scilab-Arduino/cmd_i2c_read.sci2
-rw-r--r--2.3-1/macros/Scilab-Arduino/cmd_i2c_read_register.sci3
-rw-r--r--2.3-1/macros/Scilab-Arduino/cmd_i2c_write.sci2
-rw-r--r--2.3-1/macros/Scilab-Arduino/cmd_i2c_write_register.sci2
-rw-r--r--2.3-1/macros/Scilab-Arduino/libbin0 -> 736 bytes
-rw-r--r--2.3-1/macros/Scilab-Arduino/names11
14 files changed, 332 insertions, 0 deletions
diff --git a/2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci b/2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci
new file mode 100644
index 00000000..19cf4b88
--- /dev/null
+++ b/2.3-1/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/2.3-1/macros/Scilab-Arduino/GetArduinoFunctions.sci b/2.3-1/macros/Scilab-Arduino/GetArduinoFunctions.sci
new file mode 100644
index 00000000..69c4ab37
--- /dev/null
+++ b/2.3-1/macros/Scilab-Arduino/GetArduinoFunctions.sci
@@ -0,0 +1,36 @@
+// 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"
+ "cmd_i2c_dev"];
+
+endfunction
diff --git a/2.3-1/macros/Scilab-Arduino/GetArduinoSetupFunctions.sci b/2.3-1/macros/Scilab-Arduino/GetArduinoSetupFunctions.sci
new file mode 100644
index 00000000..78bda033
--- /dev/null
+++ b/2.3-1/macros/Scilab-Arduino/GetArduinoSetupFunctions.sci
@@ -0,0 +1,31 @@
+// 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"
+ "cmd_i2c_dev"];
+
+
+endfunction
diff --git a/2.3-1/macros/Scilab-Arduino/InsertSetupInList.sci b/2.3-1/macros/Scilab-Arduino/InsertSetupInList.sci
new file mode 100644
index 00000000..6584f293
--- /dev/null
+++ b/2.3-1/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/2.3-1/macros/Scilab-Arduino/IsArduinoFunction.sci b/2.3-1/macros/Scilab-Arduino/IsArduinoFunction.sci
new file mode 100644
index 00000000..d98f5cd5
--- /dev/null
+++ b/2.3-1/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/2.3-1/macros/Scilab-Arduino/IsArduinoSetupFunction.sci b/2.3-1/macros/Scilab-Arduino/IsArduinoSetupFunction.sci
new file mode 100644
index 00000000..4afceca8
--- /dev/null
+++ b/2.3-1/macros/Scilab-Arduino/IsArduinoSetupFunction.sci
@@ -0,0 +1,34 @@
+// 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)
+disp(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/2.3-1/macros/Scilab-Arduino/buildmacros.sce b/2.3-1/macros/Scilab-Arduino/buildmacros.sce
new file mode 100644
index 00000000..dfeb4755
--- /dev/null
+++ b/2.3-1/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/2.3-1/macros/Scilab-Arduino/cmd_i2c_dev.sci b/2.3-1/macros/Scilab-Arduino/cmd_i2c_dev.sci
new file mode 100644
index 00000000..37854cf3
--- /dev/null
+++ b/2.3-1/macros/Scilab-Arduino/cmd_i2c_dev.sci
@@ -0,0 +1,3 @@
+function z = cmd_i2c_dev(address)
+ z = 0
+endfunction
diff --git a/2.3-1/macros/Scilab-Arduino/cmd_i2c_read.sci b/2.3-1/macros/Scilab-Arduino/cmd_i2c_read.sci
new file mode 100644
index 00000000..1edc1aae
--- /dev/null
+++ b/2.3-1/macros/Scilab-Arduino/cmd_i2c_read.sci
@@ -0,0 +1,2 @@
+function y = cmd_i2c_read(address,bytes)
+endfunction
diff --git a/2.3-1/macros/Scilab-Arduino/cmd_i2c_read_register.sci b/2.3-1/macros/Scilab-Arduino/cmd_i2c_read_register.sci
new file mode 100644
index 00000000..f5394a66
--- /dev/null
+++ b/2.3-1/macros/Scilab-Arduino/cmd_i2c_read_register.sci
@@ -0,0 +1,3 @@
+function x = cmd_i2c_read_register(address,reg_adrs)
+ x = 0;
+endfunction
diff --git a/2.3-1/macros/Scilab-Arduino/cmd_i2c_write.sci b/2.3-1/macros/Scilab-Arduino/cmd_i2c_write.sci
new file mode 100644
index 00000000..8ed8eb4e
--- /dev/null
+++ b/2.3-1/macros/Scilab-Arduino/cmd_i2c_write.sci
@@ -0,0 +1,2 @@
+function cmd_i2c_write(address,data)
+endfunction
diff --git a/2.3-1/macros/Scilab-Arduino/cmd_i2c_write_register.sci b/2.3-1/macros/Scilab-Arduino/cmd_i2c_write_register.sci
new file mode 100644
index 00000000..02c48393
--- /dev/null
+++ b/2.3-1/macros/Scilab-Arduino/cmd_i2c_write_register.sci
@@ -0,0 +1,2 @@
+function cmd_i2c_write_register(address, reg_adrs, data)
+endfunction
diff --git a/2.3-1/macros/Scilab-Arduino/lib b/2.3-1/macros/Scilab-Arduino/lib
new file mode 100644
index 00000000..18879110
--- /dev/null
+++ b/2.3-1/macros/Scilab-Arduino/lib
Binary files differ
diff --git a/2.3-1/macros/Scilab-Arduino/names b/2.3-1/macros/Scilab-Arduino/names
new file mode 100644
index 00000000..8b8d7c48
--- /dev/null
+++ b/2.3-1/macros/Scilab-Arduino/names
@@ -0,0 +1,11 @@
+GenerateSetupFunction
+GetArduinoFunctions
+GetArduinoSetupFunctions
+InsertSetupInList
+IsArduinoFunction
+IsArduinoSetupFunction
+cmd_i2c_dev
+cmd_i2c_read
+cmd_i2c_read_register
+cmd_i2c_write
+cmd_i2c_write_register