diff options
author | imushir | 2016-01-18 11:47:44 +0530 |
---|---|---|
committer | imushir | 2016-01-18 11:47:44 +0530 |
commit | bcb2bf1c014a1078f4306cd0111f4e596fe934ce (patch) | |
tree | 2aaae4926f8354f89b2061599d62b5d650e1535e /2.3-1 | |
parent | 03a27e6884942182e984433fd2ebba7e5f55a4d9 (diff) | |
download | Scilab2C-bcb2bf1c014a1078f4306cd0111f4e596fe934ce.tar.gz Scilab2C-bcb2bf1c014a1078f4306cd0111f4e596fe934ce.tar.bz2 Scilab2C-bcb2bf1c014a1078f4306cd0111f4e596fe934ce.zip |
added support for uin8,uint16,int8,int16 and not in GeneratedSetup.sci,u8cmd_digital_outs.c,getAllInterfaces.sci,getAllHeaders.sci
Diffstat (limited to '2.3-1')
17 files changed, 539 insertions, 25 deletions
diff --git a/2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci b/2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci index db96e190..416509c2 100644 --- a/2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci +++ b/2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci @@ -1,9 +1,7 @@ function GenerateSetupFunction(FileInfo) SetupListFile = FileInfo.SetupListFile; - load(SetupListFile,'SetupList'); - SetupArduinoFile = fullfile(FileInfo.CStyleOutCCCodeDir,'setup_arduino.c'); C_SCI2CHeader(SetupArduinoFile); @@ -13,7 +11,6 @@ PrintStringInfo('int setup_arduino()',SetupArduinoFile,'file','y'); PrintStringInfo('{',SetupArduinoFile,'file','y'); nelements=size(SetupList); - for i=1:nelements funcall = ' '; funcall = funcall + SetupList(i)(1); diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin Binary files differindex be0c48fb..a92ebcf0 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index aa783b1c..1f9b2c99 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -805,6 +805,7 @@ PrintStringInfo('i80'+ArgSeparator+'i80',ClassFileName,'file','y'); PrintStringInfo('u160'+ArgSeparator+'u160',ClassFileName,'file','y');
PrintStringInfo('i160'+ArgSeparator+'i160',ClassFileName,'file','y');
+
PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y');
PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y');
PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y');
@@ -815,6 +816,7 @@ PrintStringInfo('u162'+ArgSeparator+'u162',ClassFileName,'file','y'); PrintStringInfo('i162'+ArgSeparator+'i162',ClassFileName,'file','y');
+
//NUT: no mixed input types are allowed.
PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y');
PrintStringInfo('s0s0'+ArgSeparator+'d0',ClassFileName,'file','y');
@@ -835,6 +837,9 @@ PrintStringInfo('i160i160'+ArgSeparator+'i162',ClassFileName,'file','y'); PrintStringInfo('d0d0d0'+ArgSeparator+'d3',ClassFileName,'file','y');
+
+
+
// --- Annotation Function And Function List Function. ---
FunctionName = 'zeros'; // BJ : Done AS : Float_Done
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
@@ -851,6 +856,75 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+//---------------------
+//-----Class Rand.------
+//---------------------
+ ClassName = 'rand'
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 0',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= ''d''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= ''d''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(IN(1).SZ)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(IN(1).SZ)',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= ''d''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= FA_SZ_FROM_VAL(IN(1).VAL,IN(1).TP)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= FA_SZ_FROM_VAL(IN(2).VAL,IN(2).TP)',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 3',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= ''d''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= FA_SZ_FROM_VAL(IN(1).VAL,IN(1).TP)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= FA_SZ_FROM_VAL(IN(2).VAL,IN(2).TP)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(3)= FA_SZ_FROM_VAL(IN(3).VAL,IN(3).TP)',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+
+//For rand operator
+PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('d0d0'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('u80'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('i80'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('u160'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('i160'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('u82'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('i82'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('u162'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('i162'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('u80u80'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('u80u80'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('i80i80'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('i80i80'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('u160u160'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('u160u160'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('i160i160'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('i160i160'+ArgSeparator+'d2',ClassFileName,'file','y');
+
//NUT rand function doesn't behave like zeros and ones functions.
FunctionName = 'rand'; // BJ : Done => rien pour f loat
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
@@ -1127,6 +1201,7 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
FunctionName = 'imag'; // BJ : Done AS : Float_Done
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
@@ -2449,6 +2524,7 @@ PrintStringInfo('NIN= 2',ClassFileName,'file','y'); PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
PrintStringInfo('OUT(1).TP= FA_TP_MIN_REAL(IN(1).TP,IN(2).TP)',ClassFileName,'file','y');
PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+
PrintStringInfo('OUT(1).SZ(2)= FA_SZ_FROM_VAL(FA_ADD(FA_SUB(FA_REAL(IN(2).VAL,IN(2).TP),FA_REAL(IN(1).VAL,IN(1).TP)),''1''),FA_TP_REAL(IN(2).TP))',ClassFileName,'file','y');
PrintStringInfo('NIN= 3',ClassFileName,'file','y');
PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
@@ -2842,29 +2918,32 @@ ClassName = 'String'; PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
PrintStringInfo('NIN= 1',ClassFileName,'file','y');
-PrintStringInfo('NOUT= 0',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''g''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(IN.SZ)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(IN.SZ)',ClassFileName,'file','y');
// --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-PrintStringInfo('s0'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('d0'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('c0'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('z0'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('g0'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('u80'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('i80'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('u160'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('i160'+ArgSeparator,ClassFileName,'file','y');
-
-PrintStringInfo('s2'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('d2'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('c2'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('z2'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('g2'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('u82'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('i82'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('u162'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('i162'+ArgSeparator,ClassFileName,'file','y');
+PrintStringInfo('s0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('d0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('c0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('z0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('g0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('u80'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('i80'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('u160'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('i160'+ArgSeparator+'g0',ClassFileName,'file','y');
+
+PrintStringInfo('s2'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('d2'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('c2'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('z2'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('g2'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('u82'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('i82'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('u162'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('i162'+ArgSeparator+'g2',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
@@ -3100,6 +3179,8 @@ PrintStringInfo('s0f0g2'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiari PrintStringInfo('d0'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiarire
PrintStringInfo('d0f0'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiarire
+
+
PrintStringInfo('d0f0g2'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiarire
// --- Annotation Function And Function List Function. ---
@@ -3912,6 +3993,7 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,Ex +
// ------------------
// --- Class Expm. ---
// ------------------
@@ -4011,6 +4093,7 @@ PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); // --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
PrintStringInfo('d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('d0d0u80'+ArgSeparator+'u80',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
FunctionName = 'cmd_analog_out';
@@ -4092,6 +4175,74 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+//---Class cmd_servo_attach.---
+ClassName = 'cmd_servo_attach';
+
+//----Class Annotation.----
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+//---Function List Class.-----
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'cmd_servo_attach';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+//---Class cmd_servo_detach.---
+ClassName = 'cmd_servo_detach';
+
+//----Class Annotation.----
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+//---Function List Class.-----
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'cmd_servo_detach';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+//---Class cmd_servo_move.---
+ClassName = 'cmd_servo_move';
+
+//----Class Annotation.----
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 3',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+//---Function List Class.-----
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'cmd_servo_move';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
//------------------------------------
//---- Class Sleep -------------------
diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci index 7cddce29..90010058 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.sci +++ b/2.3-1/macros/findDeps/getAllHeaders.sci @@ -134,8 +134,11 @@ function allHeaders = getAllHeaders(OutFormat) "src/c/scilab-arduino/includes/cmd_digital_in.h" "src/c/scilab-arduino/includes/cmd_analog_out.h" "src/c/scilab-arduino/includes/cmd_analog_in.h" - "src/c/scilab-arduino/includes/cmd_dcmotor_setup.h" - "src/c/scilab-arduino/includes/cmd_dcmotor_run.h" + "src/c/scilab-arduino/includes/cmd_dcmotor_setup.h" + "src/c/scilab-arduino/includes/cmd_dcmotor_run.h" + "src/c/scilab-arduino/includes/cmd_servo_attach.h" + "src/c/scilab-arduino/includes/cmd_servo_detach.h" + "src/c/scilab-arduino/includes/cmd_servo_move.h" "src/c/scilab-arduino/includes/sleep.h"]; AVR_headers = [ diff --git a/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci index 8b5df6f2..02e741cb 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.sci +++ b/2.3-1/macros/findDeps/getAllInterfaces.sci @@ -129,6 +129,7 @@ function allInterfaces = getAllInterfaces(OutFormat) "src/c/scilab-arduino/interfaces/int_cmd_analog_out.h" "src/c/scilab-arduino/interfaces/int_cmd_analog_in.h" "src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h" + "src/c/scilab-arduino/interfaces/int_cmd_servo.h" "src/c/scilab-arduino/interfaces/int_sleep.h"]; //Interface files required for "AVR" output diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci index 56a8fea0..e8b86c44 100644 --- a/2.3-1/macros/findDeps/getAllSources.sci +++ b/2.3-1/macros/findDeps/getAllSources.sci @@ -44,6 +44,14 @@ function allSources = getAllSources(OutFormat) "src/c/auxiliaryFunctions/rand/zrands.c" "src/c/auxiliaryFunctions/rand/cranda.c" "src/c/auxiliaryFunctions/rand/crands.c" + "src/c/auxiliaryFunctions/rand/u8randa.c" + "src/c/auxiliaryFunctions/rand/u8rands.c" + "src/c/auxiliaryFunctions/rand/u16randa.c" + "src/c/auxiliaryFunctions/rand/u16rands.c" + "src/c/auxiliaryFunctions/rand/i8randa.c" + "src/c/auxiliaryFunctions/rand/i8rands.c" + "src/c/auxiliaryFunctions/rand/i16randa.c" + "src/c/auxiliaryFunctions/rand/i16rands.c" "src/c/auxiliaryFunctions/sign/csigna.c" "src/c/auxiliaryFunctions/sign/csigns.c" "src/c/auxiliaryFunctions/sign/dsigna.c" @@ -844,6 +852,9 @@ function allSources = getAllSources(OutFormat) "src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c" "src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c" "src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c" + "src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attach.cpp" + "src/c/scilab-arduino/cmd_servo_detach/u8cmd_servo_detach.cpp" + "src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_move.cpp" "src/c/scilab-arduino/sleep/u16sleeps.c"]; //Files to be inserted only if output format selected is 'AVR'. diff --git a/2.3-1/src/c/auxiliaryFunctions/includes/rand.h b/2.3-1/src/c/auxiliaryFunctions/includes/rand.h index 4716cbba..d032a124 100644 --- a/2.3-1/src/c/auxiliaryFunctions/includes/rand.h +++ b/2.3-1/src/c/auxiliaryFunctions/includes/rand.h @@ -17,6 +17,7 @@ #include "dynlib_auxiliaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -46,6 +47,35 @@ EXTERN_AUXFUNCT floatComplex crands(void); **/ EXTERN_AUXFUNCT doubleComplex zrands(void); + +/** + ** \brief uint8 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double u8rands(void); + + +/** + ** \brief uint16 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double u16rands(void); + + +/** + ** \brief int8 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double i8rands(void); + + +/** + ** \brief int16 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double i16rands(void); + + /** ** \brief Float Array Rand function ** \return A random float array. @@ -70,6 +100,32 @@ EXTERN_AUXFUNCT void cranda(floatComplex *out, int size); **/ EXTERN_AUXFUNCT void zranda(doubleComplex *out, int size); +/** + ** \brief uint8 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void u8randa(double *out, int size); + +/** + ** \brief uint16 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void u16randa(double *out, int size); + + +/** + ** \brief int8 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void i8randa(double *out, int size); + +/** + ** \brief int16 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void i16randa(double *out, int size); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/2.3-1/src/c/auxiliaryFunctions/interfaces/int_rand.h b/2.3-1/src/c/auxiliaryFunctions/interfaces/int_rand.h index 597309a4..85d08eae 100644 --- a/2.3-1/src/c/auxiliaryFunctions/interfaces/int_rand.h +++ b/2.3-1/src/c/auxiliaryFunctions/interfaces/int_rand.h @@ -20,6 +20,14 @@ #define randd0() drands() +#define randu80() u8rands() + +#define randu160() u16rands() + +#define randi80() i8rands() + +#define randi160() i16rands() + #define s0rands0(in) srands() @@ -30,16 +38,39 @@ #define z0randz0(in) zrands() +#define u80randd0(in) u8rands() + +#define u160randd0(in) u16rands() + +#define i80randd0(in) i8rands() + +#define i160randd0(in) i16rands() + #define s0s0rands0(in1,in2) srands() #define d0d0randd0(in,in2) drands() +#define u80u80randd0(in1,in2) u8rands() + +#define u160u160randd0(in1,in2) u16rands() + +#define i80i80randd0(in1,in2) i8rands() + +#define i160i160randd0(in1,in2) i16rands() + #define s0s0rands2(in1,in2,out) sranda(out,(int)in1*(int)in2) #define d0d0randd2(in1,in2,out) dranda(out,(int)in1*(int)in2) +#define u80u80randd2(in1,in2,out) u8randa(out,(int)in1*(int)in2) + +#define u160u160randd2(in1,in2,out) u16randa(out,(int)in1*(int)in2) + +#define i80i80randd2(in1,in2,out) i8randa(out,(int)in1*(int)in2) + +#define i160i160randd2(in1,in2,out) i16randa(out,(int)in1*(int)in2) #define s2rands2(in,size,out) sranda(out, size[0]*size[1]) @@ -49,5 +80,15 @@ #define z2randz2(in,size,out) zranda(out, size[0]*size[1]) +#define u82randd2(in,size,out) u8randa(out, size[0]*size[1]) + +#define u162randd2(in,size,out) u16randa(out, size[0]*size[1]) + +#define i82randd2(in,size,out) i8randa(out, size[0]*size[1]) + +#define i62randd2(in,size,out) i16randa(out, size[0]*size[1]) + + + #endif /* !__INT_RAND_H__ */ diff --git a/2.3-1/src/c/auxiliaryFunctions/rand/i16randa.c b/2.3-1/src/c/auxiliaryFunctions/rand/i16randa.c new file mode 100644 index 00000000..f3d8dd37 --- /dev/null +++ b/2.3-1/src/c/auxiliaryFunctions/rand/i16randa.c @@ -0,0 +1,12 @@ +/* Scilab2C FOSSEE IIT BOMBAY */ +#include "rand.h" + +void i16randa(double *out,int size) +{ + int i = 0; + for(i = 0 ; i < size ; ++i) + { + out[i] = i16rands(); + } + +} diff --git a/2.3-1/src/c/auxiliaryFunctions/rand/i16rands.c b/2.3-1/src/c/auxiliaryFunctions/rand/i16rands.c new file mode 100644 index 00000000..ca2ed9cd --- /dev/null +++ b/2.3-1/src/c/auxiliaryFunctions/rand/i16rands.c @@ -0,0 +1,46 @@ +/* Scilab2C FOSSEE IIT Bombay */ +#include "rand.h" +#include <stdio.h> + +double i16rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0.0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + while(m>m2) + { + m2=m; + m=itwo*m2; + } + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + mic = (m2 - ic) + m2; + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + +} + +/* compute next random number */ + iy = iy*ia; +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) iy = (iy - m2) - m2; + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) iy = (iy - m2) - m2; + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) iy = (iy + m2) + m2; + return (double)iy*s; + + + + + +} diff --git a/2.3-1/src/c/auxiliaryFunctions/rand/i8randa.c b/2.3-1/src/c/auxiliaryFunctions/rand/i8randa.c new file mode 100644 index 00000000..d679c65f --- /dev/null +++ b/2.3-1/src/c/auxiliaryFunctions/rand/i8randa.c @@ -0,0 +1,12 @@ +/* Scilab2C FOSSEE IIT BOMBAY */ +#include "rand.h" + +void i8randa(double *out,int size) +{ + int i = 0; + for(i = 0 ; i < size ; ++i) + { + out[i] = i8rands(); + } + +} diff --git a/2.3-1/src/c/auxiliaryFunctions/rand/i8rands.c b/2.3-1/src/c/auxiliaryFunctions/rand/i8rands.c new file mode 100644 index 00000000..55df9093 --- /dev/null +++ b/2.3-1/src/c/auxiliaryFunctions/rand/i8rands.c @@ -0,0 +1,42 @@ +/* Scilab2C FOSSEE IIT Bombay */ +#include "rand.h" +#include <stdio.h> + +double i8rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0.0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + while(m>m2) + { + m2=m; + m=itwo*m2; + } + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + mic = (m2 - ic) + m2; + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + +} + +/* compute next random number */ + iy = iy*ia; +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) iy = (iy - m2) - m2; + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) iy = (iy - m2) - m2; + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) iy = (iy + m2) + m2; + return (double)iy*s; + +} diff --git a/2.3-1/src/c/auxiliaryFunctions/rand/u16randa.c b/2.3-1/src/c/auxiliaryFunctions/rand/u16randa.c new file mode 100644 index 00000000..f5393369 --- /dev/null +++ b/2.3-1/src/c/auxiliaryFunctions/rand/u16randa.c @@ -0,0 +1,12 @@ +/* Scilab2C FOSSEE IIT BOMBAY */ +#include "rand.h" + +void u16randa(double *out,int size) +{ + int i = 0; + for(i = 0 ; i < size ; ++i) + { + out[i] = u16rands(); + } + +} diff --git a/2.3-1/src/c/auxiliaryFunctions/rand/u16rands.c b/2.3-1/src/c/auxiliaryFunctions/rand/u16rands.c new file mode 100644 index 00000000..a08d6a8c --- /dev/null +++ b/2.3-1/src/c/auxiliaryFunctions/rand/u16rands.c @@ -0,0 +1,46 @@ +/* Scilab2C FOSSEE IIT Bombay */ +#include "rand.h" +#include <stdio.h> + +double u16rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + while(m>m2) + { + m2=m; + m=itwo*m2; + } + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + mic = (m2 - ic) + m2; + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + +} + +/* compute next random number */ + iy = iy*ia; +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) iy = (iy - m2) - m2; + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) iy = (iy - m2) - m2; + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) iy = (iy + m2) + m2; + return (double)iy*s; + + + +} + + diff --git a/2.3-1/src/c/auxiliaryFunctions/rand/u8randa.c b/2.3-1/src/c/auxiliaryFunctions/rand/u8randa.c new file mode 100644 index 00000000..4d7d3f8a --- /dev/null +++ b/2.3-1/src/c/auxiliaryFunctions/rand/u8randa.c @@ -0,0 +1,15 @@ +/* Scilab2C FOSSEE IIT BOMBAY */ +#include "rand.h" +#include<stdio.h> +void u8randa(double *out,int size) +{ + + int i = 0; + + for(i = 0 ; i < size ; ++i) + { + out[i] = u8rands(); + + } + +} diff --git a/2.3-1/src/c/auxiliaryFunctions/rand/u8rands.c b/2.3-1/src/c/auxiliaryFunctions/rand/u8rands.c new file mode 100644 index 00000000..bdf7f9a5 --- /dev/null +++ b/2.3-1/src/c/auxiliaryFunctions/rand/u8rands.c @@ -0,0 +1,68 @@ +/* Scilab2C FOSSEE IIT Bombay */ +#include "rand.h" +#include <stdio.h> + +double u8rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0.0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + + while(m>m2) + { + + m2=m; + + m=itwo*m2; + + } + + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + + mic = (m2 - ic) + m2; + + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + + +} + +/* compute next random number */ + iy = iy*ia; + +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) +{ + iy = (iy - m2) - m2; + +} + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) +{ + iy = (iy - m2) - m2; + +} + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) + { + iy = (iy + m2) + m2; + + } + + return (double)iy*s; + + + + + +} diff --git a/2.3-1/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c b/2.3-1/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c index 09dffd62..2d9de977 100644 --- a/2.3-1/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c +++ b/2.3-1/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c @@ -11,6 +11,7 @@ */ #include "cmd_digital_out.h" +#include "Arduino.h" uint8 u8cmd_digital_outs(uint8 board_no, uint8 pin, uint8 value) { |