summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsiddhu89902016-06-27 19:16:41 +0530
committersiddhu89902016-06-27 19:16:41 +0530
commit169db0082ebd07baea82d00213db6ffd4dee7cf6 (patch)
treec6644d701b64dd82a9d17aab12f5dccb10672126
parent396de3715ed2615f81325661c264341165f0edb2 (diff)
downloadScilab2C_fossee_old-169db0082ebd07baea82d00213db6ffd4dee7cf6.tar.gz
Scilab2C_fossee_old-169db0082ebd07baea82d00213db6ffd4dee7cf6.tar.bz2
Scilab2C_fossee_old-169db0082ebd07baea82d00213db6ffd4dee7cf6.zip
test commit
-rw-r--r--includes/sci2clib.h4
-rw-r--r--macros/CCodeGeneration/C_GenerateMakefile.binbin27820 -> 27976 bytes
-rw-r--r--macros/CCodeGeneration/C_GenerateMakefile.sci11
-rw-r--r--macros/CCodeGeneration/JoinDeclarAndCcode.binbin21988 -> 22604 bytes
-rw-r--r--macros/CCodeGeneration/JoinDeclarAndCcode.sci5
-rw-r--r--macros/Hardware/RasberryPi/GetRPISupportFunctions.binbin1604 -> 1604 bytes
-rw-r--r--macros/Hardware/RasberryPi/GetRPISupportFunctions.sci4
-rw-r--r--macros/Hardware/RasberryPi/RPI_DelayMicro.bin (renamed from macros/Hardware/RasberryPi/RPIDelayMicro.bin)bin3280 -> 3280 bytes
-rw-r--r--macros/Hardware/RasberryPi/RPI_DelayMicro.sci (renamed from macros/Hardware/RasberryPi/RPIDelayMicro.sci)0
-rw-r--r--macros/Hardware/RasberryPi/RPI_DelayMilli.bin (renamed from macros/Hardware/RasberryPi/RPIDelay.bin)bin3528 -> 3528 bytes
-rw-r--r--macros/Hardware/RasberryPi/RPI_DelayMilli.sci (renamed from macros/Hardware/RasberryPi/RPIDelay.sci)0
-rw-r--r--macros/Hardware/RasberryPi/RPI_DigitalIn.binbin3400 -> 4952 bytes
-rw-r--r--macros/Hardware/RasberryPi/RPI_DigitalIn.sci13
-rw-r--r--macros/Hardware/RasberryPi/RPI_DigitalSetup.binbin3452 -> 4884 bytes
-rw-r--r--macros/Hardware/RasberryPi/RPI_DigitalSetup.sci15
-rw-r--r--macros/Hardware/RasberryPi/libbin816 -> 816 bytes
-rw-r--r--macros/Hardware/RasberryPi/names4
-rw-r--r--macros/ToolInitialization/INIT_FillSCI2LibCDirs.binbin1164672 -> 1170476 bytes
-rw-r--r--macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci42
-rw-r--r--macros/findDeps/getAllHeaders.binbin30096 -> 30224 bytes
-rw-r--r--macros/findDeps/getAllHeaders.sci9
-rw-r--r--macros/findDeps/getAllInterfaces.binbin31620 -> 31796 bytes
-rw-r--r--macros/findDeps/getAllInterfaces.sci3
-rw-r--r--macros/findDeps/getAllSources.binbin185520 -> 185652 bytes
-rw-r--r--macros/findDeps/getAllSources.sci9
-rw-r--r--macros/scilab2c.binbin20056 -> 20192 bytes
-rw-r--r--macros/scilab2c.sci4
-rw-r--r--src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c20
-rw-r--r--src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c21
-rw-r--r--src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c32
-rw-r--r--src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h2
-rw-r--r--src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h2
-rw-r--r--src/c/matrixOperations/includes/norm.h4
-rw-r--r--src/c/string/convstr/gconvstrs.c7
-rw-r--r--src/c/string/includes/convstr.h26
-rw-r--r--src/c/string/interfaces/int_convstr.h25
36 files changed, 174 insertions, 88 deletions
diff --git a/includes/sci2clib.h b/includes/sci2clib.h
index 640606b..8484deb 100644
--- a/includes/sci2clib.h
+++ b/includes/sci2clib.h
@@ -402,6 +402,10 @@
#include "files.h"
#include "int_files.h"
+/*Functions related to strings*/
+#include "convstr.h"
+#include "int_convstr.h"
+
/*Scilab-arduino toolbox*/
#ifdef Arduino1
#include "int_cmd_digital_out.h"
diff --git a/macros/CCodeGeneration/C_GenerateMakefile.bin b/macros/CCodeGeneration/C_GenerateMakefile.bin
index 3ced74fb..4b3546e 100644
--- a/macros/CCodeGeneration/C_GenerateMakefile.bin
+++ b/macros/CCodeGeneration/C_GenerateMakefile.bin
Binary files differ
diff --git a/macros/CCodeGeneration/C_GenerateMakefile.sci b/macros/CCodeGeneration/C_GenerateMakefile.sci
index 94b3696..b1c1e71 100644
--- a/macros/CCodeGeneration/C_GenerateMakefile.sci
+++ b/macros/CCodeGeneration/C_GenerateMakefile.sci
@@ -120,11 +120,12 @@ PrintStringInfo('\t@echo ""Generation of the executable""',FileInfo.MakefileFile
PrintStringInfo('\t@echo ""============================""',FileInfo.MakefileFilename,'file','y','y');
PrintStringInfo('\t$(CC) $(CFLAGS) $(OBJ) *.c $(LDFLAGS) -o $(EXEFILE)',FileInfo.MakefileFilename,'file','y','y');
PrintStringInfo('\t@echo "" ""',FileInfo.MakefileFilename,'file','y','y');
-PrintStringInfo('\t@echo ""==============""',FileInfo.MakefileFilename,'file','y','y');
-PrintStringInfo('\t@echo ""Executing code""',FileInfo.MakefileFilename,'file','y','y');
-PrintStringInfo('\t@echo ""==============""',FileInfo.MakefileFilename,'file','y','y');
-PrintStringInfo('\t$(EXEFILE)',FileInfo.MakefileFilename,'file','y','y');
-
+if(target == "StandAlone")
+ PrintStringInfo('\t@echo ""==============""',FileInfo.MakefileFilename,'file','y','y');
+ PrintStringInfo('\t@echo ""Executing code""',FileInfo.MakefileFilename,'file','y','y');
+ PrintStringInfo('\t@echo ""==============""',FileInfo.MakefileFilename,'file','y','y');
+ PrintStringInfo('\t$(EXEFILE)',FileInfo.MakefileFilename,'file','y','y');
+end
PrintStringInfo('clean:',FileInfo.MakefileFilename,'file','y','y');
PrintStringInfo('\t@echo "" ""',FileInfo.MakefileFilename,'file','y','y');
PrintStringInfo('\t@echo ""=============================""',FileInfo.MakefileFilename,'file','y','y');
diff --git a/macros/CCodeGeneration/JoinDeclarAndCcode.bin b/macros/CCodeGeneration/JoinDeclarAndCcode.bin
index 66286eb..a818143 100644
--- a/macros/CCodeGeneration/JoinDeclarAndCcode.bin
+++ b/macros/CCodeGeneration/JoinDeclarAndCcode.bin
Binary files differ
diff --git a/macros/CCodeGeneration/JoinDeclarAndCcode.sci b/macros/CCodeGeneration/JoinDeclarAndCcode.sci
index ebbf002..4328895 100644
--- a/macros/CCodeGeneration/JoinDeclarAndCcode.sci
+++ b/macros/CCodeGeneration/JoinDeclarAndCcode.sci
@@ -145,6 +145,11 @@ PrintStringInfo('** ---------------',CPass2FileName,'file','y');
PrintStringInfo('** --- C code. ---',CPass2FileName,'file','y');
PrintStringInfo('** ---------------',CPass2FileName,'file','y');
PrintStringInfo('*/',CPass2FileName,'file','y');
+
+if(SharedInfo.Target == "RPi")
+ //Add bcm2835_init() function as it is required
+ PrintStringInfo('bcm2835_init();',CPass2FileName,'file','y');
+end
// --- Copy the remaining part of V1 in V2. ---
while (~meof(CPass1V1FileFid))
// #RNU_RES_B
diff --git a/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin b/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin
index 5bea645..545334a 100644
--- a/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin
+++ b/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci b/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci
index 24c2f55..61bb6c0 100644
--- a/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci
+++ b/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci
@@ -1,4 +1,4 @@
-function AVRSupportFunctions = GetRPISupportFunctions()
+function RPiSupportFunctions = GetRPISupportFunctions()
// -----------------------------------------------------------------
// Get list of RPI peripherals supported
//
@@ -11,7 +11,7 @@ function AVRSupportFunctions = GetRPISupportFunctions()
// Author: Siddhesh Wani
// -----------------------------------------------------------------
-AVRSupportFunctions = [
+RPiSupportFunctions = [
"RPI_DigitalIn"
"RPI_DigitalOut"
"RPI_DigitalSetup"
diff --git a/macros/Hardware/RasberryPi/RPIDelayMicro.bin b/macros/Hardware/RasberryPi/RPI_DelayMicro.bin
index a4d32cb..a4d32cb 100644
--- a/macros/Hardware/RasberryPi/RPIDelayMicro.bin
+++ b/macros/Hardware/RasberryPi/RPI_DelayMicro.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/RPIDelayMicro.sci b/macros/Hardware/RasberryPi/RPI_DelayMicro.sci
index 730755b..730755b 100644
--- a/macros/Hardware/RasberryPi/RPIDelayMicro.sci
+++ b/macros/Hardware/RasberryPi/RPI_DelayMicro.sci
diff --git a/macros/Hardware/RasberryPi/RPIDelay.bin b/macros/Hardware/RasberryPi/RPI_DelayMilli.bin
index bb8279e..bb8279e 100644
--- a/macros/Hardware/RasberryPi/RPIDelay.bin
+++ b/macros/Hardware/RasberryPi/RPI_DelayMilli.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/RPIDelay.sci b/macros/Hardware/RasberryPi/RPI_DelayMilli.sci
index c5080dd..c5080dd 100644
--- a/macros/Hardware/RasberryPi/RPIDelay.sci
+++ b/macros/Hardware/RasberryPi/RPI_DelayMilli.sci
diff --git a/macros/Hardware/RasberryPi/RPI_DigitalIn.bin b/macros/Hardware/RasberryPi/RPI_DigitalIn.bin
index a3269a0..ec8fd0d 100644
--- a/macros/Hardware/RasberryPi/RPI_DigitalIn.bin
+++ b/macros/Hardware/RasberryPi/RPI_DigitalIn.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/RPI_DigitalIn.sci b/macros/Hardware/RasberryPi/RPI_DigitalIn.sci
index 3ea3bf1..8775e4c 100644
--- a/macros/Hardware/RasberryPi/RPI_DigitalIn.sci
+++ b/macros/Hardware/RasberryPi/RPI_DigitalIn.sci
@@ -20,8 +20,15 @@ function state = RPI_DigitalIn(pin)
// Authors
// Siddhesh Wani
//
+// -----------------------------------------------------------------
+//Pins of header P1 which can be used as GPIO
+supported_pins = [3,5,7,8,10,11,12,13,15,16,18,19,21,22,23,24,26]
+
+PinIsGPIO = members(pin, supported_pins); //Check if input pin supports GPIO
-// This is curretly dummy function. It provides no functionality but is required
-// for providing support for generating C code for RPi.
-
+//If given pin does not support GPIO functionality, raise the error
+if(PinIsGPIO == 0)
+ error(9999, 'SCI2CERROR: Given pin number doesnot support GPIO functionality.');
+end
+state = 1;
endfunction
diff --git a/macros/Hardware/RasberryPi/RPI_DigitalSetup.bin b/macros/Hardware/RasberryPi/RPI_DigitalSetup.bin
index 46836cd..1de4e22 100644
--- a/macros/Hardware/RasberryPi/RPI_DigitalSetup.bin
+++ b/macros/Hardware/RasberryPi/RPI_DigitalSetup.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci b/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci
index 5ce48f0..aede0b7 100644
--- a/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci
+++ b/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci
@@ -11,7 +11,7 @@ function RPI_DigitalSetup(pin, direction)
// Description
// There are few pins available on RPi as Gpio or digital io. These pins can be used as digital output or input. Pin name must be provided from list provided. Please refer '' for complete list of pins. Direction can be 0 or 1 depending upon desired function (Input/output)
// Examples
-// RPI_DigitalSetup(RPI_GPIO_P1_03,0) //Sets pin 3 of header P1 as input
+// RPI_DigitalSetup(3,0) //Sets pin 3 of header P1 as input
//
// See also
// RPI_DigitalIn RPI_DigitalOut
@@ -19,9 +19,14 @@ function RPI_DigitalSetup(pin, direction)
//
// Authors
// Siddhesh Wani
-//
-
-// This is curretly dummy function. It provides no functionality but is required
-// for providing support for generating C code for RPi.
+// -----------------------------------------------------------------
+//Pins of header P1 which can be used as GPIO
+supported_pins = [3,5,7,8,10,11,12,13,15,16,18,19,21,22,23,24,26]
+
+PinIsGPIO = members(pin, supported_pins); //Check if input pin supports GPIO
+//If given pin does not support GPIO functionality, raise the error
+if(PinIsGPIO == 0)
+ error(9999, 'SCI2CERROR: Given pin number doesnot support GPIO functionality.');
+end
endfunction
diff --git a/macros/Hardware/RasberryPi/lib b/macros/Hardware/RasberryPi/lib
index 5884511..1031744 100644
--- a/macros/Hardware/RasberryPi/lib
+++ b/macros/Hardware/RasberryPi/lib
Binary files differ
diff --git a/macros/Hardware/RasberryPi/names b/macros/Hardware/RasberryPi/names
index 87fe2cd..138ac2a 100644
--- a/macros/Hardware/RasberryPi/names
+++ b/macros/Hardware/RasberryPi/names
@@ -1,7 +1,7 @@
GetRPISupportFunctions
IsRPISupportFunction
-RPIDelay
-RPIDelayMicro
+RPI_DelayMicro
+RPI_DelayMilli
RPI_DigitalIn
RPI_DigitalOut
RPI_DigitalSetup
diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
index 4cc5184..6da0f76 100644
--- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
+++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
Binary files differ
diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
index c67e966..1e0d67a 100644
--- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
+++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
@@ -4706,14 +4706,13 @@ ClassName = 'AVRPWMSetup';
PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
PrintStringInfo('NIN= 4',ClassFileName,'file','y');
-PrintStringInfo('NOUT= 1 ',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('d0d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
@@ -4738,7 +4737,6 @@ PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
// --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-//PrintStringInfo('d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
@@ -4756,14 +4754,13 @@ ClassName = 'RPI_DigitalSetup';
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('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');
PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
@@ -5266,6 +5263,41 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file',
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+//------------------------------------
+//---- Class CONVSTR --------------------
+//------------------------------------
+ClassName = 'CONVSTR';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+
+//Arguements specified: initial value, start time, time vector, ode function
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(1)',ClassFileName,'file','y');
+
+
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('g0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('g2'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('g0g0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('g2g0'+ArgSeparator+'g2',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'convstr';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
// ////////////////////////////////////////////
// /////PARTE INTRODOTTA DA ALBERTO MOREA
// /////////////////////////////////////////////
diff --git a/macros/findDeps/getAllHeaders.bin b/macros/findDeps/getAllHeaders.bin
index 2d5581b..d44f5f2 100644
--- a/macros/findDeps/getAllHeaders.bin
+++ b/macros/findDeps/getAllHeaders.bin
Binary files differ
diff --git a/macros/findDeps/getAllHeaders.sci b/macros/findDeps/getAllHeaders.sci
index 3fa1d4e..be13035 100644
--- a/macros/findDeps/getAllHeaders.sci
+++ b/macros/findDeps/getAllHeaders.sci
@@ -145,7 +145,8 @@ function allHeaders = getAllHeaders(Target)
"src/c/implicitList/implicitList.h"
"src/c/differential_calculus/includes/ode.h"
"src/c/differential_calculus/includes/diffc.h"
- "src/c/Files/includes/files.h"];
+ "src/c/Files/includes/files.h"
+ "src/c/string/includes/convstr.h"];
//Header files required for "Arduino" output
Arduino_headers = [
@@ -155,9 +156,9 @@ function allHeaders = getAllHeaders(Target)
"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_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/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/macros/findDeps/getAllInterfaces.bin b/macros/findDeps/getAllInterfaces.bin
index 66ca5ee..6315795 100644
--- a/macros/findDeps/getAllInterfaces.bin
+++ b/macros/findDeps/getAllInterfaces.bin
Binary files differ
diff --git a/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci
index 37d4301..6928831 100644
--- a/macros/findDeps/getAllInterfaces.sci
+++ b/macros/findDeps/getAllInterfaces.sci
@@ -140,7 +140,8 @@ function allInterfaces = getAllInterfaces(Target)
"src/c/implicitList/int_OpColon.h"
"src/c/differential_calculus/interfaces/int_ode.h"
"src/c/differential_calculus/interfaces/int_diffc.h"
- "src/c/Files/interfaces/int_files.h"];
+ "src/c/Files/interfaces/int_files.h"
+ "src/c/string/interfaces/int_convstr.h"];
//Interface files required for "Arduino" output
Arduino_interfaces = [
diff --git a/macros/findDeps/getAllSources.bin b/macros/findDeps/getAllSources.bin
index 89de1af..2fcad7e 100644
--- a/macros/findDeps/getAllSources.bin
+++ b/macros/findDeps/getAllSources.bin
Binary files differ
diff --git a/macros/findDeps/getAllSources.sci b/macros/findDeps/getAllSources.sci
index 4ef2f16..050c0d6 100644
--- a/macros/findDeps/getAllSources.sci
+++ b/macros/findDeps/getAllSources.sci
@@ -974,7 +974,8 @@ function allSources = getAllSources(Target)
"src/c/Files/mput/u8mputa.c"
"src/c/Files/mput/i8mputa.c"
"src/c/Files/mput/u16mputa.c"
- "src/c/Files/mput/i16mputa.c"];
+ "src/c/Files/mput/i16mputa.c"
+ "src/c/string/convstr/gconvstrs.c"];
//Files to be inserted only if output format selected is 'Arduino'.
Arduino_files = ["src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c"
@@ -983,9 +984,9 @@ function allSources = getAllSources(Target)
"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/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/macros/scilab2c.bin b/macros/scilab2c.bin
index 91140d1..270d1d5 100644
--- a/macros/scilab2c.bin
+++ b/macros/scilab2c.bin
Binary files differ
diff --git a/macros/scilab2c.sci b/macros/scilab2c.sci
index f352d1c..19b1f2b 100644
--- a/macros/scilab2c.sci
+++ b/macros/scilab2c.sci
@@ -121,7 +121,7 @@ function scilab2c(varargin)
return
end
if varargin(6) <> "StandAlone" & varargin(6) <> "Arduino" & varargin(6) <> "AVR" & varargin(6) <> "RPi"
- error(msprintf(gettext("%s: argument #%d must be: ""StandAlone"" or ""Arduino"" or ""AVR"".\n"),"scilab2c",5));
+ error(msprintf(gettext("%s: argument #%d must be: ""StandAlone"" or ""Arduino"" or ""AVR"" or ""RPi"".\n"),"scilab2c",5));
return
end
UserScilabMainFile = varargin(1);
@@ -144,7 +144,7 @@ error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"),
// --- LAUNCH USER SCI CODE TO TEST IT BEFORE TRANSLATING IT!!! ---
// If Target choosen is 'Standalone' then only execute the code, otherwise directly start conversion.
- if Target == "StandAlone"
+ if ((Target == "StandAlone") | (Target == "RPi"))
runscicode(UserScilabMainFile, UserSciFilesPaths);
// --- ASK USER FOR CONTINUATION. ---
diff --git a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c
index 8ce0b3c..d9ff093 100644
--- a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c
+++ b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c
@@ -10,29 +10,15 @@
Email: toolbox@scilab.in
*/
-/* Function to read the state of the gpio pin
-
- Calling Sequence
- u8RPI_DigitalIn(pin)
-
- Parameters
- pin : pin of RPi to be read
-
- Returns
- state: Current state of the specified gpio pin
-
- Description
- There are few pins available on RPi as Gpio or digital i/o. These pins can be used as digital output or input. Using this function, current state (low/high) of any gpio pin can be read. 'pin' name must be provided from list provided. Please refer '' for complete list of pins. 'state' can be 0 or 1 depending upon state of the pin (Low/High). RPI_DigitalSetup with appropriate arguments must be called before using this function.
- Examples
- u8RPI_DigitalIn(RPI_GPIO_P1_03,1) //Returns the state of pin 3 of header P1
-*/
+/* Function to read the state of the gpio pin */
#include "types.h"
#include "RPIPeripheralDigital.h"
+/*pin is reduced by one as array index starts from 0 and pin no starts from 1*/
uint8 u8RPIDigitalIns(uint8 pin)
{
uint8 state = 0;
- state = bcm2835_gpio_lev(pin);
+ state = bcm2835_gpio_lev(phy_pin[pin-1]);
return (state);
}
diff --git a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c
index d97f458..97c6a03 100644
--- a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c
+++ b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c
@@ -10,30 +10,17 @@
Email: toolbox@scilab.in
*/
-/* Function to change the output state of the gpio pin
-
- Calling Sequence
- u8RPI_DigitalOuts(pin,state)
-
- Parameters
- pin : pin of RPi to be used
- state : desired output state for pin (0 -> LOW, 1 -> HIGH)
-
- Description
- There are few pins available on RPi as Gpio or digital i/o. These pins can be used as digital output or input. 'Pin' name must be provided from list provided. Please refer '' for complete list of pins. 'state' can be 0 or 1 depending upon desired output (Low/High). RPI_DigitalSetup with appropriate arguments must be called before using this function.
- Examples
- u8RPI_DigitalOuts(RPI_GPIO_P1_03,1) //Sets pin 3 of header P1 as 'high' output
-*/
+/* Function to change the output state of the gpio pin */
#include "types.h"
#include "RPIPeripheralDigital.h"
-
+/*pin is reduced by one as arrayiindex starts from 0 and pin no starts from 1*/
uint8 u8RPIDigitalOuts(uint8 pin, uint8 state)
{
if (state == 0) //low output
- bcm2835_gpio_clr(pin);
+ bcm2835_gpio_clr(phy_pin[pin-1]);
if (state == 1) //high output
- bcm2835_gpio_set(pin);
+ bcm2835_gpio_set(phy_pin[pin-1]);
}
diff --git a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c
index 657df3a..79668b1 100644
--- a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c
+++ b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c
@@ -10,35 +10,31 @@
Email: toolbox@scilab.in
*/
-/* Function to setup digital pins.
-
- Calling Sequence
- u8RPI_DigitalSetup(pin,direction)
-
- Parameters
- pin : pin of RPi to be used
- direction : direction to be set for pin (0 -> INPUT, 1 -> OUTPUT)
-
- Description
- There are few pins available on RPi as Gpio or digital io. These pins can be used as digital output or input. Pin name must be provided from list provided. Please refer '' for complete list of pins. Direction can be 0 or 1 depending upon desired function (Input/output)
- Examples
- RPI_DigitalSetup(RPI_GPIO_P1_03,0) //Sets pin 3 of header P1 as input
-
- See also
- RPI_DigitalIn RPI_DigitalOut
+/* Function to setup digital pins
+ direction = 1 -> output
*/
#include "types.h"
#include "RPIPeripheralDigital.h"
+
+/*This array maps pin numbers on RPi board, with actual physical pin numbers
+on processor, required by BCM2835 library*/
+int phy_pin[] = {0, 0, 2, 0, 3, 0, 4, 14, 0, 15, /*Pin 1 to 10*/
+ 17, 18, 27, 0, 22, 23, 0, 24, 10, 0, /*Pin 11 to 20*/
+ 9, 25, 11, 8, 0, 7 }; /*Pin 21 to 26*/
+
+/*pin is reduced by one as arrayiindex starts from 0 and pin no starts from 1*/
uint8 u8RPIDigitalSetups(uint8 pin, uint8 direction)
{
if(direction == 1) //Pin to be used as output
{
- bcm2835_gpio_fsel(pin, BCM2835_GPIO_FSEL_OUTP);
+ bcm2835_gpio_fsel(phy_pin[pin-1], BCM2835_GPIO_FSEL_OUTP);
}
else
{
- bcm2835_gpio_fsel(pin, BCM2835_GPIO_FSEL_INPT);
+ bcm2835_gpio_fsel(phy_pin[pin-1], BCM2835_GPIO_FSEL_INPT);
}
+
+ return 0;
}
diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h
index 87fe7dc..e56366c 100644
--- a/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h
+++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h
@@ -23,6 +23,8 @@ extern "C" {
#include "types.h"
#include "bcm2835.h"
+extern int phy_pin[];
+
uint8 u8RPIDigitalSetups(uint8 pin, uint8 direction);
uint8 u8RPIDigitalOuts(uint8 pin, uint8 state);
uint8 u8RPIDigitalIns(uint8 pin);
diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h
index 056f3cb..40a8e1a 100644
--- a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h
+++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h
@@ -22,7 +22,7 @@ extern "C" {
#define RPI_DigitalSetup(in1,in2) u8RPIDigitalSetups((uint8) in1, (uint8) in2);
-#define RPI_DigitalIn(in1,in2) u8RPIDigitalIns((uint8) in1);
+#define RPI_DigitalIn(in1) u8RPIDigitalIns((uint8) in1);
#define RPI_DigitalOut(in1,in2) u8RPIDigitalOuts((uint8) in1, (uint8) in2);
diff --git a/src/c/matrixOperations/includes/norm.h b/src/c/matrixOperations/includes/norm.h
index 6ac4c06..dc9d351 100644
--- a/src/c/matrixOperations/includes/norm.h
+++ b/src/c/matrixOperations/includes/norm.h
@@ -21,9 +21,9 @@ double dnormv (double *in, int size, int norm);
double dnorma (double *in, int row, int col, int norm);
-float dnormv (float *in, int size, int norm);
+float snormv (float *in, int size, int norm);
-float dnorma (float *in, int row, int col, int norm);
+float snorma (float *in, int row, int col, int norm);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/c/string/convstr/gconvstrs.c b/src/c/string/convstr/gconvstrs.c
new file mode 100644
index 0000000..d417496
--- /dev/null
+++ b/src/c/string/convstr/gconvstrs.c
@@ -0,0 +1,7 @@
+#include <string.h>
+#include "convstr.h"
+
+int gconvstrs(int* in)
+{
+ return (toupper(in));
+} \ No newline at end of file
diff --git a/src/c/string/includes/convstr.h b/src/c/string/includes/convstr.h
new file mode 100644
index 0000000..3a8e6e7
--- /dev/null
+++ b/src/c/string/includes/convstr.h
@@ -0,0 +1,26 @@
+ /* 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __CONVSTR_H__
+#define __CONVSTR_H__
+
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+int gconvstrs(int* in);
+
+ #ifdef __cplusplus
+ } /* extern "C" */
+ #endif
+
+#endif /*__CONVSTR_H__*/
diff --git a/src/c/string/interfaces/int_convstr.h b/src/c/string/interfaces/int_convstr.h
new file mode 100644
index 0000000..f565b85
--- /dev/null
+++ b/src/c/string/interfaces/int_convstr.h
@@ -0,0 +1,25 @@
+ /* 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_CONVSTR_H__
+#define __INT_CONVSTR_H__
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+#define g0constrg0(in, size) gconstrs(in)
+
+ #ifdef __cplusplus
+ } /* extern "C" */
+ #endif
+
+#endif /*__INT_CONVSTR_H__*/