From 1c5c5704b2c0a6e6f6650f74968261a6842f2038 Mon Sep 17 00:00:00 2001 From: Brijeshcr Date: Wed, 12 Jul 2017 20:00:18 +0530 Subject: Isequal added --- 2.3-1/macros/ASTManagement/lib | Bin 2008 -> 2008 bytes 2.3-1/macros/CCodeGeneration/lib | Bin 1056 -> 1056 bytes 2.3-1/macros/ErrorMessages/lib | Bin 520 -> 520 bytes 2.3-1/macros/FunctionAnnotation/lib | Bin 2412 -> 2412 bytes 2.3-1/macros/FunctionList/lib | Bin 588 -> 588 bytes 2.3-1/macros/GeneralFunctions/lib | Bin 1132 -> 1132 bytes 2.3-1/macros/Hardware/AVR/lib | Bin 972 -> 972 bytes 2.3-1/macros/Hardware/RasberryPi/lib | Bin 976 -> 976 bytes 2.3-1/macros/ImageProcessing/core/lib | Bin 524 -> 524 bytes 2.3-1/macros/ImageProcessing/highgui/lib | Bin 584 -> 584 bytes 2.3-1/macros/ImageProcessing/imgproc/lib | Bin 752 -> 752 bytes 2.3-1/macros/Scilab-Arduino/lib | Bin 716 -> 716 bytes 2.3-1/macros/SymbolTable/lib | Bin 752 -> 752 bytes .../ToolInitialization/INIT_FillSCI2LibCDirs.sci | 36 +++++++++++++++++++++ 2.3-1/macros/findDeps/getAllHeaders.sci | 1 + 2.3-1/macros/findDeps/getAllInterfaces.sci | 1 + 2.3-1/macros/findDeps/getAllSources.sci | 8 +++++ 17 files changed, 46 insertions(+) (limited to '2.3-1/macros') diff --git a/2.3-1/macros/ASTManagement/lib b/2.3-1/macros/ASTManagement/lib index 5978ea72..dee4362f 100644 Binary files a/2.3-1/macros/ASTManagement/lib and b/2.3-1/macros/ASTManagement/lib differ diff --git a/2.3-1/macros/CCodeGeneration/lib b/2.3-1/macros/CCodeGeneration/lib index 31819793..3d4fed1d 100644 Binary files a/2.3-1/macros/CCodeGeneration/lib and b/2.3-1/macros/CCodeGeneration/lib differ diff --git a/2.3-1/macros/ErrorMessages/lib b/2.3-1/macros/ErrorMessages/lib index 794d4c01..ba3b9a5a 100644 Binary files a/2.3-1/macros/ErrorMessages/lib and b/2.3-1/macros/ErrorMessages/lib differ diff --git a/2.3-1/macros/FunctionAnnotation/lib b/2.3-1/macros/FunctionAnnotation/lib index bb1f47c6..239105c8 100644 Binary files a/2.3-1/macros/FunctionAnnotation/lib and b/2.3-1/macros/FunctionAnnotation/lib differ diff --git a/2.3-1/macros/FunctionList/lib b/2.3-1/macros/FunctionList/lib index c3274f18..1c722dd0 100644 Binary files a/2.3-1/macros/FunctionList/lib and b/2.3-1/macros/FunctionList/lib differ diff --git a/2.3-1/macros/GeneralFunctions/lib b/2.3-1/macros/GeneralFunctions/lib index 1cf5c1f5..7586a91b 100644 Binary files a/2.3-1/macros/GeneralFunctions/lib and b/2.3-1/macros/GeneralFunctions/lib differ diff --git a/2.3-1/macros/Hardware/AVR/lib b/2.3-1/macros/Hardware/AVR/lib index 069c520e..ed4c52b8 100644 Binary files a/2.3-1/macros/Hardware/AVR/lib and b/2.3-1/macros/Hardware/AVR/lib differ diff --git a/2.3-1/macros/Hardware/RasberryPi/lib b/2.3-1/macros/Hardware/RasberryPi/lib index 4c85475b..eec912f5 100644 Binary files a/2.3-1/macros/Hardware/RasberryPi/lib and b/2.3-1/macros/Hardware/RasberryPi/lib differ diff --git a/2.3-1/macros/ImageProcessing/core/lib b/2.3-1/macros/ImageProcessing/core/lib index d80305c4..40b7b0a1 100644 Binary files a/2.3-1/macros/ImageProcessing/core/lib and b/2.3-1/macros/ImageProcessing/core/lib differ diff --git a/2.3-1/macros/ImageProcessing/highgui/lib b/2.3-1/macros/ImageProcessing/highgui/lib index 1e7f7507..0d7f88a9 100644 Binary files a/2.3-1/macros/ImageProcessing/highgui/lib and b/2.3-1/macros/ImageProcessing/highgui/lib differ diff --git a/2.3-1/macros/ImageProcessing/imgproc/lib b/2.3-1/macros/ImageProcessing/imgproc/lib index a83978b5..63b5e7e9 100644 Binary files a/2.3-1/macros/ImageProcessing/imgproc/lib and b/2.3-1/macros/ImageProcessing/imgproc/lib differ diff --git a/2.3-1/macros/Scilab-Arduino/lib b/2.3-1/macros/Scilab-Arduino/lib index f3d5b2fc..a62fd4e4 100644 Binary files a/2.3-1/macros/Scilab-Arduino/lib and b/2.3-1/macros/Scilab-Arduino/lib differ diff --git a/2.3-1/macros/SymbolTable/lib b/2.3-1/macros/SymbolTable/lib index e66158d4..4379c83d 100644 Binary files a/2.3-1/macros/SymbolTable/lib and b/2.3-1/macros/SymbolTable/lib differ diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index 7dcae8a8..56ba4173 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -4836,6 +4836,42 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,E INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); +//------------------------------------ +//---- Class ISEQUAL ---------------- +//------------------------------------ +ClassName = 'isequal'; + +// --- 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'); +//Was FA_TP_USER +//Cause some trouble if user specify some precision and if input(and also output) is complex. +PrintStringInfo('OUT(1).TP= ''g''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + + +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('d0d0'+ArgSeparator+'g0',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'g0',ClassFileName,'file','y'); +PrintStringInfo('s0s0'+ArgSeparator+'g0',ClassFileName,'file','y'); +PrintStringInfo('s2s2'+ArgSeparator+'g0',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'g0',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'g0',ClassFileName,'file','y'); +PrintStringInfo('u160u160'+ArgSeparator+'g0',ClassFileName,'file','y'); +PrintStringInfo('u162u162'+ArgSeparator+'g0',ClassFileName,'file','y'); + + +// --- Annotation Function And Function List Function. --- +FunctionName = 'isequal'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + // ------------------- // --- Class Spec. --- // ------------------- diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci index 67444f93..ed4a9958 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.sci +++ b/2.3-1/macros/findDeps/getAllHeaders.sci @@ -137,6 +137,7 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/elementaryFunctions/includes/ismatrix.h" "src/c/elementaryFunctions/includes/asind.h" "src/c/elementaryFunctions/includes/atand.h" + "src/c/elementaryFunctions/includes/isequal.h" "src/c/statisticsFunctions/includes/variance.h" "src/c/statisticsFunctions/includes/sum.h" "src/c/statisticsFunctions/includes/mean.h" diff --git a/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci index da910a0e..e9f19a29 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.sci +++ b/2.3-1/macros/findDeps/getAllInterfaces.sci @@ -128,6 +128,7 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/elementaryFunctions/interfaces/int_atand.h" "src/c/elementaryFunctions/interfaces/int_gcd.h" "src/c/elementaryFunctions/interfaces/int_lcm.h" + "src/c/elementaryFunctions/interfaces/int_isequal.h" "src/c/statisticsFunctions/interfaces/int_mean.h" "src/c/statisticsFunctions/interfaces/int_meanf.h" "src/c/statisticsFunctions/interfaces/int_stdevf.h" diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci index ddb3e47e..12ce1be5 100644 --- a/2.3-1/macros/findDeps/getAllSources.sci +++ b/2.3-1/macros/findDeps/getAllSources.sci @@ -855,6 +855,14 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/elementaryFunctions/atand/satands.c" "src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcda.c" "src/c/elementaryFunctions/discrete_mathematics/lcm/u8lcma.c" + "src/c/elementaryFunctions/isequal/disequals.c" + "src/c/elementaryFunctions/isequal/disequala.c" + "src/c/elementaryFunctions/isequal/sisequals.c" + "src/c/elementaryFunctions/isequal/sisequala.c" + "src/c/elementaryFunctions/isequal/zisequals.c" + "src/c/elementaryFunctions/isequal/zisequala.c" + "src/c/elementaryFunctions/isequal/u16isequals.c" + "src/c/elementaryFunctions/isequal/u16isequala.c" "src/c/statisticsFunctions/max/dmaxa.c" "src/c/statisticsFunctions/max/smaxa.c" "src/c/statisticsFunctions/max/srowmaxa.c" -- cgit From 2e35a1f26a7ec9e4466a5e0448f9a868aa801471 Mon Sep 17 00:00:00 2001 From: Brijeshcr Date: Fri, 14 Jul 2017 18:01:26 +0530 Subject: ERF, ERFC and Demos added --- .../ToolInitialization/INIT_FillSCI2LibCDirs.sci | 59 ++++++++++++++++++++++ 2.3-1/macros/findDeps/getAllHeaders.sci | 2 + 2.3-1/macros/findDeps/getAllInterfaces.sci | 2 + 2.3-1/macros/findDeps/getAllSources.sci | 8 +++ 4 files changed, 71 insertions(+) (limited to '2.3-1/macros') diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index 56ba4173..85472a8a 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -4872,6 +4872,65 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,E INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); +//------------------------------------ +//---- Class ERF ---------------- +//------------------------------------ +ClassName = 'erf'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); + +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'); + +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); + + + +// --- Annotation Function And Function List Function. --- +FunctionName = 'erf'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + +//------------------------------------ +//---- Class ERFC ---------------- +//------------------------------------ +ClassName = 'erfc'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); + +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'); + +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); + + +// --- Annotation Function And Function List Function. --- +FunctionName = 'erfc'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + // ------------------- // --- Class Spec. --- // ------------------- diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci index ed4a9958..cf606ab5 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.sci +++ b/2.3-1/macros/findDeps/getAllHeaders.sci @@ -225,6 +225,8 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/elementaryFunctions/includes/gcd.h" "src/c/elementaryFunctions/includes/lcm.h" "src/c/elementaryFunctions/includes/sinc.h" + "src/c/specialFunctions/includes/erf.h" + "src/c/specialFunctions/includes/erfc.h" "src/c/CACSD/includes/syslin.h" "src/c/CACSD/includes/lqr.h" "src/c/CACSD/includes/lqe.h" diff --git a/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci index e9f19a29..977ea76e 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.sci +++ b/2.3-1/macros/findDeps/getAllInterfaces.sci @@ -220,6 +220,8 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/elementaryFunctions/interfaces/int_primes.h" "src/c/elementaryFunctions/interfaces/int_factor.h" "src/c/elementaryFunctions/interfaces/int_sinc.h" + "src/c/specialFunctions/interfaces/int_erf.h" + "src/c/specialFunctions/interfaces/int_erfc.h" "src/c/CACSD/interfaces/int_syslin.h" "src/c/CACSD/interfaces/int_lqr.h" "src/c/CACSD/interfaces/int_lqe.h" diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci index 12ce1be5..60908c88 100644 --- a/2.3-1/macros/findDeps/getAllSources.sci +++ b/2.3-1/macros/findDeps/getAllSources.sci @@ -1328,6 +1328,14 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/elementaryFunctions/discrete_mathematics/primes/sprimess.c" "src/c/elementaryFunctions/discrete_mathematics/factor/dfactors.c" "src/c/elementaryFunctions/discrete_mathematics/factor/sfactors.c" + "src/c/specialFunctions/erf/derfs.c" + "src/c/specialFunctions/erf/derfa.c" + "src/c/specialFunctions/erf/serfs.c" + "src/c/specialFunctions/erf/serfa.c" + "src/c/specialFunctions/erfc/derfcs.c" + "src/c/specialFunctions/erfc/derfca.c" + "src/c/specialFunctions/erfc/serfcs.c" + "src/c/specialFunctions/erfc/serfca.c" "src/c/CACSD/syslin/dsyslina.c" "src/c/CACSD/lqr/dlqra.c" "src/c/CACSD/lqe/dlqea.c" -- cgit From 98c03bc5ba4a473d0f77cdfd625e924ab7b18ca8 Mon Sep 17 00:00:00 2001 From: Jorawar Singh Date: Sun, 16 Jul 2017 22:17:43 +0530 Subject: Toolbox merge, RPI demos and structured demos --- 2.3-1/macros/ASTManagement/lib | Bin 1956 -> 0 bytes 2.3-1/macros/CCodeGeneration/lib | Bin 1004 -> 0 bytes 2.3-1/macros/ErrorMessages/lib | Bin 468 -> 0 bytes 2.3-1/macros/FunctionAnnotation/lib | Bin 2360 -> 0 bytes 2.3-1/macros/FunctionList/lib | Bin 536 -> 0 bytes 2.3-1/macros/GeneralFunctions/lib | Bin 1080 -> 0 bytes 2.3-1/macros/Hardware/AVR/lib | Bin 920 -> 0 bytes .../RasberryPi/Digital/RPI_digitalRead.sci | 41 +++++++++ .../RasberryPi/Digital/RPI_digitalReadByte.sci | 40 +++++++++ .../RasberryPi/Digital/RPI_digitalWrite.sci | 46 ++++++++++ .../RasberryPi/Digital/RPI_digitalWriteByte.sci | 42 +++++++++ .../Hardware/RasberryPi/Digital/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/Digital/names | 4 + .../macros/Hardware/RasberryPi/I2C/RPI_I2CRead.sci | 40 +++++++++ .../Hardware/RasberryPi/I2C/RPI_I2CReadReg16.sci | 41 +++++++++ .../Hardware/RasberryPi/I2C/RPI_I2CReadReg8.sci | 41 +++++++++ .../Hardware/RasberryPi/I2C/RPI_I2CSetup.sci | 42 +++++++++ .../RasberryPi/I2C/RPI_I2CSetupInterface.sci | 41 +++++++++ .../Hardware/RasberryPi/I2C/RPI_I2CWrite.sci | 41 +++++++++ .../Hardware/RasberryPi/I2C/RPI_I2CWriteReg16.sci | 42 +++++++++ .../Hardware/RasberryPi/I2C/RPI_I2CWriteReg8.sci | 42 +++++++++ .../Hardware/RasberryPi/I2C/RPI_i2cdetect.sci | 38 +++++++++ .../macros/Hardware/RasberryPi/I2C/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/I2C/names | 9 ++ .../RasberryPi/Interrupt/RPI_waitForInterrupt.sci | 45 ++++++++++ .../Hardware/RasberryPi/Interrupt/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/Interrupt/names | 1 + .../Hardware/RasberryPi/Misc/RPI_boardRev.sci | 34 ++++++++ .../Hardware/RasberryPi/Misc/RPI_padDrive.sci | 40 +++++++++ .../Hardware/RasberryPi/Misc/RPI_sn3218Setup.sci | 40 +++++++++ .../Hardware/RasberryPi/Misc/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/Misc/names | 3 + .../macros/Hardware/RasberryPi/RPI_DelayMicro.sci | 38 --------- .../macros/Hardware/RasberryPi/RPI_DelayMilli.sci | 39 --------- 2.3-1/macros/Hardware/RasberryPi/RPI_DigitalIn.sci | 43 ---------- .../macros/Hardware/RasberryPi/RPI_DigitalOut.sci | 44 ---------- .../Hardware/RasberryPi/RPI_DigitalSetup.sci | 36 -------- 2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.sci | 39 --------- 2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.sci | 39 --------- .../Hardware/RasberryPi/RPI_HardPWMSetClock.sci | 35 -------- .../Hardware/RasberryPi/RPI_HardPWMSetMode.sci | 32 ------- .../Hardware/RasberryPi/RPI_HardPWMSetRange.sci | 35 -------- .../Hardware/RasberryPi/RPI_HardPWMWrite.sci | 39 --------- 2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.sci | 56 ------------ .../macros/Hardware/RasberryPi/RPI_SerialClose.sci | 33 -------- .../macros/Hardware/RasberryPi/RPI_SerialFlush.sci | 34 -------- .../Hardware/RasberryPi/RPI_SerialGetChar.sci | 36 -------- .../Hardware/RasberryPi/RPI_SerialSendChar.sci | 37 -------- .../Hardware/RasberryPi/RPI_SerialSendData.sci | 38 --------- .../macros/Hardware/RasberryPi/RPI_SerialSetup.sci | 36 -------- 2.3-1/macros/Hardware/RasberryPi/RPI_adress.sci | 34 ++++++++ .../Hardware/RasberryPi/SPI/RPI_SPIDataRW.sci | 42 +++++++++ .../Hardware/RasberryPi/SPI/RPI_SPIGetFd.sci | 39 +++++++++ .../Hardware/RasberryPi/SPI/RPI_SPISetup.sci | 43 ++++++++++ .../Hardware/RasberryPi/SPI/RPI_SPISetupMode.sci | 41 +++++++++ .../macros/Hardware/RasberryPi/SPI/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/SPI/names | 4 + .../Hardware/RasberryPi/Serial/RPI_serialClose.sci | 40 +++++++++ .../RasberryPi/Serial/RPI_serialDataAvail.sci | 40 +++++++++ .../Hardware/RasberryPi/Serial/RPI_serialFlush.sci | 40 +++++++++ .../RasberryPi/Serial/RPI_serialGetchar.sci | 40 +++++++++ .../Hardware/RasberryPi/Serial/RPI_serialOpen.sci | 41 +++++++++ .../RasberryPi/Serial/RPI_serialPrintf.sci | 41 +++++++++ .../RasberryPi/Serial/RPI_serialPutchar.sci | 41 +++++++++ .../Hardware/RasberryPi/Serial/RPI_serialPuts.sci | 41 +++++++++ .../Hardware/RasberryPi/Serial/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/Serial/names | 8 ++ .../Hardware/RasberryPi/Setup/RPI_getAlt.sci | 40 +++++++++ .../Hardware/RasberryPi/Setup/RPI_pinMode.sci | 60 +++++++++++++ .../Hardware/RasberryPi/Setup/RPI_pinModeAlt.sci | 55 ++++++++++++ .../Hardware/RasberryPi/Setup/RPI_pinNumbering.sci | 54 ++++++++++++ .../Hardware/RasberryPi/Setup/RPI_pullControl.sci | 60 +++++++++++++ .../Hardware/RasberryPi/Setup/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/Setup/names | 5 ++ .../Hardware/RasberryPi/Shift/RPI_shiftIn.sci | 42 +++++++++ .../Hardware/RasberryPi/Shift/RPI_shiftOut.sci | 43 ++++++++++ .../Hardware/RasberryPi/Shift/RPI_sr595Setup.sci | 44 ++++++++++ .../Hardware/RasberryPi/Shift/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/Shift/names | 3 + .../Hardware/RasberryPi/Soft/RPI_softPwmCreate.sci | 44 ++++++++++ .../Hardware/RasberryPi/Soft/RPI_softPwmStop.sci | 40 +++++++++ .../Hardware/RasberryPi/Soft/RPI_softPwmWrite.sci | 41 +++++++++ .../RasberryPi/Soft/RPI_softToneCreate.sci | 43 ++++++++++ .../Hardware/RasberryPi/Soft/RPI_softToneStop.sci | 40 +++++++++ .../Hardware/RasberryPi/Soft/RPI_softToneWrite.sci | 41 +++++++++ .../Hardware/RasberryPi/Soft/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/Soft/names | 6 ++ .../Hardware/RasberryPi/Timing/RPI_delay.sci | 40 +++++++++ .../Hardware/RasberryPi/Timing/RPI_delayMicro.sci | 40 +++++++++ .../Hardware/RasberryPi/Timing/RPI_micros.sci | 37 ++++++++ .../Hardware/RasberryPi/Timing/RPI_millis.sci | 37 ++++++++ .../Hardware/RasberryPi/Timing/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/Timing/names | 4 + 2.3-1/macros/Hardware/RasberryPi/buildmacros.sce | 49 ++++++++++- 2.3-1/macros/Hardware/RasberryPi/cleanmacros.sce | 20 +++++ .../RasberryPi/gertBoard/RPI_analogRead.sci | 40 +++++++++ .../RasberryPi/gertBoard/RPI_analogWrite.sci | 41 +++++++++ .../gertBoard/RPI_gertboardAnalogRead.sci | 42 +++++++++ .../gertBoard/RPI_gertboardAnalogSetup.sci | 41 +++++++++ .../gertBoard/RPI_gertboardAnalogWrite.sci | 42 +++++++++ .../RasberryPi/gertBoard/RPI_gertboardSPISetup.sci | 39 +++++++++ .../Hardware/RasberryPi/gertBoard/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/gertBoard/names | 6 ++ .../Hardware/RasberryPi/lcd/RPI_lcdCharDef.sci | 44 ++++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdClear.sci | 40 +++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdCursor.sci | 41 +++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdCursorBlink.sci | 41 +++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdDisplay.sci | 41 +++++++++ .../macros/Hardware/RasberryPi/lcd/RPI_lcdHome.sci | 40 +++++++++ .../macros/Hardware/RasberryPi/lcd/RPI_lcdInit.sci | 54 ++++++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdPosition.sci | 42 +++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdPrintf.sci | 41 +++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdPutchar.sci | 41 +++++++++ .../macros/Hardware/RasberryPi/lcd/RPI_lcdPuts.sci | 42 +++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdSendCommand.sci | 41 +++++++++ .../macros/Hardware/RasberryPi/lcd/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/lcd/names | 12 +++ .../lcd128x64/RPI_lcd128x64Orientation.sci | 48 +++++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64circle.sci | 44 ++++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64clear.sci | 40 +++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64ellipse.sci | 45 ++++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64line.sci | 44 ++++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64lineTo.sci | 42 +++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64point.sci | 42 +++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64putchar.sci | 44 ++++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64puts.sci | 44 ++++++++++ .../lcd128x64/RPI_lcd128x64rectangle.sci | 45 ++++++++++ .../lcd128x64/RPI_lcd128x64setOrigin.sci | 41 +++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64setup.sci | 37 ++++++++ .../Hardware/RasberryPi/lcd128x64/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/lcd128x64/names | 12 +++ 2.3-1/macros/Hardware/RasberryPi/lib | Bin 924 -> 0 bytes .../Hardware/RasberryPi/mcp/RPI_mcp23008Setup.sci | 41 +++++++++ .../Hardware/RasberryPi/mcp/RPI_mcp23016Setup.sci | 41 +++++++++ .../Hardware/RasberryPi/mcp/RPI_mcp23017Setup.sci | 41 +++++++++ .../Hardware/RasberryPi/mcp/RPI_mcp23s08Setup.sci | 42 +++++++++ .../Hardware/RasberryPi/mcp/RPI_mcp23s17Setup.sci | 42 +++++++++ .../macros/Hardware/RasberryPi/mcp/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/mcp/names | 5 ++ 2.3-1/macros/Hardware/RasberryPi/names | 22 +---- .../RasberryPi/old/GetRPISupportFunctions.sci | 48 +++++++++++ .../RasberryPi/old/IsRPISupportFunction.sci | 32 +++++++ .../Hardware/RasberryPi/old/RPI_DelayMicro.sci | 38 +++++++++ .../Hardware/RasberryPi/old/RPI_DelayMilli.sci | 39 +++++++++ .../Hardware/RasberryPi/old/RPI_DigitalIn.sci | 43 ++++++++++ .../Hardware/RasberryPi/old/RPI_DigitalOut.sci | 44 ++++++++++ .../Hardware/RasberryPi/old/RPI_DigitalSetup.sci | 36 ++++++++ .../Hardware/RasberryPi/old/RPI_GetMicros.sci | 39 +++++++++ .../Hardware/RasberryPi/old/RPI_GetMillis.sci | 39 +++++++++ .../RasberryPi/old/RPI_HardPWMSetClock.sci | 35 ++++++++ .../Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci | 32 +++++++ .../RasberryPi/old/RPI_HardPWMSetRange.sci | 35 ++++++++ .../Hardware/RasberryPi/old/RPI_HardPWMWrite.sci | 39 +++++++++ .../macros/Hardware/RasberryPi/old/RPI_PinISR.sci | 56 ++++++++++++ .../Hardware/RasberryPi/old/RPI_SerialClose.sci | 33 ++++++++ .../Hardware/RasberryPi/old/RPI_SerialFlush.sci | 34 ++++++++ .../Hardware/RasberryPi/old/RPI_SerialGetChar.sci | 36 ++++++++ .../Hardware/RasberryPi/old/RPI_SerialSendChar.sci | 37 ++++++++ .../Hardware/RasberryPi/old/RPI_SerialSendData.sci | 38 +++++++++ .../Hardware/RasberryPi/old/RPI_SerialSetup.sci | 36 ++++++++ .../macros/Hardware/RasberryPi/old/buildmacros.sce | 4 + 2.3-1/macros/Hardware/RasberryPi/old/names | 21 +++++ .../RasberryPi/old/u16RPISerialDataAvail.sci | 37 ++++++++ .../Hardware/RasberryPi/pcf/RPI_pcf8574Setup.sci | 43 ++++++++++ .../Hardware/RasberryPi/pcf/RPI_pcf8591Setup.sci | 43 ++++++++++ .../macros/Hardware/RasberryPi/pcf/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/pcf/names | 2 + .../Hardware/RasberryPi/piGlow/RPI_piGlow1.sci | 42 +++++++++ .../Hardware/RasberryPi/piGlow/RPI_piGlowLeg.sci | 41 +++++++++ .../Hardware/RasberryPi/piGlow/RPI_piGlowRing.sci | 41 +++++++++ .../Hardware/RasberryPi/piGlow/RPI_piGlowSetup.sci | 42 +++++++++ .../Hardware/RasberryPi/piGlow/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/piGlow/names | 4 + .../Hardware/RasberryPi/pinMap/RPI_physToGpio.sci | 40 +++++++++ .../Hardware/RasberryPi/pinMap/RPI_wpiToGpio.sci | 40 +++++++++ .../Hardware/RasberryPi/pinMap/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/pinMap/names | 2 + .../Hardware/RasberryPi/pwm/RPI_pwmClock.sci | 40 +++++++++ .../macros/Hardware/RasberryPi/pwm/RPI_pwmMode.sci | 46 ++++++++++ .../Hardware/RasberryPi/pwm/RPI_pwmRange.sci | 40 +++++++++ .../Hardware/RasberryPi/pwm/RPI_pwmToneWrite.sci | 41 +++++++++ .../Hardware/RasberryPi/pwm/RPI_pwmWrite.sci | 45 ++++++++++ .../macros/Hardware/RasberryPi/pwm/buildmacros.sce | 14 +++ 2.3-1/macros/Hardware/RasberryPi/pwm/names | 5 ++ 2.3-1/macros/Hardware/RasberryPi/raspi.sci | 94 +++++++++++++++++++++ 2.3-1/macros/Hardware/RasberryPi/raspi_close.sci | 34 ++++++++ .../Hardware/RasberryPi/u16RPISerialDataAvail.sci | 37 -------- 2.3-1/macros/ImageProcessing/core/lib | Bin 472 -> 0 bytes 2.3-1/macros/ImageProcessing/highgui/lib | Bin 532 -> 0 bytes 2.3-1/macros/ImageProcessing/imgproc/lib | Bin 700 -> 0 bytes 2.3-1/macros/Scilab-Arduino/buildmacros.sce | 35 +++----- 2.3-1/macros/Scilab-Arduino/lib | Bin 664 -> 0 bytes 2.3-1/macros/SymbolTable/lib | Bin 700 -> 0 bytes 2.3-1/macros/ToolInitialization/lib | Bin 752 -> 0 bytes 2.3-1/macros/findDeps/lib | Bin 568 -> 0 bytes 2.3-1/macros/lib | Bin 484 -> 0 bytes 196 files changed, 5426 insertions(+), 772 deletions(-) delete mode 100644 2.3-1/macros/ASTManagement/lib delete mode 100644 2.3-1/macros/CCodeGeneration/lib delete mode 100644 2.3-1/macros/ErrorMessages/lib delete mode 100644 2.3-1/macros/FunctionAnnotation/lib delete mode 100644 2.3-1/macros/FunctionList/lib delete mode 100644 2.3-1/macros/GeneralFunctions/lib delete mode 100644 2.3-1/macros/Hardware/AVR/lib create mode 100755 2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalRead.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalReadByte.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWriteByte.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Digital/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Digital/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CRead.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg16.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg8.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetupInterface.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg16.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg8.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_i2cdetect.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/Interrupt/RPI_waitForInterrupt.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Interrupt/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Interrupt/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/Misc/RPI_boardRev.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Misc/RPI_padDrive.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Misc/RPI_sn3218Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Misc/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Misc/names delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_DelayMicro.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_DelayMilli.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_DigitalIn.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_DigitalOut.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetClock.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetMode.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetRange.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMWrite.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_SerialClose.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_SerialFlush.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendData.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_SerialSetup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/RPI_adress.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIDataRW.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIGetFd.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetupMode.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/SPI/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/SPI/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialClose.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialDataAvail.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialFlush.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialGetchar.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialOpen.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPrintf.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPutchar.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPuts.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/Setup/RPI_getAlt.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinMode.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinModeAlt.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinNumbering.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pullControl.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Setup/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Setup/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftIn.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftOut.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Shift/RPI_sr595Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Shift/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Shift/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmCreate.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmStop.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneCreate.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneStop.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delay.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delayMicro.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Timing/RPI_micros.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Timing/RPI_millis.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Timing/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Timing/names mode change 100644 => 100755 2.3-1/macros/Hardware/RasberryPi/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/cleanmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogRead.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogRead.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogSetup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardSPISetup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCharDef.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdClear.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursor.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursorBlink.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdDisplay.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdHome.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdInit.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPosition.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPrintf.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPutchar.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPuts.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdSendCommand.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64Orientation.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64circle.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64clear.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64ellipse.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64line.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64lineTo.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64point.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64putchar.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64puts.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64rectangle.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setOrigin.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/names delete mode 100644 2.3-1/macros/Hardware/RasberryPi/lib create mode 100755 2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23008Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23016Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23017Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s08Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s17Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/mcp/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/mcp/names mode change 100644 => 100755 2.3-1/macros/Hardware/RasberryPi/names create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/GetRPISupportFunctions.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/IsRPISupportFunction.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMicro.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMilli.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalIn.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalOut.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalSetup.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMicros.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMillis.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetClock.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetRange.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMWrite.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_PinISR.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialClose.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialFlush.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialGetChar.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendChar.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendData.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSetup.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/buildmacros.sce create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/names create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/u16RPISerialDataAvail.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8574Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8591Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pcf/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/pcf/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlow1.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowLeg.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowRing.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowSetup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/piGlow/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/piGlow/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_physToGpio.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_wpiToGpio.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pinMap/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/pinMap/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmClock.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmMode.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmRange.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmToneWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pwm/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/pwm/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/raspi.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/raspi_close.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci delete mode 100644 2.3-1/macros/ImageProcessing/core/lib delete mode 100644 2.3-1/macros/ImageProcessing/highgui/lib delete mode 100644 2.3-1/macros/ImageProcessing/imgproc/lib mode change 100644 => 100755 2.3-1/macros/Scilab-Arduino/buildmacros.sce delete mode 100644 2.3-1/macros/Scilab-Arduino/lib delete mode 100644 2.3-1/macros/SymbolTable/lib delete mode 100644 2.3-1/macros/ToolInitialization/lib delete mode 100644 2.3-1/macros/findDeps/lib delete mode 100644 2.3-1/macros/lib (limited to '2.3-1/macros') diff --git a/2.3-1/macros/ASTManagement/lib b/2.3-1/macros/ASTManagement/lib deleted file mode 100644 index e9d351a5..00000000 Binary files a/2.3-1/macros/ASTManagement/lib and /dev/null differ diff --git a/2.3-1/macros/CCodeGeneration/lib b/2.3-1/macros/CCodeGeneration/lib deleted file mode 100644 index f2696fef..00000000 Binary files a/2.3-1/macros/CCodeGeneration/lib and /dev/null differ diff --git a/2.3-1/macros/ErrorMessages/lib b/2.3-1/macros/ErrorMessages/lib deleted file mode 100644 index 1500b1fa..00000000 Binary files a/2.3-1/macros/ErrorMessages/lib and /dev/null differ diff --git a/2.3-1/macros/FunctionAnnotation/lib b/2.3-1/macros/FunctionAnnotation/lib deleted file mode 100644 index 5eb9bc2f..00000000 Binary files a/2.3-1/macros/FunctionAnnotation/lib and /dev/null differ diff --git a/2.3-1/macros/FunctionList/lib b/2.3-1/macros/FunctionList/lib deleted file mode 100644 index e101853b..00000000 Binary files a/2.3-1/macros/FunctionList/lib and /dev/null differ diff --git a/2.3-1/macros/GeneralFunctions/lib b/2.3-1/macros/GeneralFunctions/lib deleted file mode 100644 index 846ca1b2..00000000 Binary files a/2.3-1/macros/GeneralFunctions/lib and /dev/null differ diff --git a/2.3-1/macros/Hardware/AVR/lib b/2.3-1/macros/Hardware/AVR/lib deleted file mode 100644 index 53e56599..00000000 Binary files a/2.3-1/macros/Hardware/AVR/lib and /dev/null differ diff --git a/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalRead.sci b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalRead.sci new file mode 100755 index 00000000..f3f229f9 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalRead.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_digitalRead(pin) +// Function to read the digital voltage at the given pin +// +// Calling Sequence +// v=RPI_digitalRead(pin) +// +// Parameters +// pin: The pin number to read the voltage from. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// +// Description +// This funtion reads the digital voltage at the given pin. Returns a 0 (for low) and 1 (for high). +// Note: pin should be set for input mode using RPI_pinMode. The function will also return 0/1 corresponding to what the voltage is set for an output pin. +// +// Examples +// v=RPI_digitalRead(0) +// See also +// RPI_analogWrite, RPI_analogRead, RPI_digitalWrite, RPI_pinNumbering, RPI_pinMode +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="diR#1#"+string(pin)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalReadByte.sci b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalReadByte.sci new file mode 100755 index 00000000..5cbccc21 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalReadByte.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function out=RPI_digitalReadByte() +// Function to read first 8 GPIO pins +// +// Calling Sequence +// b=RPI_digitalReadByte() +// +// Description +// This function read the state of the first eight GPIO pins at once. The state is read from pin0 to pin7. +// +// Note: The MSB-LSB sequence here is opposite of that of the RPI_digitalWriteByte. +// +// Examples +// b=RPI_digitalReadByte() +// See also +// RPI_digitalWriteByte, RPI_digitalRead +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="BtR#0#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWrite.sci b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWrite.sci new file mode 100755 index 00000000..d4ac660b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWrite.sci @@ -0,0 +1,46 @@ +// Copyright (C) 2017 - 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 RPI_digitalWrite(pin,Volt) +// Function to set digital voltage at the given pin +// +// Calling Sequence +// RPI_digitalWrite(pin,Volt) +// +// Parameters +// pin : The pin number to set the voltage at. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// Volt: Digital voltage to set. 0 (for logic-LOW) or 1 (for logic-HIGH) +// +// Description +// This funtion sets the voltage at the given pin. 0v for logic 0 and 3.3v for logic 1. +// Note: pin should be set for output mode using RPI_pinMode. +// +// Examples +// RPI_digitalWrite(0,1) +// See also +// RPI_analogWrite, RPI_digitalRead, RPI_digitalRead, RPI_pinNumbering, RPI_pinMode +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + if (Volt==0 | Volt==1) then + commande="diW#2#"+string(pin)+"#"+string(Volt)+"#"; + else + error("Voltage logic should be 0 or 1."); + end + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWriteByte.sci b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWriteByte.sci new file mode 100755 index 00000000..f7f9191c --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWriteByte.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_digitalWriteByte(Byte) +// Function to set first eight GPIO pins to a particular value +// +// Calling Sequence +// RPI_digitalWriteByte(Byte) +// +// Parameters +// Byte: An 8-bit byte to write on the first 8 GPIO pins. Inter from 0 to 255. +// +// Description +// This writes the 8-bit byte supplied to the first 8 GPIO pins. It’s the fastest way to set all 8 bits at once to a particular value, although it still takes two write operations to the Pi’s GPIO hardware. The state is written from pin7 to pin0. +// +// Note: The MSB-LSB sequence here is opposite to that from RPI_digitalReadByte. +// +// Examples +// RPI_digitalWriteByte(128) +// See also +// RPI_digitalReadByte, RPI_digitalWrite +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="BtW#1#"+string(Byte)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Digital/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Digital/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Digital/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Digital/names b/2.3-1/macros/Hardware/RasberryPi/Digital/names new file mode 100755 index 00000000..27fe63bc --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Digital/names @@ -0,0 +1,4 @@ +RPI_digitalRead +RPI_digitalReadByte +RPI_digitalWrite +RPI_digitalWriteByte diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CRead.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CRead.sci new file mode 100755 index 00000000..afd98500 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CRead.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_I2CRead(fd) +// Function to read device +// +// Calling Sequence +// RPI_I2CRead(fd) +// +// Parameters +// fd: file descriptor obtained from RPI_I2CSetup +// +// Description +// Function for a simple device read. Some devices present data when you read them without having to do any register transactions. +// +// Examples +// RPI_I2CRead(13) +// See also +// RPI_i2cdetect, RPI_I2CReadReg8, RPI_I2CReadReg16, RPI_I2CWrite, RPI_I2CWriteReg8, RPI_I2CWriteReg16, RPI_I2CSetupInterface, RPI_I2CSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CR1#1#"+string(fd)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg16.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg16.sci new file mode 100755 index 00000000..f0ad9898 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg16.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_I2CReadReg16(fd,reg) +// Function to read 16-bit valu from the register +// +// Calling Sequence +// RPI_I2CReadReg16(fd,reg) +// +// Parameters +// fd : file descriptor obtained from RPI_I2CSetup +// reg: integer register to read data from +// +// Description +// This function reads a 16-bit value from the device register indicated. +// +// Examples +// RPI_I2CReadReg16(13,0x40) +// See also +// RPI_i2cdetect, RPI_I2CRead, RPI_I2CReadReg8, RPI_I2CWrite, RPI_I2CWriteReg8, RPI_I2CWriteReg16, RPI_I2CSetupInterface, RPI_I2CSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CR3#2#"+string(fd)+"#"+string(reg)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg8.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg8.sci new file mode 100755 index 00000000..d2ab59fd --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg8.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_I2CReadReg8(fd,reg) +// Function to read 8-bit valu from the register +// +// Calling Sequence +// RPI_I2CReadReg8(fd,reg) +// +// Parameters +// fd : file descriptor obtained from RPI_I2CSetup +// reg: integer register to read data from +// +// Description +// This function reads an 8-bit value from the device register indicated. +// +// Examples +// RPI_I2CReadReg8(13,0x40) +// See also +// RPI_i2cdetect, RPI_I2CRead, RPI_I2CReadReg16, RPI_I2CWrite, RPI_I2CWriteReg8, RPI_I2CWriteReg16, RPI_I2CSetupInterface, RPI_I2CSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CR2#2#"+string(fd)+"#"+string(reg)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetup.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetup.sci new file mode 100755 index 00000000..801c2e6d --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetup.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 out=RPI_I2CSetup(addr) +// Function to initialize the I2C system +// +// Calling Sequence +// fd=RPI_I2CSetup(addr) +// +// Parameters +// addr: integer, the I2C number of the device obtained using RPI_i2cdetect +// +// Description +// This initialises the I2C system with your given device identifier. The addr is the I2C number of the device and obtained using RPI_i2cdetect program. The function works out the Raspberry Pi revision and opens the appropriate device in /dev. +// +//The return value is the standard Linux filehandle, or -1 if any error – in which case, errno can be consulted as usual. +// +// Examples +// fd=RPI_I2CSetup(64) +// See also +// RPI_i2cdetect, RPI_I2CRead, RPI_I2CReadReg8, RPI_I2CReadReg16, RPI_I2CWrite, RPI_I2CWriteReg8, RPI_I2CWriteReg16, RPI_I2CSetupInterface +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CSe#1#"+string(addr)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetupInterface.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetupInterface.sci new file mode 100755 index 00000000..fed4f059 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetupInterface.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_I2CSetupInterface(device,addr) +// Function to select different I2C interfaces +// +// Calling Sequence +// I2CSetupInterface(device,addr) +// +// Parameters +// device: device +// addr : the I2C number of the device obtained using RPI_i2cdetect +// +// Description +// This feature is not implemented currently, and will be used to select different I2C interfaces if the RPi ever receives them. +// +// Examples +// I2CSetupInterface(1,0x48) +// See also +// RPI_i2cdetect, RPI_I2CRead, RPI_I2CReadReg8, RPI_I2CReadReg16, RPI_I2CWrite, RPI_I2CWriteReg8, RPI_I2CWriteReg16, RPI_I2CSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CSI#2#"+string(device)+"#"+string(addr)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWrite.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWrite.sci new file mode 100755 index 00000000..854b3b26 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWrite.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_I2CWrite(fd,data) +// Function to write to device +// +// Calling Sequence +// RPI_I2CWrite(fd,data) +// +// Parameters +// fd : file descriptor obtained from RPI_I2CSetup +// data: integer data to write to device +// +// Description +// Function for simple device write. Some devices accept data this way without needing to access any internal registers. +// +// Examples +// RPI_I2CWrite(13,100) +// See also +// RPI_i2cdetect, RPI_I2CRead, RPI_I2CReadReg8, RPI_I2CReadReg16, RPI_I2CWriteReg8, RPI_I2CWriteReg16, RPI_I2CSetupInterface, RPI_I2CSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CW1#2#"+string(fd)+"#"+string(data)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg16.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg16.sci new file mode 100755 index 00000000..b2e8fb69 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg16.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_I2CWriteReg16(fd,reg,data) +// Function to write 16-bit data to register +// +// Calling Sequence +// RPI_I2CWriteReg16(fd,reg,data) +// +// Parameters +// fd : file descriptor obtained from RPI_I2CSetup +// reg : integer register to write data at +// data: integer data to write to device +// +// Description +// This function writes a 16-bit data value into the device register indicated. +// +// Examples +// RPI_I2CWriteReg16(13,0x40,100) +// See also +// RPI_i2cdetect, RPI_I2CRead, RPI_I2CReadReg8, RPI_I2CReadReg16, RPI_I2CWrite, RPI_I2CWriteReg8, RPI_I2CSetupInterface, RPI_I2CSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CW3#3#"+string(fd)+"#"+string(reg)+"#"+string(data)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg8.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg8.sci new file mode 100755 index 00000000..19c81570 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg8.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_I2CWriteReg8(fd,reg,data) +// Function to write 8-bit data to register +// +// Calling Sequence +// RPI_I2CWriteReg8(fd,reg,data) +// +// Parameters +// fd : file descriptor obtained from RPI_I2CSetup +// reg : integer register to write data at +// data: integer data to write to device +// +// Description +// This function writes an 8-bit data value into the device register indicated. +// +// Examples +// RPI_I2CWriteReg8(13,0x40,100) +// See also +// RPI_i2cdetect, RPI_I2CRead, RPI_I2CReadReg8, RPI_I2CReadReg16, RPI_I2CWrite, RPI_I2CWriteReg16, RPI_I2CSetupInterface, RPI_I2CSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CW2#3#"+string(fd)+"#"+string(reg)+"#"+string(data)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_i2cdetect.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_i2cdetect.sci new file mode 100755 index 00000000..a37bc4cb --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_i2cdetect.sci @@ -0,0 +1,38 @@ +// Copyright (C) 2017 - 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 out=RPI_i2cdetect() +// Function to get the address of attached i2c device +// +// Calling Sequence +// RPI_i2cdetect() +// +// Description +// This function returns the address of the i2c device connected to the Raspberry pi. +// +// Examples +// addr=RPI_i2cdetect() +// See also +// RPI_I2CRead, RPI_I2CSetup, RPI_I2CReadReg8, RPI_I2CReadReg16, RPI_I2CSetupInterface, RPI_I2CWrite, RPI_I2CWriteReg8, RPI_I2CWriteReg16 +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + rev=RPI_boardRev(); + commande="i2c#1#i2cdetect -y "+string(strtod(rev)-1)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/I2C/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/names b/2.3-1/macros/Hardware/RasberryPi/I2C/names new file mode 100755 index 00000000..5a318865 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/names @@ -0,0 +1,9 @@ +RPI_I2CRead +RPI_I2CReadReg16 +RPI_I2CReadReg8 +RPI_I2CSetup +RPI_I2CSetupInterface +RPI_I2CWrite +RPI_I2CWriteReg16 +RPI_I2CWriteReg8 +RPI_i2cdetect diff --git a/2.3-1/macros/Hardware/RasberryPi/Interrupt/RPI_waitForInterrupt.sci b/2.3-1/macros/Hardware/RasberryPi/Interrupt/RPI_waitForInterrupt.sci new file mode 100755 index 00000000..bb180420 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Interrupt/RPI_waitForInterrupt.sci @@ -0,0 +1,45 @@ +// Copyright (C) 2017 - 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 out=RPI_waitForInterrupt(pin,timeOut) +// Function to set a pin to wait for interrupt. +// +// Calling Sequence +// i=RPI_waitForInterrupt(pin,timeOut) +// +// Parameters +// pin : The pin to check for interrupt. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// timeOut: The time (in milliseconds) for which to wait for interrupt. -1 to wait forever. +// +// Description +// When called, it will wait for an interrupt event to happen on that pin and the program will be stalled. The return value is -1 if an error occurred (and errno will be set appropriately), 0 if it timed out, or 1 on a successful interrupt event. +// +// Before using RPI_waitForInterrupt, first initialise the GPIO pin and at present the only way to do this is to use the gpio program, either in a script, or using the system() call from inside the program. +// Eg: To wait for a falling-edge interrupt on GPIO pin 0, setup the hardware using (before running the program): +// gpio edge 0 falling +// +// Examples +// i=RPI_waitForInterrupt(0,5000) +// See also +// +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Int#2#"+string(pin)+"#"+string(timeOut)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Interrupt/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Interrupt/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Interrupt/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Interrupt/names b/2.3-1/macros/Hardware/RasberryPi/Interrupt/names new file mode 100755 index 00000000..248c3e24 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Interrupt/names @@ -0,0 +1 @@ +RPI_waitForInterrupt diff --git a/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_boardRev.sci b/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_boardRev.sci new file mode 100755 index 00000000..91ddb333 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_boardRev.sci @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - 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 out=RPI_boardRev() +// Function to print the board revision. +// +// Calling Sequence +// rev=RPI_boardRev() +// +// Description +// This function returns the board revision of the Raspberry Pi. Returns either 1 or 2. +// +// Examples +// rev=RPI_boardRev() +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="bRv#0#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_padDrive.sci b/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_padDrive.sci new file mode 100755 index 00000000..f2d0b177 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_padDrive.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_padDrive(Group,value) +// Function to set the 'strength' of the pad drivers for a particular group of pins +// +// Calling Sequence +// RPI_padDrive(Group,value) +// +// Parameters +// Group: the group to act on, a number from 0 to 2 +// Value: the strength, from 0 to 7, to set for the group +// +// Description +// This sets the “strength” of the pad drivers for a particular group of pins. There are 3 groups of pins and the drive strength is from 0 to 7. Do not use this unless you know what you are doing +// +// Examples +// RPI_padDrive(0,5) +// See also +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pDr#2#"+string(Group)+"#"+string(value)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_sn3218Setup.sci b/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_sn3218Setup.sci new file mode 100755 index 00000000..0791c506 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_sn3218Setup.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_sn3218Setup(pinBase) +// Function for setting up SN3218 I2C based LED controller. +// +// Calling Sequence +// RPI_sn3218Setup(pinBase) +// +// Parameters +// pinBase: any number above 64. The consecutive 18 pins will be allocated alongwith. +// +// Description +// This function sets up the extension module for the SN3218 I2C based LED controller.There is no I2C device address passed into the setup function – the SN3218 has a fixed I2C address of 0x54, so there’s no need to refer to it other than internally inside the driver. This also means that only one device can be connected to a Raspberry Pi. +// +// Examples +// RPI_sn3218Setup(67) +// See also +// RPI_sr595Setup, RPI_pcf8574Setup, RPI_pcf8591Setup, RPI_mcp23008Setup, RPI_mcp23016Setup, RPI_mcp23017Setup, RPI_mcp23s08Setup, RPI_mcp23s17Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sn3#1#"+string(pinBase)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Misc/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Misc/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Misc/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Misc/names b/2.3-1/macros/Hardware/RasberryPi/Misc/names new file mode 100755 index 00000000..35a4a425 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Misc/names @@ -0,0 +1,3 @@ +RPI_boardRev +RPI_padDrive +RPI_sn3218Setup diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_DelayMicro.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_DelayMicro.sci deleted file mode 100644 index bbb0bb3b..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_DelayMicro.sci +++ /dev/null @@ -1,38 +0,0 @@ -// 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 RPI_DelayMicro(time) -// Function to insert some delay in code execution. -// -// Calling Sequence -// RPI_DelayMicro(time) -// -// Parameters -// time: time(microseconds) for which execution is to be delayed -// -// Description -// this function can be used for insertig execution delays. 'time' should be -// specified in microseconds.'time' should be between (1-65536). -// Note: Delay inserted by this function is not accurate, but depedent on -// operating system, other running tasks etc. -// -// Examples -// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. -// -// See also -// RPI_DelayMicro -// -// -// Authors -// Siddhesh Wani -// - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_DelayMilli.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_DelayMilli.sci deleted file mode 100644 index 13b79625..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_DelayMilli.sci +++ /dev/null @@ -1,39 +0,0 @@ -// 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 RPI_DelayMilli(time) -// Function to insert some delay in milli seconds in code execution. -// -// Calling Sequence -// RPI_DelayMilli(time) -// -// Parameters -// time: time(milliseconds) for which execution is to be delayed -// -// Description -// This function can be used for insertig execution delays. 'time' should be -// specified in milliseconds. If more resolution is required, use 'RPI_DelayMicro' -// for inserting delay in microseconds. -// Note: Delay inserted by this function is not accurate, but depedent on -// operating system, other running tasks etc. -// -// Examples -// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. -// -// See also -// RPI_DelayMicro -// -// -// Authors -// Siddhesh Wani -// - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalIn.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalIn.sci deleted file mode 100644 index 781c49c8..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalIn.sci +++ /dev/null @@ -1,43 +0,0 @@ -// 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 state = RPI_DigitalIn(pin) -// Function to read current state on digital pins. -// -// Calling Sequence -// state = RPI_DigitalIn(pin) -// -// Parameters -// pin : pin of RPi to be used -// state : current state of the pin (0 -> LOW, 1 -> HIGH) -// -// Description -// This fucntion is used for reading the current state on gpio pins of RPi. 'RPI_DigitalSetup' function must be called before this for setting up pin as input. 'pin' must be specified from list given. 'state' specifies the input state (0 -> Low, 1-> High) -// Examples -// RPI_DigitalIn(RPI_GPIO_P1_03) //Reads the state of pin 3 of header P1. -// -// See also -// RPI_DigitalSetup RPI_DigitalOut -// -// -// 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,27,28,29,... - 31,31,33,35,36,37,38,40]; - -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 -state = 1; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalOut.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalOut.sci deleted file mode 100644 index dde3c934..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalOut.sci +++ /dev/null @@ -1,44 +0,0 @@ -// 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 RPI_DigitalOut(pin, state) -// Function to output desired state on digital pins. -// -// Calling Sequence -// RPI_DigitalOut(pin, state) -// -// Parameters -// pin : pin of RPi to be used -// state : desired state of the pin (0 -> LOW, 1 -> HIGH) -// -// Description -// This fucntion is used for outputting the desired state on gpio pins of RPi. 'RPI_DigitalSetup' function must be called before this for setting up pin as output. 'pin' must be specified from list given. 'state' specifies the output state (0 -> Low, 1-> High) -// Examples -// RPI_DigitalOut(RPI_GPIO_P1_03,0) //Changes the state of pin 3 of header P1 as 'Low'. -// -// See also -// RPI_DigitalSetup RPI_DigitalIn -// -// -// 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,27,28,29,... - 31,31,33,35,36,37,38,40]; - -PinIsGPIO = members(pin, supported_pins); //Check if output 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 -state = 1; - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci deleted file mode 100644 index 01d6e07d..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci +++ /dev/null @@ -1,36 +0,0 @@ -function RPI_DigitalSetup(pin, direction) -// Function to setup digital pins. -// -// Calling Sequence -// RPI_DigitalSetup(pin,direction) -// -// Parameters -// pin : pin of RPi to be used -// direction : direction to be set for pin -// 0 -> INPUT, 1 -> OUTPUT, 2->PWM 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(3,0) //Sets pin 3 of header P1 as input -// -// See also -// RPI_DigitalIn RPI_DigitalOut -// -// -// 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,27,28,29,... - 31,31,33,35,36,37,38,40]; - -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 -state = 1; - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.sci deleted file mode 100644 index 6c4db57a..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.sci +++ /dev/null @@ -1,39 +0,0 @@ -// 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 Micros = RPI_GetMicros() -// Function to get time in Microsecond since first setup function called. -// -// Calling Sequence -// Micros = RPI_GetMicros() -// -// Parameters -// Micros: time in Microseconds since first setup function called -// -// Description -// This function can be used to get time since first setup function called. -// Note: To use this function atleast one setup function must be called. -// -// Examples -// start = RPI_GetMicros() -// RPI_DelayMicro(1000) //This will delay the execution of next code by 100 ms. -// end = RPI_GetMicros() -// delay = end- start //This should be approximately 1000 us. -// -// See also -// RPI_GetMillis RPI_DelayMilli RPI_DelayMicro -// -// -// Authors -// Siddhesh Wani -// - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -Micros = 0; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.sci deleted file mode 100644 index c034a705..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.sci +++ /dev/null @@ -1,39 +0,0 @@ -// 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 Millis = RPI_GetMillis() -// Function to get time in millisecond since first setup function called. -// -// Calling Sequence -// Millis = RPI_GetMillis() -// -// Parameters -// Millis: time in milliseconds since first setup function called -// -// Description -// This function can be used to get time since first setup function called. -// Note: To use this function atleast one setup function must be called. -// -// Examples -// start = RPI_GetMillis() -// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. -// end = RPI_GetMillis() -// delay = end- start //This should be approximately 100ms. -// -// See also -// RPI_GetMicros RPI_DelayMilli RPI_DelayMicro -// -// -// Authors -// Siddhesh Wani -// - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -Millis = 0; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetClock.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetClock.sci deleted file mode 100644 index 8448d364..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetClock.sci +++ /dev/null @@ -1,35 +0,0 @@ -// 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 RPI_HardPWMSetClock(clock_divisor) -// Function to set PWM clock. PWM clock frequency is 19.2MHz, which can be reduced -// using suitable clock_divisor (1 to 2048, powers of 2) -// -// Calling Sequence -// RPI_HardPWMSetClock(clock_divisor) -// -// Parameters -// clock_divisor: Value can be from 1 to 2048, powers of 2. -// Description -// This function decides pwm clock. -// PWM frequency = (PWM Clock frequency/Clock divisor/range) -// PWM clock frequency = 19.2 MHz -// clock divisor is setup using RPI_HardPWMSetClock -// range is setup using RPI_HardPWMSetRange -// Examples -// -// See also -// RPI_HardPWMSetWrite RPI_HardPWMSetRange -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetMode.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetMode.sci deleted file mode 100644 index 57b82601..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetMode.sci +++ /dev/null @@ -1,32 +0,0 @@ -// 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 RPI_HardPWMSetMode(pwm_mode) -// Function to set PWM mode. Two modes are available - balanced and mark/space -// -// Calling Sequence -// RPI_HardPWMSetMode(pwm_mode) -// -// Parameters -// pwm_mode: decides pwm mode -// 0 -> balanced -// 1 -> mark/space -// Description -// This function decides pwm mode -// Examples -// -// See also -// RPI_HardPWMSetWrite RPI_HardPWMSetRange -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetRange.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetRange.sci deleted file mode 100644 index c2075e2d..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetRange.sci +++ /dev/null @@ -1,35 +0,0 @@ -// 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 RPI_HardPWMSetRange(range_val) -// Function to set range value for PWM. Range value along with clock divisor -// decides pwm frequency. Range value must be less than 1024 -// -// Calling Sequence -// RPI_HardPWMSetRange(range_val) -// -// Parameters -// range_val: range for pwm -// Description -// This function decides range for pwm. -// PWM frequency = (PWM Clock frequency/Clock divisor/range) -// PWM clock frequency = 19.2 MHz -// clock divisor is setup using RPI_HardPWMSetClock -// range is setup using RPI_HardPWMSetRange -// Examples -// -// See also -// RPI_HardPWMSetClock RPI_HardPWMWrite -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMWrite.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMWrite.sci deleted file mode 100644 index dba5e674..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMWrite.sci +++ /dev/null @@ -1,39 +0,0 @@ -// 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 RPI_HardPWMWrite(pin,value) -// Function to change pwm duty on specified pin. Hardware PWM is available -// only on pin 12. So, only '12' should be provided as pin -// -// Calling Sequence -// RPI_HardPWMWrite(12,512) //Value must be smaller than the range set -// using RPI_HARDPWMSetRange -// -// Parameters -// pin: pin no on which pwm value is to be changed. Currently only 12 is allowed -// value: pwm value for given pin. This must be less than range value set -// Description -// This function changes pwm duty on specified pin. As for RPi, only one pin -// (pin 12) is available for hardware PWM. -// PWM frequency = (PWM Clock frequency/Clock divisor/range) -// PWM clock frequency = 19.2 MHz -// clock divisor is setup using RPI_HardPWMSetClock -// range is setup using RPI_HardPWMSetRange -// Actual PWM duty = value/range -// Examples -// -// See also -// RPI_HardPWMSetClock RPI_HardPWMSetRange -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.sci deleted file mode 100644 index c2354c1f..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.sci +++ /dev/null @@ -1,56 +0,0 @@ -// 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 RPI_PinISR(pin, edgetype, fn) -// Function to assign a function to be run when an interrupt occurs on -// specified pin. -// -// Calling Sequence -// RPI_PinISR(pin, edgetype, fn) -// -// Parameters -// pin : pin whose interrupt is to be configured -// edgetype: edge on which interrupt is to be monitored -// 1 -> Falling egde -// 2 -> Rising egde -// 3 -> Both egde -// fn: name of the function to be executed on interrupt occurance -// Description -// This functions monitors interrupt on specified pin for specified edge, -// When that interrupt occurs, function specified by 'fn' is executed. -// Examples -// RPI_PinISR(12, 0, Pin12ISR) //executes 'Pin12ISR' on falling edge on -// pin 12 -// See also -// RPI_ThreadCreate RPI_DigitalSetup -// -// -// 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,27,28,29,... - 31,31,33,35,36,37,38,40]; - -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 -EdgeTypeSupported = members(edgetype,[1 2 3]); - -if(EdgeTypeSupported == 0) - error(9999, 'SCI2CERROR: Given edgetype is incorrect. Please specify correct edgetype from [1,2,3]') -end - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialClose.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialClose.sci deleted file mode 100644 index f27dd432..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialClose.sci +++ /dev/null @@ -1,33 +0,0 @@ -// 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 RPI_SerialClose(fd) -// Function to close serial port specified by file descriptor. -// -// Calling Sequence -// RPI_SerialClose(fd) -// -// Parameters -// fd : file descriptor for opened port -// Description -// This functions closes the specified serial port -// Examples -// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' -// RPI_SerialClose(serial1) -// See also -// RPI_SerialOpen RPI_SerialSendChar -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialFlush.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialFlush.sci deleted file mode 100644 index 9bab386f..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialFlush.sci +++ /dev/null @@ -1,34 +0,0 @@ -// 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 data = RPI_SerialGetChar(fd) -// Function to read data from specified serial port -// -// Calling Sequence -// RPI_SerialGetCharfd) -// -// Parameters -// fd: file descriptor returned when serial port was opened -// Description -// This functions reads character form specified port. In case no -// character is available, -1 is returned after 10 sec. -// Examples -// serial = RPI_SetupSerial("/dev/ttyAMA0", 9600); -// RPI_SerialFlush(serial); -// bytes = RPI_SerialDataAvail(serial); -// -// See also -// RPI_SetupSerial RPI_SendData -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci deleted file mode 100644 index a26e5b97..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci +++ /dev/null @@ -1,36 +0,0 @@ -// 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 data = RPI_SerialGetChar(fd) -// Function to read data from specified serial port -// -// Calling Sequence -// RPI_SerialGetChar(fd) -// -// Parameters -// fd: file descriptor returned when serial port was opened -// Description -// This functions reads character form specified port. In case no -// character is available, -1 is returned after 10 sec. -// Examples -// serial = RPI_SetupSerial("/dev/ttyAMA0", 9600); -// bytes = RPI_SerialDataAvail(serial); -// if(bytes>0) -// data = RPI_SerialGetChar(serial) //Reads single character -// end -// See also -// RPI_SetupSerial RPI_SendData -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -data = 0; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci deleted file mode 100644 index 769b21d2..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci +++ /dev/null @@ -1,37 +0,0 @@ -// 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 RPI_SerialSendChar(fd, data) -// Function to send 8-bit char through serial port. -// -// Calling Sequence -// RPI_SerialSendChar(fd, data) -// -// Parameters -// fd : file descriptor for opened port -// data: 8-bit character data to be sent -// Description -// This functions sends input 8-bit character data on specified serial port -// Examples -// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' -// RPI_SerialSendChar(serial1, 'H'); -// RPI_SerialSendChar(serial1, 'i'); -// RPI_SerialClose(serial1); -// -// See also -// RPI_SerialOpen RPI_SerialClose -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendData.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendData.sci deleted file mode 100644 index c05852b1..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendData.sci +++ /dev/null @@ -1,38 +0,0 @@ -// 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 RPI_SerialSendData(fd, data) -// Function to send data through serial port. Data can be of any datatype and -// can be scalar or matrix -// -// Calling Sequence -// RPI_SerialSendData(fd, data) -// -// Parameters -// fd : file descriptor for opened port -// data: data to be sent -// Description -// This functions sends input data on specified serial port -// Examples -// A = [2 3; 4 5] -// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' -// RPI_SerialSendData(serial1, A); -// RPI_SerialClose(serial1); -// -// See also -// RPI_SerialOpen RPI_SerialClose -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSetup.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSetup.sci deleted file mode 100644 index 0f266610..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSetup.sci +++ /dev/null @@ -1,36 +0,0 @@ -// 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 fd = RPI_SerialSetup(port, baudrate) -// Function to setup serial port. -// -// Calling Sequence -// RPI_SerialSetup(port, baudrate) -// -// Parameters -// port : port of RPi to be used (eg. ) -// direction : direction to be set for pin (0 -> INPUT, 1 -> OUTPUT) -// fd : file descriptor for opened port, -1 for error -// Description -// This functions opens the specified serial port and returns file descriptor -// for the same -// Examples -// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' -// -// See also -// RPI_SerialClose RPI_SerialSendChar -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -fd = 0; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_adress.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_adress.sci new file mode 100755 index 00000000..4c9aa7f0 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_adress.sci @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - 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 + +global RPI_piAdress; +function RPI_adress(adress) + // Function for non-ssh connection to raspberry pi + // + // Calling Sequence + // RPI_adress(adress) + // + // Parameters + // address : Network address of the raspberry pi. Eg:192.168.137.214 + // + // Description + // This program is required for the functioning of the remaining toolbox if the server is manually run by the user. + // + // Examples + // RPI_adress('10.42.0.82') + // See also + // raspi,raspi_close + // + // Authors + // Jorawar Singh + + global RPI_piAdress; + RPI_piAdress=adress; +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIDataRW.sci b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIDataRW.sci new file mode 100755 index 00000000..186e68ff --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIDataRW.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_SPIDataRW(channel,data,len) +// Function to perform simultaneous read-write on SPI +// +// Calling Sequence +// RPI_SPIDataRW(channel,data,len) +// +// Parameters +// channel: channel number, 0 or 1 +// data : data to write as list of integers +// len : length of the data +// +// Description +// This performs a simultaneous write/read transaction over the selected SPI bus. Data that was in your buffer is overwritten by data returned from the SPI bus. +// +// Examples +// RPI_SPIDataRW(0,[13,58],2) +// See also +// RPI_SPISetup, RPI_SPISetupMode, RPI_SPIGetFd +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="SPD#3#"+string(channel)+"#"+string(data)+"#"+string(len)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIGetFd.sci b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIGetFd.sci new file mode 100755 index 00000000..43cfc098 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIGetFd.sci @@ -0,0 +1,39 @@ +// Copyright (C) 2017 - 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 out=RPI_SPIGetFd(channel) +// +// Calling Sequence +// RPI_SPIGetFd(channel) +// +// Parameters +// channel: channel number, 0 or 1 +// +// Description +// +// +// Examples +// RPI_SPIGetFd(1) +// See also +// RPI_SPIDataRW, RPI_SPISetup, RPI_SPISetupMode +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="SPG#1#"+string(channel)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetup.sci b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetup.sci new file mode 100755 index 00000000..5654cf9b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetup.sci @@ -0,0 +1,43 @@ +// Copyright (C) 2017 - 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 RPI_SPISetup(channel,speed) +// Function to initialize SPI +// +// Calling Sequence +// RPI_SPISetup(channel,spped) +// +// Parameters +// channel: channel number, 0 or 1 +// speed : SPI clock speed in Hz +// +// Description +// This function initialises a channel (The Pi has 2 channels; 0 and 1). The speed parameter is an integer in the range 500,000 through 32,000,000 and represents the SPI clock speed in Hz. +// +//The returned value is the Linux file-descriptor for the device, or -1 on error. +// +// Examples +// RPI_SPISetup(1,500000) +// See also +// RPI_SPIDataRW, RPI_SPISetupMode, RPI_SPIGetFd +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="SPS#2#"+string(channel)+"#"+string(speed)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetupMode.sci b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetupMode.sci new file mode 100755 index 00000000..fec785ab --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetupMode.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_SPISetupMode(channel,speed,Mode) +// Function to initialize SPI +// +// Calling Sequence +// RPI_SPISetupMode(channel,spped,Mode) +// +// Parameters +// channel: channel number, 0 or 1 +// speed : SPI clock speed in Hz +// Mode : integer, mode to set +// +// Description +// +// Examples +// RPI_SPISetupMode(1,500000,2) +// See also +// RPI_SPIDataRW, RPI_SPISetup, RPI_SPIGetFd +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="SPM#23#"+string(channel)+"#"+string(speed)+"#"+string(Mode)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/SPI/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/SPI/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/SPI/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/SPI/names b/2.3-1/macros/Hardware/RasberryPi/SPI/names new file mode 100755 index 00000000..6f458a7e --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/SPI/names @@ -0,0 +1,4 @@ +RPI_SPIDataRW +RPI_SPIGetFd +RPI_SPISetup +RPI_SPISetupMode diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialClose.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialClose.sci new file mode 100755 index 00000000..6f54b655 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialClose.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_serialClose(fd) +// Function to close and open serial device +// +// Calling Sequence +// RPI_serialClose(fd) +// +// Parameters +// fd: file-descriptor obtained from RPI_serialOpen function +// +// Description +// This function closes the device identified by the file descriptor given. +// +// Examples +// RPI_serialClose(13) +// See also +// RPI_serialOpen, RPI_serialFlush, RPI_serialPutchar, RPI_serialPuts, RPI_serialPrintf, RPI_serialDataAvail, RPI_serialGetchar +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sCl#1#"+string(fd)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialDataAvail.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialDataAvail.sci new file mode 100755 index 00000000..9421e5b4 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialDataAvail.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_serialDataAvail(fd) +// Function to get number of readable character from the serial device +// +// Calling Sequence +// RPI_serialDataAvail(fd) +// +// Parameters +// fd: file-descriptor obtained from RPI_serialOpen function +// +// Description +// Returns the number of characters available for reading, or -1 for any error condition, in which case error number will be set appropriately. +// +// Examples +// RPI_serialDataAvail(13) +// See also +// RPI_serialOpen, RPI_serialClose, RPI_serialFlush, RPI_serialPutchar, RPI_serialPuts, RPI_serialPrintf, RPI_serialGetchar +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sDA#1#"+string(fd)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialFlush.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialFlush.sci new file mode 100755 index 00000000..845f70b3 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialFlush.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_serialFlush(fd) +// Function to discard all data to/from the serial device +// +// Calling Sequence +// RPI_serialFlush(fd) +// +// Parameters +// fd: file-descriptor obtained from RPI_serialOpen function +// +// Description +// This function discards all data received, or waiting to be send down the given device. +// +// Examples +// RPI_serialFlush(13) +// See also +// RPI_serialOpen, RPI_serialClose, RPI_serialPutchar, RPI_serialPuts, RPI_serialPrintf, RPI_serialDataAvail, RPI_serialGetchar +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sFl#1#"+string(fd)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialGetchar.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialGetchar.sci new file mode 100755 index 00000000..327fe356 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialGetchar.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_serialGetchar(fd) +// Function to get next character from serial device +// +// Calling Sequence +// RPI_serialGetchar(fd) +// +// Parameters +// fd: file-descriptor obtained from RPI_serialOpen function +// +// Description +// This function returns the next character available on the serial device. This call will block for up to 10 seconds if no data is available (when it will return -1). +// +// Examples +// RPI_serialGetchar(13) +// See also +// RPI_serialOpen, RPI_serialClose, RPI_serialFlush, RPI_serialPutchar, RPI_serialPuts, RPI_serialPrintf, RPI_serialDataAvail +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sGc#1#"+string(fd)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialOpen.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialOpen.sci new file mode 100755 index 00000000..684a6f20 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialOpen.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_serialOpen(device,baud) +// Function to initialize a serial device +// +// Calling Sequence +// RPI_serialOpen(device,baud) +// +// Parameters +// device: device to connect to +// baud : the baud rate for communication +// +// Description +// This function opens and initialises the serial device and sets the baud rate. It sets the port into “raw” mode (character at a time and no translations), and sets the read timeout to 10 seconds. The return value is the file descriptor or -1 for any error, in which case errno will be set as appropriate. +// +// Examples +// RPI_serialOpen("/dev/ttyAMA0", 9600) +// See also +// RPI_serialClose, RPI_serialFlush, RPI_serialPutchar, RPI_serialPuts, RPI_serialPrintf, RPI_serialDataAvail, RPI_serialGetchar +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sOp#2#"+string(device)+"#"+string(baud)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPrintf.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPrintf.sci new file mode 100755 index 00000000..668a9fff --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPrintf.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_serialPrintf(fd,msg) +// Function to print to serial device +// +// Calling Sequence +// RPI_serialPrintf(fd,msg) +// +// Parameters +// fd : file-descriptor obtained from RPI_serialOpen function +// msg: message to print +// +// Description +// This function emulates the system printf function to the serial device. +// +// Examples +// RPI_serialPrintf(13,'White Collar rocks') +// See also +// RPI_serialOpen, RPI_serialClose, RPI_serialFlush, RPI_serialPutchar, RPI_serialPuts, RPI_serialDataAvail, RPI_serialGetchar +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sPf#2#"+string(fd)+"#"+string(msg)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPutchar.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPutchar.sci new file mode 100755 index 00000000..ceea556c --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPutchar.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_serialPutchar(fd,character) +// Function to send a single byte to the serial device +// +// Calling Sequence +// RPI_serialPutchar(fd,character) +// +// Parameters +// fd : file-descriptor obtained from RPI_serialOpen function +// character: character to send to the serial device +// +// Description +// This function sends the single byte to the serial device identified by the given file descriptor. +// +// Examples +// RPI_serialPutchar(113,'s') +// See also +// RPI_serialOpen, RPI_serialClose, RPI_serialFlush, RPI_serialPuts, RPI_serialPrintf, RPI_serialDataAvail, RPI_serialGetchar +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sPc#2#"+string(fd)+"#"+string(character)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPuts.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPuts.sci new file mode 100755 index 00000000..ecbbe057 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPuts.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_serialPuts(fd,s) +// Function to send a null-terminalted string +// +// Calling Sequence +// RPI_serialPuts(fd,s) +// +// Parameters +// fd: file-descriptor obtained from RPI_serialOpen function +// s : string to send +// +// Description +// Sends the nul-terminated string to the serial device identified by the given file descriptor. +// +// Examples +// RPI_serialPuts(13,'Believe it, Dattebayo!\0') +// See also +// RPI_serialOpen, RPI_serialClose, RPI_serialFlush, RPI_serialPutchar, RPI_serialPrintf, RPI_serialDataAvail, RPI_serialGetchar +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sPs#2#"+string(fd)+"#"+string(s)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Serial/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/names b/2.3-1/macros/Hardware/RasberryPi/Serial/names new file mode 100755 index 00000000..a652727e --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/names @@ -0,0 +1,8 @@ +RPI_serialClose +RPI_serialDataAvail +RPI_serialFlush +RPI_serialGetchar +RPI_serialOpen +RPI_serialPrintf +RPI_serialPutchar +RPI_serialPuts diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_getAlt.sci b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_getAlt.sci new file mode 100755 index 00000000..ba3d204f --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_getAlt.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_getAlt(pin) +// Function to get the current mode of pin +// +// Calling Sequence +// s=RPI_getAlt(pin) +// +// Parameters +// pin: The pin number to read the voltage from. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// +// Description +// This function returns the current mode of the pin. Output will be 0 for INPUT, 1 for OUTPUT, 2 for PWM_OUT and 3 for CLOCK. +// +// Examples +// s=RPI_getAlt(0) +// See also +// RPI_pinNumbering, RPI_pinModeAlt +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="gAt#1#"+string(pin)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinMode.sci b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinMode.sci new file mode 100755 index 00000000..b6f52e61 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinMode.sci @@ -0,0 +1,60 @@ +// Copyright (C) 2017 - 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 RPI_pinMode(pin,Mode) +// Function to set the mode of the given pin. +// +// Calling Sequence +// RPI_pinMode(pin,Mode) +// +// Parameters +// pin : The pin number to act on. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// Mode: The mode in which to set the pin. +// +// Description +// This function configures the Raspberry Pi's given pin to work as the given mode (input/output/pwm/clock). Not all functions are available to all the pins. +// +// Mode can take the following values- +// +// 'in' -> sets the pin as input +// 'out' -> sets the pin as output +// 'pwm' -> sets the pin to PWM output. Only wiringPi pin 1 (BCM_GPIO pin 18) supports this function. +// 'clock' -> sets the pin to CLOCK output. Only wiringPi pin 7 (BCM_GPIO pin 4) supports this function. +// +// +// Examples +// RPI_pinMode(0,'out') +// See also +// RPI_pinNumbering +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + if Mode=='in' then + commande="pnM#2#"+string(pin)+"#0#"; + elseif Mode=='out' then + commande="pnM#2#"+string(pin)+"#1#"; + elseif Mode=='pwm' then + commande="pnM#2#"+string(pin)+"#2#"; + elseif Mode=='clock' then + commande="pnM#2#"+string(pin)+"#3#"; + else + error("Mode should be one of ""in/out/pwm/clock/soft_pwm/soft_tone/pwm_tone""."); + end + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinModeAlt.sci b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinModeAlt.sci new file mode 100755 index 00000000..dd0fa101 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinModeAlt.sci @@ -0,0 +1,55 @@ +// Copyright (C) 2017 - 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 RPI_pinModeAlt(pin,ALTMode) +// Function to set the current mode of pin +// +// Calling Sequence +// RPI_pinModeAlt(pin,ALTMode) +// +// Parameters +// pin : The pin number to read the voltage from. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// ALTMode: integer, from 0 to 7 +// +// Description +// This function sets the mode of the pin to either of the general GPIO (also set through RPI_pinMode function) or the alternatives available (not accessible through RPI_pinMode function). +// +// ALTMode can take the following values: +// +// 0 : Input +// 1 : Output +// 2 : ALT5 +// 3 : ALT4 +// 4 : ALT0 +// 5 : ALT1 +// 6 : ALT2 +// 7 : ALT3 +// +// +//The list of Alternate functions of all the pins can be found on page 102 of the official documentation: https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf +// +// Examples +// RPI_pinModeAlt(1,2) +// See also +// RPI_pinMode, RPI_pinNumbering, RPI_getAlt +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pMA#2#"+string(pin)+"#"+string(ALTMode)+"#"; + if getos()=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinNumbering.sci b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinNumbering.sci new file mode 100755 index 00000000..4716de80 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinNumbering.sci @@ -0,0 +1,54 @@ +// Copyright (C) 2017 - 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 out=RPI_pinNumbering(pinSetup) +// Function to initialize wiringpi with the number sequence to be followed. +// +// Calling Sequence +// RPI_pinNumbering(pinSetup) +// +// Parameters +// pinSetup: The pin number sequence to follow +// +// Description +// This function must be called at the start of the program or the program will fail to work correctly. It tells the wiringpi which number sequence will be used to work on Raspberry Pi. Returns 0 if no errors encountered. Pin maps for the different pinSetups can be found at the link in bibliography. +// +// pinSetup can take the following values: +// +// 'wiringpi' -> This initialises wiringPi and assumes that the calling program is going to be using the wiringPi pin numbering scheme. This is a simplified numbering scheme which provides a mapping from virtual pin numbers to the real underlying Broadcom GPIO pin numbers. +// 'GPIO' -> Same as above, however it allows the calling programs to use the Broadcom GPIO pin numbers directly with no re-mapping. +// 'phys' -> Identical to above, however it allows the calling programs to use the physical pin numbers on the P1 connector only. +// +// +// Examples +// RPI_pinNumbering('wiringpi') +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + if (pinSetup=='wiringpi') then + commande="pN0#0#"; + elseif (pinSetup=='GPIO') then + commande="pN1#0#"; + elseif (pinSetup=='sys') then + commande="pN2#0#"; + elseif (pinSetup=='phys') then + commande="pN3#0#"; + else + error("pinSetup should be one of wiringpi/GPIO/sys/phys"); + end + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pullControl.sci b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pullControl.sci new file mode 100755 index 00000000..6354bf55 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pullControl.sci @@ -0,0 +1,60 @@ +// Copyright (C) 2017 - 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 RPI_pullControl(pin,RMode) +// Function to change the internal pull up/down resistor setting for a given pin. +// +// Calling Sequence +// RPI_pullControl(pin,RMode) +// +// Parameters +// pin : The pin number to act on. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// RMode: The mode for the internal resistance of the given pin. +// +// Description +// This sets the pull-up or pull-down resistor mode on the given pin, which should be set as an input using the PRI_pinMode function. The internal pull up/down +// resistors have a value of approximately 50KΩ on the Raspberry Pi. +// +// RMode can take values: +// +// 'up' -> pull to 3.3v +// 'down'-> pull to ground +// 'none'-> no pull up/down +// +// +// This function has no effect on the Raspberry Pi’s GPIO pins when in sys mode, set using RPI_pinNumbering function. To activate a pull-up/pull-down, use the gpio +// program in a script before starting the program. +// +// Examples +// RPI_pullControl(0,'down') +// See also +// RPI_pinNumbering, RPI_pinMode +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + if RMode=='up' then + commande="plC#2#"+string(pin)+"#2#"; + elseif RMode=='down' then + commande="plC#2#"+string(pin)+"#1#"; + elseif RMode=='none' then + commande="plC#2#"+string(pin)+"#0#"; + else + error("mode should be one of up/down/none"); + end + if getos()=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Setup/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Setup/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/names b/2.3-1/macros/Hardware/RasberryPi/Setup/names new file mode 100755 index 00000000..38954982 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Setup/names @@ -0,0 +1,5 @@ +RPI_getAlt +RPI_pinMode +RPI_pinModeAlt +RPI_pinNumbering +RPI_pullControl diff --git a/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftIn.sci b/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftIn.sci new file mode 100755 index 00000000..2bdb89b8 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftIn.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_shiftIn(dpin,cpin,order) +// Function to shift 8-bit value appearing on dpin +// +// Calling Sequence +// RPI_shiftIn(dpin,cpin,order) +// +// Parameters +// dpin : datapin +// cpin : clockpin +// order: integer, 0 (LSB first) or 1 (MSB first) +// +// Description +// This shifts an 8-bit data value in with the data appearing on the dPin and the clock being sent out on the cPin. Order is either LSBFIRST or MSBFIRST. The data is sampled after the cPin goes high. (So cPin high, sample data, cPin low, repeat for 8 bits) The 8-bit value is returned by the function. +// +// Examples +// RPI_shiftIn(0,2,0) +// See also +// RPI_shiftOut +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="shI#3#"+string(dpin)+"#"+string(cpin)+"#"+string(order)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftOut.sci b/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftOut.sci new file mode 100755 index 00000000..c3485609 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftOut.sci @@ -0,0 +1,43 @@ +// Copyright (C) 2017 - 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 RPI_shiftOut(dpin,cpin,order,val) +// Function to shift out 8-bit data with value=val +// +// Calling Sequence +// RPI_shiftOut(dpin,cpin,order,val) +// +// Parameters +// dpin : datapin +// cpin : clockpin +// order: integer, 0 (LSB first) or 1 (MSB first) +// val : integer, data to send +// +// Description +// The shifts an 8-bit data value val out with the data being sent out on dPin and the clock being sent out on the cPin. order is as above. Data is clocked out on the rising or falling edge – ie. dPin is set, then cPin is taken high then low – repeated for the 8 bits. +// +// Examples +// RPI_shiftOut(1,2,0,123) +// See also +// RPI_shiftIn +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="shO#4#"+string(dpin)+"#"+string(cpin)+"#"+string(order)+"#"+string(val)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_sr595Setup.sci b/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_sr595Setup.sci new file mode 100755 index 00000000..fb77f988 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_sr595Setup.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - 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 RPI_sr595Setup(pinBase,numPins,dataPin,clockPin,latchPin) +// Function to setup sr5595 shift register chips +// +// Calling Sequence +// RPI_sr595Setup(pinBase,numPins,dataPin,clockPin,latchPin) +// +// Parameters +// pinBase : any number above 64. Consecutive number of numPins will be allocated alongwith. +// numPins : number of pins, can be 0-32, 8 pins per 74x595 +// dataPin : The Raspberry pin corresponding to the 74x595's data pin. Numbering sequence to be followed as initiated by RPI_pinNumbering function. +// clockPin: The Raspberry pin corresponding to the 74x595's clock pin. Numbering sequence to be followed as initiated by RPI_pinNumbering function. +// latchPin: The Raspberry pin corresponding to the 74x595's latch pin. Numbering sequence to be followed as initiated by RPI_pinNumbering function. +// +// Description +// This function sets up the extension module for the 74×595 shift register chips which can be used as general purpose output ports. Each instance can support up to 4 74×595’s daisy-chained together, giving a 32-bit output port using just 3 GPIO wires from the Raspberry Pi (or from any other GPIO expansion port connected to the Pi) One can have as many instances of these enabled in the system, provided there are 3 spare GPIO pins per instance. +// +// Examples +// RPI_sr595Setup(100,10,0,1,2) +// See also +// RPI_sn3218Setup, RPI_pcf8574Setup, RPI_pcf8591Setup, RPI_mcp23008Setup, RPI_mcp23016Setup, RPI_mcp23017Setup, RPI_mcp23s08Setup, RPI_mcp23s17Setup, RPI_pinNumbering +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sr5#5#"+string(pinBase)+"#"+string(numPins)+"#"+string(dataPin)+"#"+string(clockPin)+"#"+string(latchPin)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Shift/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Shift/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Shift/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Shift/names b/2.3-1/macros/Hardware/RasberryPi/Shift/names new file mode 100755 index 00000000..3fc17b6b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Shift/names @@ -0,0 +1,3 @@ +RPI_shiftIn +RPI_shiftOut +RPI_sr595Setup diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmCreate.sci b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmCreate.sci new file mode 100755 index 00000000..b0161c25 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmCreate.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - 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 out=RPI_softPwmCreate(pin,ival,pwmrange) +// Function to set up software pwm on a given pin +// +// Calling Sequence +// RPI_softPwmCreate(pin,ival,pwmrange) +// +// Parameters +// pin : pin to start software pwm on. Numbering sequence to follow as initiated using RPI_pinNumbering function +// ival : inital value +// pwmrange: range for the pwm +// +// Description +// This function creates a software controlled PWM pin. Any GPIO pin can be used. Using 100 for the range, the value can be anything from 0 (off) to 100 (fully on) for the given pin. +// +//The return value is 0 for success. Otherwise the global error number variable should be checked to see what went wrong. +// +// Examples +// RPI_softPwmCreate(1,25,250) +// See also +// RPI_softPwmStop, RPI_softPwmWrite, RPI_softToneCreate, RPI_softToneStop, RPI_softToneWrite, RPI_pinNumbering, RPI_softServoWrite, RIP_softServoSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sPC#3#"+string(pin)+"#"+string(ival)+"#"+string(pwmrange)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmStop.sci b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmStop.sci new file mode 100755 index 00000000..5a911c8b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmStop.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_softPwmStop(pin) +// Function to stop the software pwm on the pin +// +// Calling Sequence +// RPI_softPwmStop(pin) +// +// Parameters +// pin: pin to stop. Numbering sequence to follow as initiated using RPI_pinNumbering +// +// Description +// This function stops the software pwm on the specified pin. +// +// Examples +// RPI_softPwmStop(1) +// See also +// RPI_softPwmWrite, RPI_softToneCreate, RPI_softToneStop, RPI_softToneWrite, RPI_softPwmCreate, RPI_pinNumbering, RPI_softServoWrite, RIP_softServoSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sPS#1#"+string(pin)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmWrite.sci b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmWrite.sci new file mode 100755 index 00000000..349923fa --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmWrite.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_softPwmWrite(pin,value) +// Function to update the softpwm value on the pin +// +// Calling Sequence +// RPI_softPwmWrite(pin,value) +// +// Parameters +// pin : pin to act on, should be initialised using RPI_softPwmCreate. Numbering sequence follows from_RPI pinNumbering +// value: value to write +// +// Description +// This updates the PWM value on the given pin. The value is checked to be in-range and pins that haven’t previously been initialised via softPwmCreate will be silently ignored. +// +// Examples +// RPI_softPwmWrite(1,250) +// See also +// RPI_softPwmStop, RPI_softToneCreate, RPI_softToneStop, RPI_softToneWrite, RPI_softPwmCreate, RPI_pinNumbering, RPI_softServoWrite, RIP_softServoSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sPW#2#"+string(pin)+"#"+string(value)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneCreate.sci b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneCreate.sci new file mode 100755 index 00000000..06adf83e --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneCreate.sci @@ -0,0 +1,43 @@ +// Copyright (C) 2017 - 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 RPI_softToneCreate(pin) +// Function to create a software controlled tone pin +// +// Calling Sequence +// RPI_softToneCreate(pin) +// +// Parameters +// pin: pin to create software tone on. Numbering sequence to be followed as initiated using RPI_pinNumbering +// +// Description +// This function creates a software controlled tone pin. Any GPIO pin can be used. Using 100 for the range, the value can be anything from 0 (off) to 100 (fully on) for the given pin. +// +//The return value is 0 for success. Otherwise the global error number variable should be checked to see what went wrong. +// +// +// Examples +// RPI_softToneCreate(1) +// See also +// RPI_softPwmStop, RPI_softPwmWrite, RPI_softToneStop, RPI_softToneWrite, RPI_softPwmCreate, RPI_pinNumbering, RPI_softServoWrite, RIP_softServoSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sTC#1#"+string(pin)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneStop.sci b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneStop.sci new file mode 100755 index 00000000..4ecc4208 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneStop.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_softToneStop(pin) +// Function to stop the software tone on the pin +// +// Calling Sequence +// RPI_softToneStop(pin) +// +// Parameters +// pin: soft tone pin to stop. Numbering sequence to follow as initiated using RPI_pinNumbering +// +// Description +// This function stops the software tone on the specified pin. +// +// Examples +// RPI_softToneStop(1) +// See also +// RPI_softPwmStop, RPI_softPwmWrite, RPI_softToneCreate, RPI_softToneWrite, RPI_softPwmCreate, RPI_pinNumbering, RPI_softServoWrite, RIP_softServoSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sTS#1#"+string(pin)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneWrite.sci b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneWrite.sci new file mode 100755 index 00000000..ba070a82 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneWrite.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_softToneWrite(pin,freq) +// Function to update tone frquency on the soft tone pin +// +// Calling Sequence +// RPI_softToneWrite(pin,freq) +// +// Parameters +// pin : soft tone pin +// freq: frequency value to write +// +// Description +// This function updates the tone frequency value on the given pin. The tone will be played until you set the frequency to 0. +// +// Examples +// RPI_softToneWrite(1,200) +// See also +// RPI_softPwmStop, RPI_softPwmWrite, RPI_softToneCreate, RPI_softToneStop, RPI_softPwmCreate, RPI_softServoWrite, RIP_softServoSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sTW#2#"+string(pin)+"#"+string(freq)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Soft/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/names b/2.3-1/macros/Hardware/RasberryPi/Soft/names new file mode 100755 index 00000000..da06cbb5 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/names @@ -0,0 +1,6 @@ +RPI_softPwmCreate +RPI_softPwmStop +RPI_softPwmWrite +RPI_softToneCreate +RPI_softToneStop +RPI_softToneWrite diff --git a/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delay.sci b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delay.sci new file mode 100755 index 00000000..bd868e80 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delay.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_delay(time) +// Function to introduce delay in milliseconds +// +// Calling Sequence +// RPI_delay(time) +// +// Parameters +// time: Time in milliseconds for which to pause the program execution. +// +// Description +// This causes program execution to pause for at least 'time' milliseconds. Due to the multi-tasking nature of Linux it could be longer. The maximum delay is an unsigned 32-bit integer or approximately 49 days. +// +// Examples +// RPI_delay(1000) +// See also +// RPI_delayMicro, RPI_micros, RPI_millis +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="deS#1#"+string(time)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delayMicro.sci b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delayMicro.sci new file mode 100755 index 00000000..a1b5d595 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delayMicro.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_delayMicro(time) +// Function to introduce delay in microseconds +// +// Calling Sequence +// RPI_delayMicros(time) +// +// Parameters +// time: Time in microseconds for which to pause the program execution. +// +// Description +// This causes program execution to pause for at least 'time' microseconds. Due to the multi-tasking nature of Linux it could be longer. The maximum delay is an unsigned 32-bit integer or approximately 71 minutes. +// +// Examples +// RPI_delayMicro(1000) +// See also +// RPI_delay, RPI_micros, RPI_millis +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="deU#1#"+string(time)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_micros.sci b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_micros.sci new file mode 100755 index 00000000..058a8278 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_micros.sci @@ -0,0 +1,37 @@ +// Copyright (C) 2017 - 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 out=RPI_micros() +// Function to display the number of microseconds since the call to RPI_pinNumbering function. +// +// Calling Sequence +// t=RPI_micros() +// +// Description +// This returns the time in milliseconds since the call to RPI_pinNumbering function. It returns an unsigned 32-bit integer which wraps after approximately 71 minutes. +// +// Examples +// t=RPI_micros() +// See also +// RPI_millis, RPI_delay, RPI_delayMicro +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="mic#0#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_millis.sci b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_millis.sci new file mode 100755 index 00000000..baecddc2 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_millis.sci @@ -0,0 +1,37 @@ +// Copyright (C) 2017 - 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 out=RPI_millis() +// Function to display the number of milliseconds since the call to RPI_pinNumbering function. +// +// Calling Sequence +// t=RPI_millis() +// +// Description +// This returns the time in microseconds since the call to RPI_pinNumbering function. It returns an unsigned 32-bit integer which wraps after 49 days. +// +// Examples +// t=RPI_millis() +// See also +// RPI_micros, RPI_delay, RPI_delayMicro +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="mil#0#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Timing/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Timing/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Timing/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Timing/names b/2.3-1/macros/Hardware/RasberryPi/Timing/names new file mode 100755 index 00000000..0b47b345 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Timing/names @@ -0,0 +1,4 @@ +RPI_delay +RPI_delayMicro +RPI_micros +RPI_millis diff --git a/2.3-1/macros/Hardware/RasberryPi/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/buildmacros.sce old mode 100644 new mode 100755 index 2954a424..07b564e3 --- a/2.3-1/macros/Hardware/RasberryPi/buildmacros.sce +++ b/2.3-1/macros/Hardware/RasberryPi/buildmacros.sce @@ -1,4 +1,49 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in -tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); +RPI_Directories = [ "Digital", ... + "gertBoard", ... + "I2C", ... + "Interrupt", ... + "lcd", ... + "lcd128x64", ... + "mcp", ... + "Misc", ... + "pcf", ... + "piGlow", ... + "pinMap", ... + "pwm", ... + "Serial", ... + "Setup", ... + "Shift", ... + "Soft", ... + "SPI", ... + "Timing"]; + +RPI_path_buildmacros = get_absolute_file_path("buildmacros.sce"); -clear tbx_build_macros; +for H=1:size(RPI_Directories,"*") + myfile = RPI_path_buildmacros + filesep() + RPI_Directories(H) + filesep() + "buildmacros.sce"; + if isfile(myfile) then + exec(myfile); + end +end + +clear RPI_path_buildmacros; + +function buildmacros() + macros_path = get_absolute_file_path("buildmacros.sce"); + tbx_build_macros(TOOLBOX_NAME, macros_path); + clear tbx_build_macros; +endfunction + +buildmacros(); +clear buildmacros; diff --git a/2.3-1/macros/Hardware/RasberryPi/cleanmacros.sce b/2.3-1/macros/Hardware/RasberryPi/cleanmacros.sce new file mode 100755 index 00000000..a6428b2a --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/cleanmacros.sce @@ -0,0 +1,20 @@ +// ==================================================================== +// This file is released under the 3-clause BSD license. See COPYING-BSD. +// ==================================================================== +function cleanmacros() + + libpath = get_absolute_file_path("cleanmacros.sce"); + + binfiles = ls(libpath+"/*.bin"); + for i = 1:size(binfiles,"*") + mdelete(binfiles(i)); + end + + mdelete(libpath+"/names"); + mdelete(libpath+"/lib"); +endfunction + +cleanmacros(); +clear cleanmacros; // remove cleanmacros on stack + +// ==================================================================== diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogRead.sci b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogRead.sci new file mode 100755 index 00000000..41bf877a --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogRead.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_analogRead(pin) +// Function to read the analog voltage at the given pin +// +// Calling Sequence +// v=RPI_analogRead(pin) +// +// Parameters +// pin: The pin number to read the voltage from. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// +// Description +// This function returns the value read on the supplied analog input pin. Additional analog modules need to be registered to enable this function for devices such as the Gertboard, quick2Wire analog board, etc. +// +// Examples +// v=RPI_analogRead(0) +// See also +// RPI_analogWrite, RPI_digitalRead, RPI_digitalWrite, RPI_pinNumbering, RPI_pinMode +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="anR#1#"+string(pin)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogWrite.sci b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogWrite.sci new file mode 100755 index 00000000..f7089f53 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogWrite.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_analogWrite(pin,Volt) +// Function to set analog voltage at given analog pin. +// +// Calling Sequence +// RPI_analogWrite(pin,Volt) +// +// Parameters +// pin : The pin number to set the voltage at. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// Volt: The analog voltage value to set at the pin. +// +// Description +// This writes the given value to the supplied analog pin. Additional analog modules need to be registered to enable this function for devices such as the Gertboard. +// +// Examples +// RPI_analogWrite(0,100) +// See also +// RPI_analogRead, RPI_digitalRead, RPI_digitalWrite, RPI_pinNumbering, RPI_pinMode +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="anW#2#"+string(pin)+"#"+string(Volt)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogRead.sci b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogRead.sci new file mode 100755 index 00000000..ce7e870e --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogRead.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 out=RPI_gertboardAnalogRead(pin) +// Function to read voltage from gertboard +// +// Calling Sequence +// RPI_gertboardAnalogRead(pin) +// +// Parameters +// pin:the pin to read the voltage from. Numbering follows the pinBase from RPI_gertboardSetup function. +// +// Description +// After initialinzing the pinBase using the RPI_gertboeardSetup function, reading channel pinBase + 0 reads the first analog input channel (pin DA0 on the Gertboard). Returns a value from 0 to 1023 representing the value on the supplied pin. +// +// Examples +// RPI_gertboardAnalogRead(101) +// See also +// RPI_gertboardAnalogSetup, RPI_gertboardAnalogWrite, RPI_gertboardSPISetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ +// http://pi4j.com/apidocs/com/pi4j/wiringpi/Gertboard.html + + commande="gAR#1#"+string(pin)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction + diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogSetup.sci b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogSetup.sci new file mode 100755 index 00000000..a8348110 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogSetup.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_gertboardAnalogSetup(pinBase) +// Function to setup the gertboard +// +// Calling Sequence +// RPI_getboardAnalogSetup(pinBase) +// +// Parameters +// pinBase:the base pin that the analog ports will appear as +// +// Description +// This function calls a setup routine that allocates 2 pins and overlays the analog to digital input pins with the digital to analog output pins. pinBase is the base pin that you want the analog ports to appear as. So reading channel pinBase + 0 reads the first analog input channel (pin DA0 on the Gertboard), and writing pinBase + 0 outputs to the first analog output channel. (Pin AD0) +// +// Examples +// RPI_getboardAnalogSetup(100) +// See also +// RPI_gertboardAnalogRead, RPI_gertboardAnalogWrite, RPI_gertboardSPISetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ +// http://pi4j.com/apidocs/com/pi4j/wiringpi/Gertboard.html + + commande="gAS#1#"+string(pinBase)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogWrite.sci b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogWrite.sci new file mode 100755 index 00000000..3f8f9dd6 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogWrite.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_gertboardAnalogWrite(pin,value) +// Function to write voltage value to pins on gertboard +// +// Calling Sequence +// RPI_gertboardAnalogWrite(pin,value) +// +// Parameters +// pin : the pin to read the voltage from. Numbering follows the pinBase from RPI_gertboardSetup function. +// value: voltage value to write +// +// Description +// After initialinzing the pinBase using the RPI_gertboeardSetup function, writing pinBase + 0 outputs to the first analog output channel. (Pin AD0). +// +// Examples +// RPI_gertboardAnalogWrite(100,100) +// See also +// RPI_gertboardAnalogSetup, RPI_gertboardAnalogRead, RPI_gertboardSPISetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ +// http://pi4j.com/apidocs/com/pi4j/wiringpi/Gertboard.html + + commande="gAW#2#"+string(pin)+"#"+string(value)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardSPISetup.sci b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardSPISetup.sci new file mode 100755 index 00000000..d4117b00 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardSPISetup.sci @@ -0,0 +1,39 @@ +// Copyright (C) 2017 - 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 RPI_gertboardSPISetup() +// Function to initialize SPI bus communication with gertboard +// +// Calling Sequence +// RPI_gertboardSPIsetup() +// +// Description +// This function must be called to initialize the SPI bus to communicate with the Gertboards ADC and DAC chips. +// +// Examples +// RPI_gertboardSPISetup() +// See also +// RPI_gertboardAnalogSetup, RPI_gertboardAnalogRead, RPI_gertboardAnalogWrite +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ +// http://pi4j.com/apidocs/com/pi4j/wiringpi/Gertboard.html + + commande="gSS#0#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction + diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/gertBoard/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/names b/2.3-1/macros/Hardware/RasberryPi/gertBoard/names new file mode 100755 index 00000000..27a469a1 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/names @@ -0,0 +1,6 @@ +RPI_analogRead +RPI_analogWrite +RPI_gertboardAnalogRead +RPI_gertboardAnalogSetup +RPI_gertboardAnalogWrite +RPI_gertboardSPISetup diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCharDef.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCharDef.sci new file mode 100755 index 00000000..905cca84 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCharDef.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - 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 RPI_lcdCharDef(fd,index,d0,d1,d2,d3,d4,d5,d6,d7) +// Function to redefine a user-definable character +// +// Calling Sequence +// RPI_lcdCharDef(fd,index,data) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// index: which character to redefine (0 to 7) +// d0-d7: integers from 0 to 255 erpresenting the elements of the array to form the character +// +// Description +// This function re-define one of the 8 user-definable characters in the display. +// +// The data array is 8 bytes which represent the character from the top-line to the bottom line. Note that the characters are actually 5×8, so only the lower 5 bits are used. +// +// Examples +// RPI_lcdCharDef(13,0,0,0,0,31,31,31,31,0) +// See also +// RPI_lcdCursorBlink, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lCD#10#"+string(fd)+"#"+string(index)+"#"+string(d0)+"#"+string(d1)+"#"+string(d2)+"#"+string(d3)+"#"+string(d4)+"#"+string(d5)+"#"+string(d6)+"#"+string(d7)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdClear.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdClear.sci new file mode 100755 index 00000000..6da7212d --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdClear.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_lcdClear(fd) +// Function to clear the lcd screen +// +// Calling Sequence +// RPI_lcdClear(fd) +// +// Parameters +// fd: file-descriptor obtained using RPI_lcdInit function +// +// Description +// This function clears the lcd screen. +// +// Examples +// RPI_lcdClear(13) +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lCl#1#"+string(fd)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursor.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursor.sci new file mode 100755 index 00000000..98c54712 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursor.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_lcdCursor(fd,state) +// Function to turn cursor on/off +// +// Calling Sequence +// RPI_lcdCursor(fd,state) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// state: 0 (for off) or 1 (for on) +// +// Description +// This function sets the visibility of cursor. +// +// Examples +// RPI_lcdCursor(13,1) +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lCu#2#"+string(fd)+"#"+string(state)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursorBlink.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursorBlink.sci new file mode 100755 index 00000000..b16ebc50 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursorBlink.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_lcdCursorBlink(fd,state) +// Function to turn cursor blinking on/off +// +// Calling Sequence +// RPI_lcdCursorBlink(fd,state) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// state: 0 (for off) or 1 (for on) +// +// Description +// This function sets the blinking of cursor. +// +// Examples +// RPI_lcdCursorBlink(13,1) +// See also +// RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lCB#2#"+string(fd)+"#"+string(state)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdDisplay.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdDisplay.sci new file mode 100755 index 00000000..de50af64 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdDisplay.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_lcdDisplay(fd,state) +// Function to turn display on/off +// +// Calling Sequence +// RPI_lcdDisplay(fd,state) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// state: 0 (for off) or 1 (for on) +// +// Description +// This function turns the display 'on' or 'off'. +// +// Examples +// RPI_lcdDisplay(13,1) +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lDs#2#"+string(fd)+"#"+string(state)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdHome.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdHome.sci new file mode 100755 index 00000000..0c4507f1 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdHome.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_lcdHome(fd) +// Function to send cursor back to the starting point (home) +// +// Calling Sequence +// RPI_lcdHome(fd) +// +// Parameters +// fd: file-descriptor obtained using RPI_lcdInit function +// +// Description +// This function sends the cursor to the top left (row=0,col=0) position on the lcd screen. +// +// Examples +// RPI_lcdHome(13) +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lHo#1#"+string(fd)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdInit.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdInit.sci new file mode 100755 index 00000000..c5ddb1e5 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdInit.sci @@ -0,0 +1,54 @@ +// Copyright (C) 2017 - 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 out=RPI_lcdInit(rows,cols,bits,rs,strb,d0,d1,d2,d3,d4,d5,d6,d7) +// Function to initialize lcd +// +// Calling Sequence +// RPI_lcdInit(rows,cols,bits,rs,strb,d0,d1,d2,d3,d4,d5,d6,d7) +// +// Parameters +// rows: numer of rows in lcd +// cols: numer of colums in lcd +// bits: number of bits wide on the interface (4 or 8) +// rs : pin number of display RS +// strb: pin number of strobe (E) +// d0 : pin number of data pin 1 +// d1 : pin number of data pin 2 +// d2 : pin number of data pin 3 +// d3 : pin number of data pin 4 +// d4 : pin number of data pin 5 +// d5 : pin number of data pin 6 +// d6 : pin number of data pin 7 +// d7 : pin number of data pin 8 +// +// Description +// This function initalizes an lcd display attaced to the Raspberry pi. The return value is the file-descriptor to be used for all subsequent calls to the lcd library when dealing with that LCD, or -1 to indicate a fault. (Usually incorrect parameters) +// +// The numberin sequence to be followed as initiated using RPI_pinNumbering +// +// Examples +// fd=RPI_lcdInit (2,16,8,11,10,0,1,2,3,4,5,6,7) ; +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand, RPI_pinNumbering +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lIn#13#"+string(rows)+"#"+string(cols)+"#"+string(bits)+"#"+string(rs)+"#"+string(strb)+"#"+string(d0)+"#"+string(d1)+"#"+string(d2)+"#"+string(d3)+"#"+string(d4)+"#"+string(d5)+"#"+string(d6)+"#"+string(d7)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPosition.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPosition.sci new file mode 100755 index 00000000..0f978324 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPosition.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_lcdPosition(fd,col,row) +// Function to move the cursor +// +// Calling Sequence +// RPI_lcdPosition(fd,col,row) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// col: column number to go to +// row: row number to go to +// +// Description +// This function set the position of the cursor for subsequent text entry. col=0 is the left-most edge any row=0 is the top line. +// +// Examples +// RPI_lcdPosition(13,0,1) +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lPo#3#"+string(fd)+"#"+string(col)+"#"+string(row)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPrintf.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPrintf.sci new file mode 100755 index 00000000..833bf44a --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPrintf.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_lcdPrintf(fd,String) +// Function to print on the lcd screen +// +// Calling Sequence +// RPI_lcdPrintf(fd,String) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// String: string to print on the screen +// +// Description +// This function outputs a single ASCII character, a string or a formatted string using the usual printf formatting commands. +// +// Examples +// RPI_lcdPrintf(13,'We live in the shadows to serve the light.') +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lPf#2#"+string(fd)+"#"+String+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPutchar.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPutchar.sci new file mode 100755 index 00000000..337691d8 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPutchar.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_lcdPutchar(fd,character) +// Function to print on the lcd screen +// +// Calling Sequence +// RPI_lcdPutchar(fd,charcter) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// charcter: integer, 0 to 255, character to print +// +// Description +// This function outputs a single ASCII character, a string or a formatted string using the usual printf formatting commands. +// +// Examples +// RPI_lcdPutchar(13,200) +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lPc#2#"+string(fd)+"#"+string(character)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPuts.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPuts.sci new file mode 100755 index 00000000..8584309d --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPuts.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_lcdPuts(fd,character) +// Function to print on the lcd screen +// +// Calling Sequence +// RPI_lcdPuts(fd,character) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// character: character to print +// +// Description +// This function outputs a single ASCII character, a string or a formatted string using the usual printf formatting commands. +// +// Examples +// RPI_lcdPuts(13,'K') +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lPu#2#"+string(fd)+"#"+string(character)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction + diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdSendCommand.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdSendCommand.sci new file mode 100755 index 00000000..db677bef --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdSendCommand.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_lcdSendCommand(fd,command) +// Function to send command to lcd +// +// Calling Sequence +// RPI_lcdSendCommand(fd,command) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// command: A command, binary, to submit to the LCD. +// +// Description +// This function sends any arbitrary command to the LCD. +// +// Examples +// RPI_lcdSendCommand(13,00) +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lSC#2#"+string(fd)+"#"+string(command)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/lcd/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/names b/2.3-1/macros/Hardware/RasberryPi/lcd/names new file mode 100755 index 00000000..8f87ff8b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/names @@ -0,0 +1,12 @@ +RPI_lcdCharDef +RPI_lcdClear +RPI_lcdCursor +RPI_lcdCursorBlink +RPI_lcdDisplay +RPI_lcdHome +RPI_lcdInit +RPI_lcdPosition +RPI_lcdPrintf +RPI_lcdPutchar +RPI_lcdPuts +RPI_lcdSendCommand diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64Orientation.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64Orientation.sci new file mode 100755 index 00000000..5bfe4dcd --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64Orientation.sci @@ -0,0 +1,48 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64Orientation(mode) +// Function to set lcd orientation. +// +// Calling Sequence +// RPI_lcd128x64Orientation(mode) +// +// Parameters +// mode: Orientation Mode, integer from 0 to 3 +// +// Description +// This function sets the orientation of the lcd display. +// +// mode can take values: +// +// 0 :Portrait +// 1 :Landscape +// 2 :Portrait, flipped +// 3 :Landscape, flipped +// +// +// Examples +// RPI_lcd128x64Orientation(1) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="LOn#1#"+string(mode)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64circle.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64circle.sci new file mode 100755 index 00000000..96358a32 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64circle.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64circle(x,y,r,color,fill) +// Function to draw a circle +// +// Calling Sequence +// RPI_lcd128x64circle(x,y,r,color,fill) +// +// Parameters +// x : integer, x coordinate of centre +// y : integer, y coordinate of centre +// r : integer, radius of the circle +// color: integer, color of the rectangle +// fill : 0 (for empty) or 1 (for filled) +// +// Description +// This function draws a circle of radius r with x,y as centre, specified color and fill. +// +// Examples +// RPI_lcd128x64circle(3,3,2,0,0) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Lci#5#"+string(x)+"#"+string(y)+"#"+string(r)+"#"+string(color)+"#"+string(fill)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64clear.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64clear.sci new file mode 100755 index 00000000..5b800491 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64clear.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64clear(color) +// Function to clear the lcd screen +// +// Calling Sequence +// RPI_lcd128x64clear(color) +// +// Parameters +// color: integer, color of the lcd +// +// Description +// This function clears the lcd display to the given colour. +// +// Examples +// RPI_lcd128x64clear(0) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="LCl#1#"+string(color)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64ellipse.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64ellipse.sci new file mode 100755 index 00000000..b4281e61 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64ellipse.sci @@ -0,0 +1,45 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64ellipse(cx,cy,xr,yr,color,fill) +// Function to draw a ellipse +// +// Calling Sequence +// RPI_lcd128x64ellipse(cx,cy,xr,yr,color,fill) +// +// Parameters +// cx : integer, x coordinate of centre +// cy : integer, y coordinate of centre +// xr : integer, x radius +// yr : integer, y radius +// color: integer, color pf the ellipse +// fill : 0 (for empty) or 1 (for filled) +// +// Description +// This function draws an ellipse with centre at (cx,cy) x and y radii as xr and yr, specified color and fill +// +// Examples +// RPI_lcd128x64ellipse() +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Lel#6#"+string(cx)+"#"+string(cy)+"#"+string(xr)+"#"+string(yr)+"#"+string(color)+"#"+string(fill)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64line.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64line.sci new file mode 100755 index 00000000..951a6639 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64line.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64line(x0,y0,x1,y1,color) +// Function to plota line. +// +// Calling Sequence +// RPI_lcd128x64line(x0,y0,x1,y1,color) +// +// Parameters +// x0 : integer, initial x coordinate +// y0 : integer, initial y coordinate +// x1 : integer, final x coordinate +// y1 : integer, final y coordinate +// color: integer, color of the line +// +// Description +// This function plots a line from (x0,y0) to (x1,y1). +// +// Examples +// RPI_lcd128x64line(0,0,1,1,0) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Lli#5#"+string(x0)+"#"+string(y0)+"#"+string(x1)+"#"+string(y1)+"#"+string(color)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64lineTo.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64lineTo.sci new file mode 100755 index 00000000..466713eb --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64lineTo.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64lineTo(x,y,color) +// Function to plot a line +// +// Calling Sequence +// RPI_lcd128x64lineTo(x,y,color) +// +// Parameters +// x : integer, final x coordinate +// y : integer, final y coordinate +// color: integer, color of the line +// +// Description +// This function draws a line from the current position to the point (x,y) specified. +// +// Examples +// RPI_lcd128x64lineTo(2,2,0) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="LlT#3#"+string(x)+"#"+string(y)+"#"+string(color)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64point.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64point.sci new file mode 100755 index 00000000..287b022a --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64point.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64point(x,y,color) +// Function to plot a point +// +// Calling Sequence +// RPI_lcd128x64point(x,y,color) +// +// Parameters +// x : integer, x coordinate +// y : integer, y coordinate +// color: integer, color of the point +// +// Description +// This function plots a point at x,y. +// +// Examples +// RPI_lcd128x64point(2,2,0) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Lpo#3#"+string(x)+"#"+string(y)+"#"+string(color)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64putchar.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64putchar.sci new file mode 100755 index 00000000..a6b27240 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64putchar.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64putchar(x,y,c,bg,fg) +// Function to print a single character. +// +// Calling Sequence +// RPI_lcd128x64putchar(x,y,c,bg,fg) +// +// Parameters +// x : integer, x coordinate of starting point +// y : integer, y coordinate of starting point +// c : integer, from 0 to 255, character to print +// bg: integer, background color +// fg: integer, foreground color +// +// Description +// This function prints a single character to the screen. +// +// Examples +// RPI_lcd128x64putchar(0,1,128,1,0) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Lpc#5#"+string(x)+"#"+string(y)+"#"+string(c)+"#"+string(bg)+"#"+string(fg)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64puts.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64puts.sci new file mode 100755 index 00000000..6785f067 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64puts.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64puts(x,y,s,bf,fg) +// Function to send a string to the lcd display +// +// Calling Sequence +// RPI_lcd128x64puts(x,y,s,bg,fg) +// +// Parameters +// x : integer, x coordinate of starting point +// y : integer, y coordinate of starting point +// s : string to send +// bg: integer, background color +// fg: integer, foreground color +// +// Description +// This function sends a string to the display. Obeys \n and \r formatting. +// +// Examples +// RPI_lcd128x64puts(0,0,'Talos guide you',0,1) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="LPu#5#"+string(x)+"#"+string(y)+"#"+string(s)+"#"+string(bg)+"#"+string(fg)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64rectangle.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64rectangle.sci new file mode 100755 index 00000000..ccda4c62 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64rectangle.sci @@ -0,0 +1,45 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64rectangle(x1,y1,x2,y2,color,fill) +// Function to draw a rectangle +// +// Calling Sequence +// RPI_lcd128x64rectangle(x1,y1,x2,y2,color,fill) +// +// Parameters +// x1 : integer, x coordinate of upper left corner +// y1 : integer, y coordinate of upper left corner +// x2 : integer, x coordinate of lower right corner +// y2 : integer, y coordinate of lower right corner +// color: integer, color of the rectangle +// fill : 0 (for empty) or 1 (for filled) +// +// Description +// This function draws a rectangle with (x1,y1) as the upper left point and (x2,y2) as the lower right point with specified color and fill. +// +// Examples +// RPI_lcd128x64rectangle(0,0,1,1,0,1) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Lre#6#"+string(x1)+"#"+string(y1)+"#"+string(x2)+"#"+string(y2)+"#"+string(color)+"#"+string(fill)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setOrigin.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setOrigin.sci new file mode 100755 index 00000000..996b0623 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setOrigin.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64setOrigin(x,y) +// Function to set origin +// +// Calling Sequence +// RPI_lcd128x64setOrigin(x,y) +// +// Parameters +// x: x coordinate +// y: y coordinate +// +// Description +// This function sets the origin of the lcd display +// +// Examples +// RPI_lcd128x64setOrigin(1,0) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="LOr#2#"+string(x)+"#"+string(y)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setup.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setup.sci new file mode 100755 index 00000000..60ded7d8 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setup.sci @@ -0,0 +1,37 @@ +// Copyright (C) 2017 - 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 out=RPI_lcd128x64setup() +// Function to initialize the lcd display +// +// Calling Sequence +// RPI_lcd128x64setup() +// +// Description +// This function initialises the lcd display. +// +// Examples +// RPI_lcd128x64setup() +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Lse#0#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/names b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/names new file mode 100755 index 00000000..82439718 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/names @@ -0,0 +1,12 @@ +RPI_lcd128x64Orientation +RPI_lcd128x64circle +RPI_lcd128x64clear +RPI_lcd128x64ellipse +RPI_lcd128x64line +RPI_lcd128x64lineTo +RPI_lcd128x64point +RPI_lcd128x64putchar +RPI_lcd128x64puts +RPI_lcd128x64rectangle +RPI_lcd128x64setOrigin +RPI_lcd128x64setup diff --git a/2.3-1/macros/Hardware/RasberryPi/lib b/2.3-1/macros/Hardware/RasberryPi/lib deleted file mode 100644 index dc759fe8..00000000 Binary files a/2.3-1/macros/Hardware/RasberryPi/lib and /dev/null differ diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23008Setup.sci b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23008Setup.sci new file mode 100755 index 00000000..03963bd1 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23008Setup.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_mcp23008Setup(pinBase,i2cAddress) +// Function for setting up 8-bit MCP23008 I2C GPIO expansion chip. +// +// Calling Sequence +// RPI_mcp23008Setup(pinBase,i2cAddress) +// +// Parameters +// pinBase : any number above 64. The consecutive 8 pins will be allocated alongwith. +// i2cAdress: integer, the I2C address obtained using RPI_i2cdetect function +// +// Description +// This function sets up the extension module for the 8-bit MCP23008 I2C GPIO expansion chip. +// +// Examples +// RPI_mcp23008Setup(73,64) +// See also +// RPI_sr595Setup, RPI_pcf8574Setup, RPI_pcf8591Setup, RPI_mcp23016Setup, RPI_mcp23017Setup, RPI_mcp23s08Setup, RPI_mcp23s17Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="mp8#2#"+string(pinBase)+"#"+string(i2cAddress)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23016Setup.sci b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23016Setup.sci new file mode 100755 index 00000000..0424616e --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23016Setup.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_mcp23016Setup(pinBase,i2cAddress) +// Function for setting up 16-bit MCP23016 I2C GPIO expansion chip. +// +// Calling Sequence +// RPI_mcp23016Setup(pinBase,i2cAddress) +// +// Parameters +// pinBase : any number above 64. The consecutive 16 pins will be allocated alongwith. +// i2cAdress: integer, the I2C address obtained using RPI_i2cdetect function +// +// Description +// This function sets up the extension module for the MCP23017 (16-bit) I2C GPIO expansion chips. The MCP23016 is the fore-runner of the MCP23017 GPIO expansion chip and may be present on some older interface boards. +// +// Examples +// RPI_mcp23016Setup(73,100) +// See also +// RPI_sr595Setup, RPI_pcf8574Setup, RPI_pcf8591Setup, RPI_mcp23008Setup, RPI_mcp23017Setup, RPI_mcp23s08Setup, RPI_mcp23s17Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="mp6#2#"+string(pinBase)+"#"+string(i2cAddress)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23017Setup.sci b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23017Setup.sci new file mode 100755 index 00000000..c453ebb3 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23017Setup.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_mcp23017Setup(pinBase,i2cAddress) +// Function for setting up 16-bit MCP23017 I2C GPIO expansion chip. +// +// Calling Sequence +// RPI_mcp23017Setup(pinBase,i2cAddress) +// +// Parameters +// pinBase : any number above 64. The consecutive 16 pins will be allocated alongwith. +// i2cAdress: integer, the I2C address obtained using RPI_i2cdetect function +// +// Description +// This function setups the extension module for the 16-bit MCP23017 I2C GPIO expansion chip. +// +// Examples +// RPI_mcp23017Setup(73,100) +// See also +// RPI_sr595Setup, RPI_pcf8574Setup, RPI_pcf8591Setup, RPI_mcp23008Setup, RPI_mcp23016Setup, RPI_mcp23s08Setup, RPI_mcp23s17Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="mp7#2#"+string(pinBase)+"#"+string(i2cAddress)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s08Setup.sci b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s08Setup.sci new file mode 100755 index 00000000..b5b215b6 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s08Setup.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 out=RPI_mcp23s08Setup(pinBase,spiPort,devId) +// Function for setting up 8-bit MCP23s08 SPI GPIO expansion chip. +// +// Calling Sequence +// RPI_mcp23s08Setup(pinBase,spiPort,devId) +// +// Parameters +// pinBase: any number above 64. The consecutive 8 pins will be allocated alongwith. +// spiPort: 0 or 1 for one of the two SPI ports on the Raspberry Pi. +// devId : the ID of the MCP23s08 on the SPI port. +// +// Description +// This function setups the extension module for the 8-bit MCP23s08 SPI GPIO expansion chip. +// +// Examples +// RPI_mcp23s08Setup(67,1,0) +// See also +// RPI_sr595Setup, RPI_pcf8574Setup, RPI_pcf8591Setup, RPI_mcp23008Setup, RPI_mcp23016Setup, RPI_mcp23017Setup, RPI_mcp23s17Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="ms8#3#"+string(pinBase)+"#"+string(spiPort)+"#"+string(devId)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s17Setup.sci b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s17Setup.sci new file mode 100755 index 00000000..4ba9fd65 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s17Setup.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 out=RPI_mcp23s17Setup(pinBase,spiPort,devId) +// Function for setting up 16-bit MCP23s17 SPI GPIO expansion chip. +// +// Calling Sequence +// RPI_mcp23s17Setup(pinBase,spiPort,devId) +// +// Parameters +// pinBase: any number above 64. The consecutive 16 pins will be allocated alongwith. +// spiPort: 0 or 1 for one of the two SPI ports on the Raspberry Pi. +// devId : the ID of the MCP23s17 on the SPI port. +// +// Description +// This function setups the extension module for the 16-bit MCP23s17 SPI GPIO expansion chip. +// +// Examples +// RPI_mcp23s17Setup(67,0,0) +// See also +// RPI_sr595Setup, RPI_pcf8574Setup, RPI_pcf8591Setup, RPI_mcp23008Setup, RPI_mcp23016Setup, RPI_mcp23017Setup, RPI_mcp23s08Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="ms7#3#"+string(pinBase)+"#"+string(spiPort)+"#"+string(devId)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/mcp/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/mcp/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/names b/2.3-1/macros/Hardware/RasberryPi/mcp/names new file mode 100755 index 00000000..23e7af04 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/mcp/names @@ -0,0 +1,5 @@ +RPI_mcp23008Setup +RPI_mcp23016Setup +RPI_mcp23017Setup +RPI_mcp23s08Setup +RPI_mcp23s17Setup diff --git a/2.3-1/macros/Hardware/RasberryPi/names b/2.3-1/macros/Hardware/RasberryPi/names old mode 100644 new mode 100755 index fa647761..9f20c937 --- a/2.3-1/macros/Hardware/RasberryPi/names +++ b/2.3-1/macros/Hardware/RasberryPi/names @@ -1,21 +1,5 @@ GetRPISupportFunctions IsRPISupportFunction -RPI_DelayMicro -RPI_DelayMilli -RPI_DigitalIn -RPI_DigitalOut -RPI_DigitalSetup -RPI_GetMicros -RPI_GetMillis -RPI_HardPWMSetClock -RPI_HardPWMSetMode -RPI_HardPWMSetRange -RPI_HardPWMWrite -RPI_PinISR -RPI_SerialClose -RPI_SerialFlush -RPI_SerialGetChar -RPI_SerialSendChar -RPI_SerialSendData -RPI_SerialSetup -u16RPISerialDataAvail +RPI_adress +raspi +raspi_close diff --git a/2.3-1/macros/Hardware/RasberryPi/old/GetRPISupportFunctions.sci b/2.3-1/macros/Hardware/RasberryPi/old/GetRPISupportFunctions.sci new file mode 100644 index 00000000..3e6397b2 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/GetRPISupportFunctions.sci @@ -0,0 +1,48 @@ +function RPiSupportFunctions = GetRPISupportFunctions() +// ----------------------------------------------------------------- +// Get list of RPI peripherals supported +// +// Input data: +// None +// +// Output data: +// None +// Copyright (C) 2017 - 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 +// +// ----------------------------------------------------------------- + +RPiSupportFunctions = [ + "RPI_DigitalIn" + "RPI_DigitalOut" + "RPI_DigitalSetup" + "RPI_DelayMilli" + "RPI_DelayMicro" + "RPI_GetMillis" + "RPI_GetMicros" + "RPI_SerialSetup" + "RPI_SerialClose" + "RPI_SerialSendChar" + "RPI_SerialFlush" + "RPI_SerialGetChar" + "RPI_ThreadCreate" + "RPI_PinISR" + "RPI_HardPWMWrite" + "RPI_HardPWMSetRange" + "RPI_HardPWMSetClock" + "RPI_HardPWMSetMode" + ]; + +//Note: "RPI_SerialSendData" is removed since distinction between input data +//types is required + + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/IsRPISupportFunction.sci b/2.3-1/macros/Hardware/RasberryPi/old/IsRPISupportFunction.sci new file mode 100644 index 00000000..c6a2c365 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/IsRPISupportFunction.sci @@ -0,0 +1,32 @@ +function Output = IsRPISupportFunction(FunName) +// ----------------------------------------------------------------- +// Check whether input function name is a RPi support function or not. +// +// Input data: +// FunName: Name of the function to be checked +// +// Output data: +// Output: True or False depending whether given function is a RPi +// support functions or not +// +// Copyright (C) 2017 - 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 +// +// ----------------------------------------------------------------- + +//Get list of supported functions for AVR +RPISupportFunctions = GetRPISupportFunctions(); + +//Check whether input function is present in above list or not +FunNameInRPISupport = members(FunName,RPISupportFunctions); +Output = bool2s(FunNameInRPISupport~=0); + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMicro.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMicro.sci new file mode 100644 index 00000000..bbb0bb3b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMicro.sci @@ -0,0 +1,38 @@ +// 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 RPI_DelayMicro(time) +// Function to insert some delay in code execution. +// +// Calling Sequence +// RPI_DelayMicro(time) +// +// Parameters +// time: time(microseconds) for which execution is to be delayed +// +// Description +// this function can be used for insertig execution delays. 'time' should be +// specified in microseconds.'time' should be between (1-65536). +// Note: Delay inserted by this function is not accurate, but depedent on +// operating system, other running tasks etc. +// +// Examples +// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. +// +// See also +// RPI_DelayMicro +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMilli.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMilli.sci new file mode 100644 index 00000000..13b79625 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMilli.sci @@ -0,0 +1,39 @@ +// 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 RPI_DelayMilli(time) +// Function to insert some delay in milli seconds in code execution. +// +// Calling Sequence +// RPI_DelayMilli(time) +// +// Parameters +// time: time(milliseconds) for which execution is to be delayed +// +// Description +// This function can be used for insertig execution delays. 'time' should be +// specified in milliseconds. If more resolution is required, use 'RPI_DelayMicro' +// for inserting delay in microseconds. +// Note: Delay inserted by this function is not accurate, but depedent on +// operating system, other running tasks etc. +// +// Examples +// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. +// +// See also +// RPI_DelayMicro +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalIn.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalIn.sci new file mode 100644 index 00000000..781c49c8 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalIn.sci @@ -0,0 +1,43 @@ +// 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 state = RPI_DigitalIn(pin) +// Function to read current state on digital pins. +// +// Calling Sequence +// state = RPI_DigitalIn(pin) +// +// Parameters +// pin : pin of RPi to be used +// state : current state of the pin (0 -> LOW, 1 -> HIGH) +// +// Description +// This fucntion is used for reading the current state on gpio pins of RPi. 'RPI_DigitalSetup' function must be called before this for setting up pin as input. 'pin' must be specified from list given. 'state' specifies the input state (0 -> Low, 1-> High) +// Examples +// RPI_DigitalIn(RPI_GPIO_P1_03) //Reads the state of pin 3 of header P1. +// +// See also +// RPI_DigitalSetup RPI_DigitalOut +// +// +// 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,27,28,29,... + 31,31,33,35,36,37,38,40]; + +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 +state = 1; +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalOut.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalOut.sci new file mode 100644 index 00000000..dde3c934 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalOut.sci @@ -0,0 +1,44 @@ +// 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 RPI_DigitalOut(pin, state) +// Function to output desired state on digital pins. +// +// Calling Sequence +// RPI_DigitalOut(pin, state) +// +// Parameters +// pin : pin of RPi to be used +// state : desired state of the pin (0 -> LOW, 1 -> HIGH) +// +// Description +// This fucntion is used for outputting the desired state on gpio pins of RPi. 'RPI_DigitalSetup' function must be called before this for setting up pin as output. 'pin' must be specified from list given. 'state' specifies the output state (0 -> Low, 1-> High) +// Examples +// RPI_DigitalOut(RPI_GPIO_P1_03,0) //Changes the state of pin 3 of header P1 as 'Low'. +// +// See also +// RPI_DigitalSetup RPI_DigitalIn +// +// +// 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,27,28,29,... + 31,31,33,35,36,37,38,40]; + +PinIsGPIO = members(pin, supported_pins); //Check if output 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 +state = 1; + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalSetup.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalSetup.sci new file mode 100644 index 00000000..01d6e07d --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalSetup.sci @@ -0,0 +1,36 @@ +function RPI_DigitalSetup(pin, direction) +// Function to setup digital pins. +// +// Calling Sequence +// RPI_DigitalSetup(pin,direction) +// +// Parameters +// pin : pin of RPi to be used +// direction : direction to be set for pin +// 0 -> INPUT, 1 -> OUTPUT, 2->PWM 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(3,0) //Sets pin 3 of header P1 as input +// +// See also +// RPI_DigitalIn RPI_DigitalOut +// +// +// 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,27,28,29,... + 31,31,33,35,36,37,38,40]; + +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 +state = 1; + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMicros.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMicros.sci new file mode 100644 index 00000000..6c4db57a --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMicros.sci @@ -0,0 +1,39 @@ +// 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 Micros = RPI_GetMicros() +// Function to get time in Microsecond since first setup function called. +// +// Calling Sequence +// Micros = RPI_GetMicros() +// +// Parameters +// Micros: time in Microseconds since first setup function called +// +// Description +// This function can be used to get time since first setup function called. +// Note: To use this function atleast one setup function must be called. +// +// Examples +// start = RPI_GetMicros() +// RPI_DelayMicro(1000) //This will delay the execution of next code by 100 ms. +// end = RPI_GetMicros() +// delay = end- start //This should be approximately 1000 us. +// +// See also +// RPI_GetMillis RPI_DelayMilli RPI_DelayMicro +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +Micros = 0; +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMillis.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMillis.sci new file mode 100644 index 00000000..c034a705 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMillis.sci @@ -0,0 +1,39 @@ +// 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 Millis = RPI_GetMillis() +// Function to get time in millisecond since first setup function called. +// +// Calling Sequence +// Millis = RPI_GetMillis() +// +// Parameters +// Millis: time in milliseconds since first setup function called +// +// Description +// This function can be used to get time since first setup function called. +// Note: To use this function atleast one setup function must be called. +// +// Examples +// start = RPI_GetMillis() +// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. +// end = RPI_GetMillis() +// delay = end- start //This should be approximately 100ms. +// +// See also +// RPI_GetMicros RPI_DelayMilli RPI_DelayMicro +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +Millis = 0; +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetClock.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetClock.sci new file mode 100644 index 00000000..8448d364 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetClock.sci @@ -0,0 +1,35 @@ +// 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 RPI_HardPWMSetClock(clock_divisor) +// Function to set PWM clock. PWM clock frequency is 19.2MHz, which can be reduced +// using suitable clock_divisor (1 to 2048, powers of 2) +// +// Calling Sequence +// RPI_HardPWMSetClock(clock_divisor) +// +// Parameters +// clock_divisor: Value can be from 1 to 2048, powers of 2. +// Description +// This function decides pwm clock. +// PWM frequency = (PWM Clock frequency/Clock divisor/range) +// PWM clock frequency = 19.2 MHz +// clock divisor is setup using RPI_HardPWMSetClock +// range is setup using RPI_HardPWMSetRange +// Examples +// +// See also +// RPI_HardPWMSetWrite RPI_HardPWMSetRange +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci new file mode 100644 index 00000000..57b82601 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci @@ -0,0 +1,32 @@ +// 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 RPI_HardPWMSetMode(pwm_mode) +// Function to set PWM mode. Two modes are available - balanced and mark/space +// +// Calling Sequence +// RPI_HardPWMSetMode(pwm_mode) +// +// Parameters +// pwm_mode: decides pwm mode +// 0 -> balanced +// 1 -> mark/space +// Description +// This function decides pwm mode +// Examples +// +// See also +// RPI_HardPWMSetWrite RPI_HardPWMSetRange +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetRange.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetRange.sci new file mode 100644 index 00000000..c2075e2d --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetRange.sci @@ -0,0 +1,35 @@ +// 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 RPI_HardPWMSetRange(range_val) +// Function to set range value for PWM. Range value along with clock divisor +// decides pwm frequency. Range value must be less than 1024 +// +// Calling Sequence +// RPI_HardPWMSetRange(range_val) +// +// Parameters +// range_val: range for pwm +// Description +// This function decides range for pwm. +// PWM frequency = (PWM Clock frequency/Clock divisor/range) +// PWM clock frequency = 19.2 MHz +// clock divisor is setup using RPI_HardPWMSetClock +// range is setup using RPI_HardPWMSetRange +// Examples +// +// See also +// RPI_HardPWMSetClock RPI_HardPWMWrite +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMWrite.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMWrite.sci new file mode 100644 index 00000000..dba5e674 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMWrite.sci @@ -0,0 +1,39 @@ +// 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 RPI_HardPWMWrite(pin,value) +// Function to change pwm duty on specified pin. Hardware PWM is available +// only on pin 12. So, only '12' should be provided as pin +// +// Calling Sequence +// RPI_HardPWMWrite(12,512) //Value must be smaller than the range set +// using RPI_HARDPWMSetRange +// +// Parameters +// pin: pin no on which pwm value is to be changed. Currently only 12 is allowed +// value: pwm value for given pin. This must be less than range value set +// Description +// This function changes pwm duty on specified pin. As for RPi, only one pin +// (pin 12) is available for hardware PWM. +// PWM frequency = (PWM Clock frequency/Clock divisor/range) +// PWM clock frequency = 19.2 MHz +// clock divisor is setup using RPI_HardPWMSetClock +// range is setup using RPI_HardPWMSetRange +// Actual PWM duty = value/range +// Examples +// +// See also +// RPI_HardPWMSetClock RPI_HardPWMSetRange +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_PinISR.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_PinISR.sci new file mode 100644 index 00000000..c2354c1f --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_PinISR.sci @@ -0,0 +1,56 @@ +// 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 RPI_PinISR(pin, edgetype, fn) +// Function to assign a function to be run when an interrupt occurs on +// specified pin. +// +// Calling Sequence +// RPI_PinISR(pin, edgetype, fn) +// +// Parameters +// pin : pin whose interrupt is to be configured +// edgetype: edge on which interrupt is to be monitored +// 1 -> Falling egde +// 2 -> Rising egde +// 3 -> Both egde +// fn: name of the function to be executed on interrupt occurance +// Description +// This functions monitors interrupt on specified pin for specified edge, +// When that interrupt occurs, function specified by 'fn' is executed. +// Examples +// RPI_PinISR(12, 0, Pin12ISR) //executes 'Pin12ISR' on falling edge on +// pin 12 +// See also +// RPI_ThreadCreate RPI_DigitalSetup +// +// +// 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,27,28,29,... + 31,31,33,35,36,37,38,40]; + +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 +EdgeTypeSupported = members(edgetype,[1 2 3]); + +if(EdgeTypeSupported == 0) + error(9999, 'SCI2CERROR: Given edgetype is incorrect. Please specify correct edgetype from [1,2,3]') +end + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialClose.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialClose.sci new file mode 100644 index 00000000..f27dd432 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialClose.sci @@ -0,0 +1,33 @@ +// 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 RPI_SerialClose(fd) +// Function to close serial port specified by file descriptor. +// +// Calling Sequence +// RPI_SerialClose(fd) +// +// Parameters +// fd : file descriptor for opened port +// Description +// This functions closes the specified serial port +// Examples +// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' +// RPI_SerialClose(serial1) +// See also +// RPI_SerialOpen RPI_SerialSendChar +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialFlush.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialFlush.sci new file mode 100644 index 00000000..9bab386f --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialFlush.sci @@ -0,0 +1,34 @@ +// 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 data = RPI_SerialGetChar(fd) +// Function to read data from specified serial port +// +// Calling Sequence +// RPI_SerialGetCharfd) +// +// Parameters +// fd: file descriptor returned when serial port was opened +// Description +// This functions reads character form specified port. In case no +// character is available, -1 is returned after 10 sec. +// Examples +// serial = RPI_SetupSerial("/dev/ttyAMA0", 9600); +// RPI_SerialFlush(serial); +// bytes = RPI_SerialDataAvail(serial); +// +// See also +// RPI_SetupSerial RPI_SendData +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialGetChar.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialGetChar.sci new file mode 100644 index 00000000..a26e5b97 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialGetChar.sci @@ -0,0 +1,36 @@ +// 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 data = RPI_SerialGetChar(fd) +// Function to read data from specified serial port +// +// Calling Sequence +// RPI_SerialGetChar(fd) +// +// Parameters +// fd: file descriptor returned when serial port was opened +// Description +// This functions reads character form specified port. In case no +// character is available, -1 is returned after 10 sec. +// Examples +// serial = RPI_SetupSerial("/dev/ttyAMA0", 9600); +// bytes = RPI_SerialDataAvail(serial); +// if(bytes>0) +// data = RPI_SerialGetChar(serial) //Reads single character +// end +// See also +// RPI_SetupSerial RPI_SendData +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +data = 0; +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendChar.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendChar.sci new file mode 100644 index 00000000..769b21d2 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendChar.sci @@ -0,0 +1,37 @@ +// 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 RPI_SerialSendChar(fd, data) +// Function to send 8-bit char through serial port. +// +// Calling Sequence +// RPI_SerialSendChar(fd, data) +// +// Parameters +// fd : file descriptor for opened port +// data: 8-bit character data to be sent +// Description +// This functions sends input 8-bit character data on specified serial port +// Examples +// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' +// RPI_SerialSendChar(serial1, 'H'); +// RPI_SerialSendChar(serial1, 'i'); +// RPI_SerialClose(serial1); +// +// See also +// RPI_SerialOpen RPI_SerialClose +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendData.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendData.sci new file mode 100644 index 00000000..c05852b1 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendData.sci @@ -0,0 +1,38 @@ +// 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 RPI_SerialSendData(fd, data) +// Function to send data through serial port. Data can be of any datatype and +// can be scalar or matrix +// +// Calling Sequence +// RPI_SerialSendData(fd, data) +// +// Parameters +// fd : file descriptor for opened port +// data: data to be sent +// Description +// This functions sends input data on specified serial port +// Examples +// A = [2 3; 4 5] +// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' +// RPI_SerialSendData(serial1, A); +// RPI_SerialClose(serial1); +// +// See also +// RPI_SerialOpen RPI_SerialClose +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSetup.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSetup.sci new file mode 100644 index 00000000..0f266610 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSetup.sci @@ -0,0 +1,36 @@ +// 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 fd = RPI_SerialSetup(port, baudrate) +// Function to setup serial port. +// +// Calling Sequence +// RPI_SerialSetup(port, baudrate) +// +// Parameters +// port : port of RPi to be used (eg. ) +// direction : direction to be set for pin (0 -> INPUT, 1 -> OUTPUT) +// fd : file descriptor for opened port, -1 for error +// Description +// This functions opens the specified serial port and returns file descriptor +// for the same +// Examples +// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' +// +// See also +// RPI_SerialClose RPI_SerialSendChar +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +fd = 0; +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/old/buildmacros.sce new file mode 100644 index 00000000..2954a424 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/buildmacros.sce @@ -0,0 +1,4 @@ + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/old/names b/2.3-1/macros/Hardware/RasberryPi/old/names new file mode 100644 index 00000000..fa647761 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/names @@ -0,0 +1,21 @@ +GetRPISupportFunctions +IsRPISupportFunction +RPI_DelayMicro +RPI_DelayMilli +RPI_DigitalIn +RPI_DigitalOut +RPI_DigitalSetup +RPI_GetMicros +RPI_GetMillis +RPI_HardPWMSetClock +RPI_HardPWMSetMode +RPI_HardPWMSetRange +RPI_HardPWMWrite +RPI_PinISR +RPI_SerialClose +RPI_SerialFlush +RPI_SerialGetChar +RPI_SerialSendChar +RPI_SerialSendData +RPI_SerialSetup +u16RPISerialDataAvail diff --git a/2.3-1/macros/Hardware/RasberryPi/old/u16RPISerialDataAvail.sci b/2.3-1/macros/Hardware/RasberryPi/old/u16RPISerialDataAvail.sci new file mode 100644 index 00000000..6eb29a1c --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/u16RPISerialDataAvail.sci @@ -0,0 +1,37 @@ +// 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 bytes = RPI_SerialDataAvail(fd) +// Function to get number of data bytes available on serial port specified by +// file descriptor +// Calling Sequence +// RPI_SerialDataAvail(fd) +// +// Parameters +// fd : file descriptor for already opened serial port +// Description +// This functions returns number of characters available to read, +// otherwise reads -1 in case of error. This function can be used to check +// new data is available on serial port +// Examples +// serial = RPI_SerialOpen("/dev/ttyAMA0", 9600); +// charsToRead = RPI_SerialDataAvail(serial); +// See also +// RPI_SerialOpen RPI_SerialGetChar +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +bytes = 0; + +endfunction \ No newline at end of file diff --git a/2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8574Setup.sci b/2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8574Setup.sci new file mode 100755 index 00000000..f3e79429 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8574Setup.sci @@ -0,0 +1,43 @@ +// Copyright (C) 2017 - 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 RPI_pcf8574Setup(pinBase,i2cAddress) +// Function for setting up PCF8574 8-bit GPIO expander IC +// +// Calling Sequence +// RPI_pcf8574Setup(pinBase,i2cAddress) +// +// Parameters +// pinBase : any number above 64. The consecutive 8 pins will be allocated alongwith. +// i2cAddress: I2C address obtained using RPI_i2cdetect function +// +// Description +// This function sets up the extension module for the PCF8574 8-bit GPIO expander IC. Can be called multiple times for multiple PCF8574 using different pinBase for each. +// +//You don’t need to specify the number of pins here – the PCF8754 has 8 pins. +// +// Examples +// RPI_pcf8574Setup(67,100) +// See also +// RPI_pcf8591Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pf7#2#"+string(pinBase)+"#"+string(i2cAddress)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8591Setup.sci b/2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8591Setup.sci new file mode 100755 index 00000000..87054907 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8591Setup.sci @@ -0,0 +1,43 @@ +// Copyright (C) 2017 - 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 RPI_pcf8591Setup(pinBase,i2cAddress) +// Function for setting up 8-bit PCF8591 Analog IO expander IC +// +// Calling Sequence +// RPI_pcf8591Setup(pinBase,i2cAddress) +// +// Parameters +// pinBase : any number above 64.The consecutive 4 pins will be allocated alongwith. +// i2cAddress: I2C address obtained using RPI_i2cdetect function +// +// Description +// This function sets up the extension module for the PCF8591 8-bit GPIO expander IC. Can be called multiple times for multiple PCF8591 using different pinBase for each. +// +//Specifying the number of pins is not necessary – the PCF8791 has 4 pins – the analog output uses base pin number 0 – the same as analog input 0. +// +// Examples +// RPI_pcf8591Setup(67,64) +// See also +// RPI_pcf8574Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pf9#2#"+string(pinBase)+"#"+string(i2cAddress)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pcf/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/pcf/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pcf/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/pcf/names b/2.3-1/macros/Hardware/RasberryPi/pcf/names new file mode 100755 index 00000000..3e326a01 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pcf/names @@ -0,0 +1,2 @@ +RPI_pcf8574Setup +RPI_pcf8591Setup diff --git a/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlow1.sci b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlow1.sci new file mode 100755 index 00000000..e093238c --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlow1.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_piGlow1(leg,ring,intensity) +// Function to modify a single LED on the piGlow +// +// Calling Sequence +// RPI_piGlow1(leg,ring,intensity) +// +// Parameters +// leg : leg number +// ring : ring number +// intensity: brightness from 0 (off) to 255 (full) +// +// Description +// The function modifies the brightness of the single specified LED. +// +// Examples +// RPI_piGlow1(0,0,125) +// See also +// RPI_piGlowLeg, RPI_piGlowRing, RPI_piGlowSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pG1#3#"+string(leg)+"#"+string(ring)+"#"+string(intensity)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowLeg.sci b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowLeg.sci new file mode 100755 index 00000000..d0425797 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowLeg.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_piGlowLeg(leg,intensity) +// Function to modify a full leg of LEDs on the piGlow +// +// Calling Sequence +// RPI_piGlowLeg(leg,intensity) +// +// Parameters +// leg : leg number +// intensity: brightness from 0 (off) to 255 (full) +// +// Description +// This function modifies the brightness of all the LEDs in the single specified leg of piGlow. +// +// Examples +// RPI_piGlowLeg(0,100) +// See also +// RPI_piGlow1, RPI_piGlowRing, RPI_piGlowSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pGL#2#"+string(leg)+"#"+string(intensity)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowRing.sci b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowRing.sci new file mode 100755 index 00000000..ef816205 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowRing.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_piGlowRing(ring,intensity) +// Function to modify a full ring of LEDs on the piGlow +// +// Calling Sequence +// RPI_piGlowRing(ring,intensity) +// +// Parameters +// ring : ring number +// intensity: brightness from 0 (off) to 255 (full) +// +// Description +// This function modifies the brightness of all the LEDs in the single specified ring of piGlow. +// +// Examples +// RPI_piGlowRing(1,200) +// See also +// RPI_piGlowLeg, RPI_piGlow1, RPI_piGlowSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pGR#2#"+string(ring)+"#"+string(intensity)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowSetup.sci b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowSetup.sci new file mode 100755 index 00000000..718fa3b6 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowSetup.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_piGlowSetup(Empty) +// Function to initialize the piGlow board +// +// Calling Sequence +// RPI_piGlowSetup(Empty) +// +// Parameters +// Empty: integer, 0 or 1. If 1, then all the LEDs will be turned off to start with. +// +// Description +// This initialises the PiGlow devLib software. The I2C kernel module needs to be pre-loaded. ThePiGlow board has an SN3218 I2C LED controller and 18 LEDs arranged in 3 “legs” of 6 LEDs. (or 6 “rings” of 3 LEDs). +// +// The LED colours in each leg match and are in the order Red (at the outside), Yellow, Orange, Green, Blue and White (in the center) +// +// Examples +// RPI_piGlowSetup(TRUE) +// See also +// RPI_piGlowLeg, RPI_piGlow1, RPI_piGlowRing +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pGS#1#"+string(Empty)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/piGlow/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/piGlow/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/piGlow/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/piGlow/names b/2.3-1/macros/Hardware/RasberryPi/piGlow/names new file mode 100755 index 00000000..b63ec8f7 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/piGlow/names @@ -0,0 +1,4 @@ +RPI_piGlow1 +RPI_piGlowLeg +RPI_piGlowRing +RPI_piGlowSetup diff --git a/2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_physToGpio.sci b/2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_physToGpio.sci new file mode 100755 index 00000000..9a59caa2 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_physToGpio.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_physToGpio(pin) +// Function to check the GPIO pin number corresponding to given physical pin number. +// +// Calling Sequence +// p=RPI_physToGpio(pin) +// +// Parameters +// pin: The pin number to check in physical numbering sequence. +// +// Description +// This funtion return the GPIO pin number corresponding to the supplied physical pin number. +// +// Examples +// p=RPI_physToGpio(11) +// See also +// RPI_wpiToGpio +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="ptG#1#"+string(pin)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_wpiToGpio.sci b/2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_wpiToGpio.sci new file mode 100755 index 00000000..deed4264 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_wpiToGpio.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_wpiToGpio(pin) +// Function to check the GPIO pin number corresponding to given wiringpi pin number. +// +// Calling Sequence +// p=RPI_wpiToGpio(pin) +// +// Parameters +// pin: The pin number to check in wiringpi numbering sequence. +// +// Description +// This funtion return the GPIO pin number corresponding to the supplied wiringpi pin number. +// +// Examples +// p=RPI_wpiToGpio(0) +// See also +// RPI_physToGpio +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="wtG#1#"+string(pin)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pinMap/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/pinMap/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pinMap/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/pinMap/names b/2.3-1/macros/Hardware/RasberryPi/pinMap/names new file mode 100755 index 00000000..71efa237 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pinMap/names @@ -0,0 +1,2 @@ +RPI_physToGpio +RPI_wpiToGpio diff --git a/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmClock.sci b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmClock.sci new file mode 100755 index 00000000..d0653537 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmClock.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_pwmClock(value) +// Function to set the divisor for the PWM clock. +// +// Calling Sequence +// RPI_pwmClock(value) +// +// Parameters +// value: The divisor for the PWM clock. +// +// Description +// This function sets the divisor for the PWM clock. +// +// Examples +// RPI_pwmClock(100) +// See also +// RPI_pwmMode, RPI_pwmRange, RPI_pwmToneWrite, RPI_pwmWrite +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pwC#1#"+string(value)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmMode.sci b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmMode.sci new file mode 100755 index 00000000..13d0c367 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmMode.sci @@ -0,0 +1,46 @@ +// Copyright (C) 2017 - 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 RPI_pwmMode(Mode) +// Function to set the mode for the PWM generator +// +// Calling Sequence +// RPI_pwmMode(mode) +// +// Parameters +// mode: The mode to set for the PWM generator. 'ms' (for mark:space) or 'bal' (for balanced) +// +// Description +// This function sets the mode for the PWM generator. The PWM generator can run in 2 modes – “balanced” and “mark:space”. The mark:space mode is traditional, however the default mode in the Pi is “balanced”. Switch modes by supplying the parameter: bal or ms +// +// Examples +// RPI_pwmMode('bal') +// See also +// RPI_pwmRange, RPI_pwmClock, RPI_pwmToneWrite, RPI_pwmWrite +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + if Mode=='ms' then + commande="pwM#1#0#"; + elseif Mode=='bal' then + commande="pwM#1#1#"; + else: + error("mode should be ""ms"" or ""bal"""); + end + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmRange.sci b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmRange.sci new file mode 100755 index 00000000..6a1503a0 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmRange.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_pwmRange(value) +// Function to set the divisor for the PWM clock. +// +// Calling Sequence +// RPI_pwmRange(value) +// +// Parameters +// value: maximum of the range for the PWM generator. +// +// Description +// This function sets the range register in the PWM generator. The default is 1024. +// +// Examples +// RPI_pwmRange(512) +// See also +// RPI_pwmMode, RPI_pwmClock, RPI_pwmToneWrite, RPI_pwmWrite +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pwR#1#"+string(value)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmToneWrite.sci b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmToneWrite.sci new file mode 100755 index 00000000..d7ff6eda --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmToneWrite.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_pwmToneWrite(pin,freq) +// Function to write a tone of a given frequency to the pin +// +// Calling Sequence +// RPI_pwmToneWrite(pin,freq) +// +// Parameters +// pin : The pin to set the frequency on. Numbering to be followed as initiated using RPI_pinNumbering. +// freq: frequency to write +// +// Description +// This function write the given frequency tone to the given pin. +// +// Examples +// RPI_pwmToneWrite(0,100) +// See also +// RPI_pwmMode, RPI_pwmRange, RPI_pwmClock, RPI_pwmWrite, PRI_pinNumbering +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pwT#2#"+string(pin)+"#"+string(freq)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmWrite.sci b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmWrite.sci new file mode 100755 index 00000000..113547af --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmWrite.sci @@ -0,0 +1,45 @@ +// Copyright (C) 2017 - 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 RPI_pwmWrite(pin,value) +// Function to write voltage value to the PWM register for the given pin. +// +// Calling Sequence +// RPI_pwmWrite(pin,value) +// +// Parameters +// pin : The pin number set the voltage at. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// value: The voltage to set at the given pin. Range is 0-1024. +// +// Description +// Writes the value to the PWM register for the given pin. The Raspberry Pi has one on-board PWM pin, pin 1 (BMC_GPIO 18, Phys 12). Other PWM devices may have other PWM ranges. +// +// Examples +// RPI_pwmWrite(1,500) +// See also +// RPI_pwmMode, RPI_pwmRange, RPI_pwmClock, RPI_pwmToneWrite +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + if [0logs.txt 2>&1"); + disp("Step 3/6") + TCL_EvalStr("exec ssh-copy-id -i /home/"+local+"/.ssh/id_rsa.pub "+username+"@"+adress+" > logs.txt 2>&1"); + disp("Step 4/6") + TCL_EvalStr("exec rsync -avz "+RPI_MacrosPath+"serverWP.py "+username+"@"+adress+":.scilab/ >logs.txt"); + disp("Step 5/6") + TCL_EvalStr("exec ssh "+username+"@"+adress+" sudo python /home/"+username+"/.scilab/serverWP.py &"); + disp("Step 6/6") + TCL_EvalStr(["file delete logs.txt";"file delete &1"]); + endfunction +elseif getos()=='Windows' then + tempPath=get_absolute_file_path("raspi.sci"); + RPI_MacrosPath=strsubst(tempPath,'\','/'); + RPI_MacrosPath=part(RPI_MacrosPath,1:(length(RPI_MacrosPath)-7)); + RPI_MacrosPath=RPI_MacrosPath+'src/python/'; + function raspi(adress,username) + // Function to initiate the connection to the raspberry pi + // + // Calling Sequence + // raspi(adress,username) + // + // Parameters + // address : Network address of the raspberry pi. Eg:10.42.0.82 + // username: username on the raspberry pi. + // + // Description + // This program initiates the connection to the raspberry pi at the given address by running the python server script on port 9077 on the pi. + // + // Examples + // raspi('169.254.191.116','pi') + // See also + // raspi_close + // + // Authors + // Jorawar Singh + + global RPI_piAdress; + RPI_piAdress=adress; + + disp("Step 1/3") + TCL_EvalStr("exec mintty ssh "+username+"@"+adress+" mkdir .scilab"); + disp("Step 2/3") + TCL_EvalStr("exec mintty scp "+RPI_MacrosPath+"serverWP.py "+username+"@"+adress+":/home/"+username+"/.scilab/"); + disp("Step 3/3 (Wait ~15 seconds)") + TCL_EvalStr("exec mintty ssh "+username+"@"+adress+" sudo python /home/"+username+"/.scilab/serverWP.py &"); + sleep(15000) + TCL_EvalStr("exec taskkill /IM mintty.exe"); + endfunction +end diff --git a/2.3-1/macros/Hardware/RasberryPi/raspi_close.sci b/2.3-1/macros/Hardware/RasberryPi/raspi_close.sci new file mode 100755 index 00000000..b5bb0ee7 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/raspi_close.sci @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - 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 raspi_close() +// Function to close an open Raspberry-Pi connection. +// +// Calling Sequence +// raspi_close() +// +// Description +// This function causes the pyhton server script running on Raspberry pi to close, irrespective of it being started natively on pi or by using raspi function. +// +// Examples +// raspi_close() +// See also +// raspi +// +// Authors +// Jorawar Singh + + commande="cls#0#"; + if getos()=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci b/2.3-1/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci deleted file mode 100644 index 6eb29a1c..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci +++ /dev/null @@ -1,37 +0,0 @@ -// 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 bytes = RPI_SerialDataAvail(fd) -// Function to get number of data bytes available on serial port specified by -// file descriptor -// Calling Sequence -// RPI_SerialDataAvail(fd) -// -// Parameters -// fd : file descriptor for already opened serial port -// Description -// This functions returns number of characters available to read, -// otherwise reads -1 in case of error. This function can be used to check -// new data is available on serial port -// Examples -// serial = RPI_SerialOpen("/dev/ttyAMA0", 9600); -// charsToRead = RPI_SerialDataAvail(serial); -// See also -// RPI_SerialOpen RPI_SerialGetChar -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -bytes = 0; - -endfunction \ No newline at end of file diff --git a/2.3-1/macros/ImageProcessing/core/lib b/2.3-1/macros/ImageProcessing/core/lib deleted file mode 100644 index 7f003c8e..00000000 Binary files a/2.3-1/macros/ImageProcessing/core/lib and /dev/null differ diff --git a/2.3-1/macros/ImageProcessing/highgui/lib b/2.3-1/macros/ImageProcessing/highgui/lib deleted file mode 100644 index 787c25fa..00000000 Binary files a/2.3-1/macros/ImageProcessing/highgui/lib and /dev/null differ diff --git a/2.3-1/macros/ImageProcessing/imgproc/lib b/2.3-1/macros/ImageProcessing/imgproc/lib deleted file mode 100644 index 93c83909..00000000 Binary files a/2.3-1/macros/ImageProcessing/imgproc/lib and /dev/null differ diff --git a/2.3-1/macros/Scilab-Arduino/buildmacros.sce b/2.3-1/macros/Scilab-Arduino/buildmacros.sce old mode 100644 new mode 100755 index dfeb4755..7d533f7b --- a/2.3-1/macros/Scilab-Arduino/buildmacros.sce +++ b/2.3-1/macros/Scilab-Arduino/buildmacros.sce @@ -1,28 +1,13 @@ -// 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; +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); diff --git a/2.3-1/macros/Scilab-Arduino/lib b/2.3-1/macros/Scilab-Arduino/lib deleted file mode 100644 index 5b7beab0..00000000 Binary files a/2.3-1/macros/Scilab-Arduino/lib and /dev/null differ diff --git a/2.3-1/macros/SymbolTable/lib b/2.3-1/macros/SymbolTable/lib deleted file mode 100644 index c42cf1a5..00000000 Binary files a/2.3-1/macros/SymbolTable/lib and /dev/null differ diff --git a/2.3-1/macros/ToolInitialization/lib b/2.3-1/macros/ToolInitialization/lib deleted file mode 100644 index 267c9c9f..00000000 Binary files a/2.3-1/macros/ToolInitialization/lib and /dev/null differ diff --git a/2.3-1/macros/findDeps/lib b/2.3-1/macros/findDeps/lib deleted file mode 100644 index 69c3c0e1..00000000 Binary files a/2.3-1/macros/findDeps/lib and /dev/null differ diff --git a/2.3-1/macros/lib b/2.3-1/macros/lib deleted file mode 100644 index f759663f..00000000 Binary files a/2.3-1/macros/lib and /dev/null differ -- cgit From 5120257de94783e808523343effda00243ad6611 Mon Sep 17 00:00:00 2001 From: Jorawar Singh Date: Sun, 16 Jul 2017 22:17:43 +0530 Subject: Toolbox merge, RPI demos and structured demos --- .../RasberryPi/Digital/RPI_digitalRead.sci | 41 ++++++++++ .../RasberryPi/Digital/RPI_digitalReadByte.sci | 40 +++++++++ .../RasberryPi/Digital/RPI_digitalWrite.sci | 46 +++++++++++ .../RasberryPi/Digital/RPI_digitalWriteByte.sci | 42 ++++++++++ .../Hardware/RasberryPi/Digital/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/Digital/names | 4 + .../macros/Hardware/RasberryPi/I2C/RPI_I2CRead.sci | 40 +++++++++ .../Hardware/RasberryPi/I2C/RPI_I2CReadReg16.sci | 41 ++++++++++ .../Hardware/RasberryPi/I2C/RPI_I2CReadReg8.sci | 41 ++++++++++ .../Hardware/RasberryPi/I2C/RPI_I2CSetup.sci | 42 ++++++++++ .../RasberryPi/I2C/RPI_I2CSetupInterface.sci | 41 ++++++++++ .../Hardware/RasberryPi/I2C/RPI_I2CWrite.sci | 41 ++++++++++ .../Hardware/RasberryPi/I2C/RPI_I2CWriteReg16.sci | 42 ++++++++++ .../Hardware/RasberryPi/I2C/RPI_I2CWriteReg8.sci | 42 ++++++++++ .../Hardware/RasberryPi/I2C/RPI_i2cdetect.sci | 38 +++++++++ .../macros/Hardware/RasberryPi/I2C/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/I2C/names | 9 +++ .../RasberryPi/Interrupt/RPI_waitForInterrupt.sci | 45 +++++++++++ .../Hardware/RasberryPi/Interrupt/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/Interrupt/names | 1 + .../Hardware/RasberryPi/Misc/RPI_boardRev.sci | 34 ++++++++ .../Hardware/RasberryPi/Misc/RPI_padDrive.sci | 40 +++++++++ .../Hardware/RasberryPi/Misc/RPI_sn3218Setup.sci | 40 +++++++++ .../Hardware/RasberryPi/Misc/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/Misc/names | 3 + .../macros/Hardware/RasberryPi/RPI_DelayMicro.sci | 38 --------- .../macros/Hardware/RasberryPi/RPI_DelayMilli.sci | 39 --------- 2.3-1/macros/Hardware/RasberryPi/RPI_DigitalIn.sci | 43 ---------- .../macros/Hardware/RasberryPi/RPI_DigitalOut.sci | 44 ---------- .../Hardware/RasberryPi/RPI_DigitalSetup.sci | 36 --------- 2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.sci | 39 --------- 2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.sci | 39 --------- .../Hardware/RasberryPi/RPI_HardPWMSetClock.sci | 35 -------- .../Hardware/RasberryPi/RPI_HardPWMSetMode.sci | 32 -------- .../Hardware/RasberryPi/RPI_HardPWMSetRange.sci | 35 -------- .../Hardware/RasberryPi/RPI_HardPWMWrite.sci | 39 --------- 2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.sci | 56 ------------- .../macros/Hardware/RasberryPi/RPI_SerialClose.sci | 33 -------- .../macros/Hardware/RasberryPi/RPI_SerialFlush.sci | 34 -------- .../Hardware/RasberryPi/RPI_SerialGetChar.sci | 36 --------- .../Hardware/RasberryPi/RPI_SerialSendChar.sci | 37 --------- .../Hardware/RasberryPi/RPI_SerialSendData.sci | 38 --------- .../macros/Hardware/RasberryPi/RPI_SerialSetup.sci | 36 --------- 2.3-1/macros/Hardware/RasberryPi/RPI_adress.sci | 34 ++++++++ .../Hardware/RasberryPi/SPI/RPI_SPIDataRW.sci | 42 ++++++++++ .../Hardware/RasberryPi/SPI/RPI_SPIGetFd.sci | 39 +++++++++ .../Hardware/RasberryPi/SPI/RPI_SPISetup.sci | 43 ++++++++++ .../Hardware/RasberryPi/SPI/RPI_SPISetupMode.sci | 41 ++++++++++ .../macros/Hardware/RasberryPi/SPI/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/SPI/names | 4 + .../Hardware/RasberryPi/Serial/RPI_serialClose.sci | 40 +++++++++ .../RasberryPi/Serial/RPI_serialDataAvail.sci | 40 +++++++++ .../Hardware/RasberryPi/Serial/RPI_serialFlush.sci | 40 +++++++++ .../RasberryPi/Serial/RPI_serialGetchar.sci | 40 +++++++++ .../Hardware/RasberryPi/Serial/RPI_serialOpen.sci | 41 ++++++++++ .../RasberryPi/Serial/RPI_serialPrintf.sci | 41 ++++++++++ .../RasberryPi/Serial/RPI_serialPutchar.sci | 41 ++++++++++ .../Hardware/RasberryPi/Serial/RPI_serialPuts.sci | 41 ++++++++++ .../Hardware/RasberryPi/Serial/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/Serial/names | 8 ++ .../Hardware/RasberryPi/Setup/RPI_getAlt.sci | 40 +++++++++ .../Hardware/RasberryPi/Setup/RPI_pinMode.sci | 60 ++++++++++++++ .../Hardware/RasberryPi/Setup/RPI_pinModeAlt.sci | 55 +++++++++++++ .../Hardware/RasberryPi/Setup/RPI_pinNumbering.sci | 54 +++++++++++++ .../Hardware/RasberryPi/Setup/RPI_pullControl.sci | 60 ++++++++++++++ .../Hardware/RasberryPi/Setup/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/Setup/names | 5 ++ .../Hardware/RasberryPi/Shift/RPI_shiftIn.sci | 42 ++++++++++ .../Hardware/RasberryPi/Shift/RPI_shiftOut.sci | 43 ++++++++++ .../Hardware/RasberryPi/Shift/RPI_sr595Setup.sci | 44 ++++++++++ .../Hardware/RasberryPi/Shift/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/Shift/names | 3 + .../Hardware/RasberryPi/Soft/RPI_softPwmCreate.sci | 44 ++++++++++ .../Hardware/RasberryPi/Soft/RPI_softPwmStop.sci | 40 +++++++++ .../Hardware/RasberryPi/Soft/RPI_softPwmWrite.sci | 41 ++++++++++ .../RasberryPi/Soft/RPI_softToneCreate.sci | 43 ++++++++++ .../Hardware/RasberryPi/Soft/RPI_softToneStop.sci | 40 +++++++++ .../Hardware/RasberryPi/Soft/RPI_softToneWrite.sci | 41 ++++++++++ .../Hardware/RasberryPi/Soft/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/Soft/names | 6 ++ .../Hardware/RasberryPi/Timing/RPI_delay.sci | 40 +++++++++ .../Hardware/RasberryPi/Timing/RPI_delayMicro.sci | 40 +++++++++ .../Hardware/RasberryPi/Timing/RPI_micros.sci | 37 +++++++++ .../Hardware/RasberryPi/Timing/RPI_millis.sci | 37 +++++++++ .../Hardware/RasberryPi/Timing/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/Timing/names | 4 + 2.3-1/macros/Hardware/RasberryPi/buildmacros.sce | 49 ++++++++++- 2.3-1/macros/Hardware/RasberryPi/cleanmacros.sce | 20 +++++ .../RasberryPi/gertBoard/RPI_analogRead.sci | 40 +++++++++ .../RasberryPi/gertBoard/RPI_analogWrite.sci | 41 ++++++++++ .../gertBoard/RPI_gertboardAnalogRead.sci | 42 ++++++++++ .../gertBoard/RPI_gertboardAnalogSetup.sci | 41 ++++++++++ .../gertBoard/RPI_gertboardAnalogWrite.sci | 42 ++++++++++ .../RasberryPi/gertBoard/RPI_gertboardSPISetup.sci | 39 +++++++++ .../Hardware/RasberryPi/gertBoard/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/gertBoard/names | 6 ++ .../Hardware/RasberryPi/lcd/RPI_lcdCharDef.sci | 44 ++++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdClear.sci | 40 +++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdCursor.sci | 41 ++++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdCursorBlink.sci | 41 ++++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdDisplay.sci | 41 ++++++++++ .../macros/Hardware/RasberryPi/lcd/RPI_lcdHome.sci | 40 +++++++++ .../macros/Hardware/RasberryPi/lcd/RPI_lcdInit.sci | 54 +++++++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdPosition.sci | 42 ++++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdPrintf.sci | 41 ++++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdPutchar.sci | 41 ++++++++++ .../macros/Hardware/RasberryPi/lcd/RPI_lcdPuts.sci | 42 ++++++++++ .../Hardware/RasberryPi/lcd/RPI_lcdSendCommand.sci | 41 ++++++++++ .../macros/Hardware/RasberryPi/lcd/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/lcd/names | 12 +++ .../lcd128x64/RPI_lcd128x64Orientation.sci | 48 +++++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64circle.sci | 44 ++++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64clear.sci | 40 +++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64ellipse.sci | 45 +++++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64line.sci | 44 ++++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64lineTo.sci | 42 ++++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64point.sci | 42 ++++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64putchar.sci | 44 ++++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64puts.sci | 44 ++++++++++ .../lcd128x64/RPI_lcd128x64rectangle.sci | 45 +++++++++++ .../lcd128x64/RPI_lcd128x64setOrigin.sci | 41 ++++++++++ .../RasberryPi/lcd128x64/RPI_lcd128x64setup.sci | 37 +++++++++ .../Hardware/RasberryPi/lcd128x64/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/lcd128x64/names | 12 +++ .../Hardware/RasberryPi/mcp/RPI_mcp23008Setup.sci | 41 ++++++++++ .../Hardware/RasberryPi/mcp/RPI_mcp23016Setup.sci | 41 ++++++++++ .../Hardware/RasberryPi/mcp/RPI_mcp23017Setup.sci | 41 ++++++++++ .../Hardware/RasberryPi/mcp/RPI_mcp23s08Setup.sci | 42 ++++++++++ .../Hardware/RasberryPi/mcp/RPI_mcp23s17Setup.sci | 42 ++++++++++ .../macros/Hardware/RasberryPi/mcp/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/mcp/names | 5 ++ 2.3-1/macros/Hardware/RasberryPi/names | 22 +---- .../RasberryPi/old/GetRPISupportFunctions.sci | 48 +++++++++++ .../RasberryPi/old/IsRPISupportFunction.sci | 32 ++++++++ .../Hardware/RasberryPi/old/RPI_DelayMicro.sci | 38 +++++++++ .../Hardware/RasberryPi/old/RPI_DelayMilli.sci | 39 +++++++++ .../Hardware/RasberryPi/old/RPI_DigitalIn.sci | 43 ++++++++++ .../Hardware/RasberryPi/old/RPI_DigitalOut.sci | 44 ++++++++++ .../Hardware/RasberryPi/old/RPI_DigitalSetup.sci | 36 +++++++++ .../Hardware/RasberryPi/old/RPI_GetMicros.sci | 39 +++++++++ .../Hardware/RasberryPi/old/RPI_GetMillis.sci | 39 +++++++++ .../RasberryPi/old/RPI_HardPWMSetClock.sci | 35 ++++++++ .../Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci | 32 ++++++++ .../RasberryPi/old/RPI_HardPWMSetRange.sci | 35 ++++++++ .../Hardware/RasberryPi/old/RPI_HardPWMWrite.sci | 39 +++++++++ .../macros/Hardware/RasberryPi/old/RPI_PinISR.sci | 56 +++++++++++++ .../Hardware/RasberryPi/old/RPI_SerialClose.sci | 33 ++++++++ .../Hardware/RasberryPi/old/RPI_SerialFlush.sci | 34 ++++++++ .../Hardware/RasberryPi/old/RPI_SerialGetChar.sci | 36 +++++++++ .../Hardware/RasberryPi/old/RPI_SerialSendChar.sci | 37 +++++++++ .../Hardware/RasberryPi/old/RPI_SerialSendData.sci | 38 +++++++++ .../Hardware/RasberryPi/old/RPI_SerialSetup.sci | 36 +++++++++ .../macros/Hardware/RasberryPi/old/buildmacros.sce | 4 + 2.3-1/macros/Hardware/RasberryPi/old/names | 21 +++++ .../RasberryPi/old/u16RPISerialDataAvail.sci | 37 +++++++++ .../Hardware/RasberryPi/pcf/RPI_pcf8574Setup.sci | 43 ++++++++++ .../Hardware/RasberryPi/pcf/RPI_pcf8591Setup.sci | 43 ++++++++++ .../macros/Hardware/RasberryPi/pcf/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/pcf/names | 2 + .../Hardware/RasberryPi/piGlow/RPI_piGlow1.sci | 42 ++++++++++ .../Hardware/RasberryPi/piGlow/RPI_piGlowLeg.sci | 41 ++++++++++ .../Hardware/RasberryPi/piGlow/RPI_piGlowRing.sci | 41 ++++++++++ .../Hardware/RasberryPi/piGlow/RPI_piGlowSetup.sci | 42 ++++++++++ .../Hardware/RasberryPi/piGlow/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/piGlow/names | 4 + .../Hardware/RasberryPi/pinMap/RPI_physToGpio.sci | 40 +++++++++ .../Hardware/RasberryPi/pinMap/RPI_wpiToGpio.sci | 40 +++++++++ .../Hardware/RasberryPi/pinMap/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/pinMap/names | 2 + .../Hardware/RasberryPi/pwm/RPI_pwmClock.sci | 40 +++++++++ .../macros/Hardware/RasberryPi/pwm/RPI_pwmMode.sci | 46 +++++++++++ .../Hardware/RasberryPi/pwm/RPI_pwmRange.sci | 40 +++++++++ .../Hardware/RasberryPi/pwm/RPI_pwmToneWrite.sci | 41 ++++++++++ .../Hardware/RasberryPi/pwm/RPI_pwmWrite.sci | 45 +++++++++++ .../macros/Hardware/RasberryPi/pwm/buildmacros.sce | 14 ++++ 2.3-1/macros/Hardware/RasberryPi/pwm/names | 5 ++ 2.3-1/macros/Hardware/RasberryPi/raspi.sci | 94 ++++++++++++++++++++++ 2.3-1/macros/Hardware/RasberryPi/raspi_close.sci | 34 ++++++++ .../Hardware/RasberryPi/u16RPISerialDataAvail.sci | 37 --------- 2.3-1/macros/Scilab-Arduino/buildmacros.sce | 35 +++----- 180 files changed, 5426 insertions(+), 772 deletions(-) create mode 100755 2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalRead.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalReadByte.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWriteByte.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Digital/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Digital/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CRead.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg16.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg8.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetupInterface.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg16.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg8.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/RPI_i2cdetect.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/I2C/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/Interrupt/RPI_waitForInterrupt.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Interrupt/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Interrupt/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/Misc/RPI_boardRev.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Misc/RPI_padDrive.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Misc/RPI_sn3218Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Misc/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Misc/names delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_DelayMicro.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_DelayMilli.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_DigitalIn.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_DigitalOut.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetClock.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetMode.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetRange.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMWrite.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_SerialClose.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_SerialFlush.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendData.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/RPI_SerialSetup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/RPI_adress.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIDataRW.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIGetFd.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetupMode.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/SPI/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/SPI/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialClose.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialDataAvail.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialFlush.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialGetchar.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialOpen.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPrintf.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPutchar.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPuts.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Serial/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/Setup/RPI_getAlt.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinMode.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinModeAlt.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinNumbering.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pullControl.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Setup/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Setup/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftIn.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftOut.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Shift/RPI_sr595Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Shift/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Shift/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmCreate.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmStop.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneCreate.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneStop.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Soft/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delay.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delayMicro.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Timing/RPI_micros.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Timing/RPI_millis.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/Timing/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/Timing/names mode change 100644 => 100755 2.3-1/macros/Hardware/RasberryPi/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/cleanmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogRead.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogRead.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogSetup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardSPISetup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/gertBoard/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCharDef.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdClear.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursor.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursorBlink.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdDisplay.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdHome.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdInit.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPosition.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPrintf.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPutchar.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPuts.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdSendCommand.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64Orientation.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64circle.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64clear.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64ellipse.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64line.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64lineTo.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64point.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64putchar.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64puts.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64rectangle.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setOrigin.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/lcd128x64/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23008Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23016Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23017Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s08Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s17Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/mcp/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/mcp/names mode change 100644 => 100755 2.3-1/macros/Hardware/RasberryPi/names create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/GetRPISupportFunctions.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/IsRPISupportFunction.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMicro.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMilli.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalIn.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalOut.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalSetup.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMicros.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMillis.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetClock.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetRange.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMWrite.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_PinISR.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialClose.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialFlush.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialGetChar.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendChar.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendData.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSetup.sci create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/buildmacros.sce create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/names create mode 100644 2.3-1/macros/Hardware/RasberryPi/old/u16RPISerialDataAvail.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8574Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8591Setup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pcf/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/pcf/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlow1.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowLeg.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowRing.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowSetup.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/piGlow/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/piGlow/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_physToGpio.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_wpiToGpio.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pinMap/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/pinMap/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmClock.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmMode.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmRange.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmToneWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmWrite.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/pwm/buildmacros.sce create mode 100755 2.3-1/macros/Hardware/RasberryPi/pwm/names create mode 100755 2.3-1/macros/Hardware/RasberryPi/raspi.sci create mode 100755 2.3-1/macros/Hardware/RasberryPi/raspi_close.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci mode change 100644 => 100755 2.3-1/macros/Scilab-Arduino/buildmacros.sce (limited to '2.3-1/macros') diff --git a/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalRead.sci b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalRead.sci new file mode 100755 index 00000000..f3f229f9 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalRead.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_digitalRead(pin) +// Function to read the digital voltage at the given pin +// +// Calling Sequence +// v=RPI_digitalRead(pin) +// +// Parameters +// pin: The pin number to read the voltage from. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// +// Description +// This funtion reads the digital voltage at the given pin. Returns a 0 (for low) and 1 (for high). +// Note: pin should be set for input mode using RPI_pinMode. The function will also return 0/1 corresponding to what the voltage is set for an output pin. +// +// Examples +// v=RPI_digitalRead(0) +// See also +// RPI_analogWrite, RPI_analogRead, RPI_digitalWrite, RPI_pinNumbering, RPI_pinMode +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="diR#1#"+string(pin)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalReadByte.sci b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalReadByte.sci new file mode 100755 index 00000000..5cbccc21 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalReadByte.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function out=RPI_digitalReadByte() +// Function to read first 8 GPIO pins +// +// Calling Sequence +// b=RPI_digitalReadByte() +// +// Description +// This function read the state of the first eight GPIO pins at once. The state is read from pin0 to pin7. +// +// Note: The MSB-LSB sequence here is opposite of that of the RPI_digitalWriteByte. +// +// Examples +// b=RPI_digitalReadByte() +// See also +// RPI_digitalWriteByte, RPI_digitalRead +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="BtR#0#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWrite.sci b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWrite.sci new file mode 100755 index 00000000..d4ac660b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWrite.sci @@ -0,0 +1,46 @@ +// Copyright (C) 2017 - 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 RPI_digitalWrite(pin,Volt) +// Function to set digital voltage at the given pin +// +// Calling Sequence +// RPI_digitalWrite(pin,Volt) +// +// Parameters +// pin : The pin number to set the voltage at. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// Volt: Digital voltage to set. 0 (for logic-LOW) or 1 (for logic-HIGH) +// +// Description +// This funtion sets the voltage at the given pin. 0v for logic 0 and 3.3v for logic 1. +// Note: pin should be set for output mode using RPI_pinMode. +// +// Examples +// RPI_digitalWrite(0,1) +// See also +// RPI_analogWrite, RPI_digitalRead, RPI_digitalRead, RPI_pinNumbering, RPI_pinMode +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + if (Volt==0 | Volt==1) then + commande="diW#2#"+string(pin)+"#"+string(Volt)+"#"; + else + error("Voltage logic should be 0 or 1."); + end + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWriteByte.sci b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWriteByte.sci new file mode 100755 index 00000000..f7f9191c --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Digital/RPI_digitalWriteByte.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_digitalWriteByte(Byte) +// Function to set first eight GPIO pins to a particular value +// +// Calling Sequence +// RPI_digitalWriteByte(Byte) +// +// Parameters +// Byte: An 8-bit byte to write on the first 8 GPIO pins. Inter from 0 to 255. +// +// Description +// This writes the 8-bit byte supplied to the first 8 GPIO pins. It’s the fastest way to set all 8 bits at once to a particular value, although it still takes two write operations to the Pi’s GPIO hardware. The state is written from pin7 to pin0. +// +// Note: The MSB-LSB sequence here is opposite to that from RPI_digitalReadByte. +// +// Examples +// RPI_digitalWriteByte(128) +// See also +// RPI_digitalReadByte, RPI_digitalWrite +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="BtW#1#"+string(Byte)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Digital/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Digital/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Digital/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Digital/names b/2.3-1/macros/Hardware/RasberryPi/Digital/names new file mode 100755 index 00000000..27fe63bc --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Digital/names @@ -0,0 +1,4 @@ +RPI_digitalRead +RPI_digitalReadByte +RPI_digitalWrite +RPI_digitalWriteByte diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CRead.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CRead.sci new file mode 100755 index 00000000..afd98500 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CRead.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_I2CRead(fd) +// Function to read device +// +// Calling Sequence +// RPI_I2CRead(fd) +// +// Parameters +// fd: file descriptor obtained from RPI_I2CSetup +// +// Description +// Function for a simple device read. Some devices present data when you read them without having to do any register transactions. +// +// Examples +// RPI_I2CRead(13) +// See also +// RPI_i2cdetect, RPI_I2CReadReg8, RPI_I2CReadReg16, RPI_I2CWrite, RPI_I2CWriteReg8, RPI_I2CWriteReg16, RPI_I2CSetupInterface, RPI_I2CSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CR1#1#"+string(fd)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg16.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg16.sci new file mode 100755 index 00000000..f0ad9898 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg16.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_I2CReadReg16(fd,reg) +// Function to read 16-bit valu from the register +// +// Calling Sequence +// RPI_I2CReadReg16(fd,reg) +// +// Parameters +// fd : file descriptor obtained from RPI_I2CSetup +// reg: integer register to read data from +// +// Description +// This function reads a 16-bit value from the device register indicated. +// +// Examples +// RPI_I2CReadReg16(13,0x40) +// See also +// RPI_i2cdetect, RPI_I2CRead, RPI_I2CReadReg8, RPI_I2CWrite, RPI_I2CWriteReg8, RPI_I2CWriteReg16, RPI_I2CSetupInterface, RPI_I2CSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CR3#2#"+string(fd)+"#"+string(reg)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg8.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg8.sci new file mode 100755 index 00000000..d2ab59fd --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CReadReg8.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_I2CReadReg8(fd,reg) +// Function to read 8-bit valu from the register +// +// Calling Sequence +// RPI_I2CReadReg8(fd,reg) +// +// Parameters +// fd : file descriptor obtained from RPI_I2CSetup +// reg: integer register to read data from +// +// Description +// This function reads an 8-bit value from the device register indicated. +// +// Examples +// RPI_I2CReadReg8(13,0x40) +// See also +// RPI_i2cdetect, RPI_I2CRead, RPI_I2CReadReg16, RPI_I2CWrite, RPI_I2CWriteReg8, RPI_I2CWriteReg16, RPI_I2CSetupInterface, RPI_I2CSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CR2#2#"+string(fd)+"#"+string(reg)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetup.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetup.sci new file mode 100755 index 00000000..801c2e6d --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetup.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 out=RPI_I2CSetup(addr) +// Function to initialize the I2C system +// +// Calling Sequence +// fd=RPI_I2CSetup(addr) +// +// Parameters +// addr: integer, the I2C number of the device obtained using RPI_i2cdetect +// +// Description +// This initialises the I2C system with your given device identifier. The addr is the I2C number of the device and obtained using RPI_i2cdetect program. The function works out the Raspberry Pi revision and opens the appropriate device in /dev. +// +//The return value is the standard Linux filehandle, or -1 if any error – in which case, errno can be consulted as usual. +// +// Examples +// fd=RPI_I2CSetup(64) +// See also +// RPI_i2cdetect, RPI_I2CRead, RPI_I2CReadReg8, RPI_I2CReadReg16, RPI_I2CWrite, RPI_I2CWriteReg8, RPI_I2CWriteReg16, RPI_I2CSetupInterface +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CSe#1#"+string(addr)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetupInterface.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetupInterface.sci new file mode 100755 index 00000000..fed4f059 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CSetupInterface.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_I2CSetupInterface(device,addr) +// Function to select different I2C interfaces +// +// Calling Sequence +// I2CSetupInterface(device,addr) +// +// Parameters +// device: device +// addr : the I2C number of the device obtained using RPI_i2cdetect +// +// Description +// This feature is not implemented currently, and will be used to select different I2C interfaces if the RPi ever receives them. +// +// Examples +// I2CSetupInterface(1,0x48) +// See also +// RPI_i2cdetect, RPI_I2CRead, RPI_I2CReadReg8, RPI_I2CReadReg16, RPI_I2CWrite, RPI_I2CWriteReg8, RPI_I2CWriteReg16, RPI_I2CSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CSI#2#"+string(device)+"#"+string(addr)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWrite.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWrite.sci new file mode 100755 index 00000000..854b3b26 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWrite.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_I2CWrite(fd,data) +// Function to write to device +// +// Calling Sequence +// RPI_I2CWrite(fd,data) +// +// Parameters +// fd : file descriptor obtained from RPI_I2CSetup +// data: integer data to write to device +// +// Description +// Function for simple device write. Some devices accept data this way without needing to access any internal registers. +// +// Examples +// RPI_I2CWrite(13,100) +// See also +// RPI_i2cdetect, RPI_I2CRead, RPI_I2CReadReg8, RPI_I2CReadReg16, RPI_I2CWriteReg8, RPI_I2CWriteReg16, RPI_I2CSetupInterface, RPI_I2CSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CW1#2#"+string(fd)+"#"+string(data)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg16.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg16.sci new file mode 100755 index 00000000..b2e8fb69 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg16.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_I2CWriteReg16(fd,reg,data) +// Function to write 16-bit data to register +// +// Calling Sequence +// RPI_I2CWriteReg16(fd,reg,data) +// +// Parameters +// fd : file descriptor obtained from RPI_I2CSetup +// reg : integer register to write data at +// data: integer data to write to device +// +// Description +// This function writes a 16-bit data value into the device register indicated. +// +// Examples +// RPI_I2CWriteReg16(13,0x40,100) +// See also +// RPI_i2cdetect, RPI_I2CRead, RPI_I2CReadReg8, RPI_I2CReadReg16, RPI_I2CWrite, RPI_I2CWriteReg8, RPI_I2CSetupInterface, RPI_I2CSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CW3#3#"+string(fd)+"#"+string(reg)+"#"+string(data)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg8.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg8.sci new file mode 100755 index 00000000..19c81570 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_I2CWriteReg8.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_I2CWriteReg8(fd,reg,data) +// Function to write 8-bit data to register +// +// Calling Sequence +// RPI_I2CWriteReg8(fd,reg,data) +// +// Parameters +// fd : file descriptor obtained from RPI_I2CSetup +// reg : integer register to write data at +// data: integer data to write to device +// +// Description +// This function writes an 8-bit data value into the device register indicated. +// +// Examples +// RPI_I2CWriteReg8(13,0x40,100) +// See also +// RPI_i2cdetect, RPI_I2CRead, RPI_I2CReadReg8, RPI_I2CReadReg16, RPI_I2CWrite, RPI_I2CWriteReg16, RPI_I2CSetupInterface, RPI_I2CSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="CW2#3#"+string(fd)+"#"+string(reg)+"#"+string(data)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_i2cdetect.sci b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_i2cdetect.sci new file mode 100755 index 00000000..a37bc4cb --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/RPI_i2cdetect.sci @@ -0,0 +1,38 @@ +// Copyright (C) 2017 - 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 out=RPI_i2cdetect() +// Function to get the address of attached i2c device +// +// Calling Sequence +// RPI_i2cdetect() +// +// Description +// This function returns the address of the i2c device connected to the Raspberry pi. +// +// Examples +// addr=RPI_i2cdetect() +// See also +// RPI_I2CRead, RPI_I2CSetup, RPI_I2CReadReg8, RPI_I2CReadReg16, RPI_I2CSetupInterface, RPI_I2CWrite, RPI_I2CWriteReg8, RPI_I2CWriteReg16 +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + rev=RPI_boardRev(); + commande="i2c#1#i2cdetect -y "+string(strtod(rev)-1)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/I2C/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/I2C/names b/2.3-1/macros/Hardware/RasberryPi/I2C/names new file mode 100755 index 00000000..5a318865 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/I2C/names @@ -0,0 +1,9 @@ +RPI_I2CRead +RPI_I2CReadReg16 +RPI_I2CReadReg8 +RPI_I2CSetup +RPI_I2CSetupInterface +RPI_I2CWrite +RPI_I2CWriteReg16 +RPI_I2CWriteReg8 +RPI_i2cdetect diff --git a/2.3-1/macros/Hardware/RasberryPi/Interrupt/RPI_waitForInterrupt.sci b/2.3-1/macros/Hardware/RasberryPi/Interrupt/RPI_waitForInterrupt.sci new file mode 100755 index 00000000..bb180420 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Interrupt/RPI_waitForInterrupt.sci @@ -0,0 +1,45 @@ +// Copyright (C) 2017 - 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 out=RPI_waitForInterrupt(pin,timeOut) +// Function to set a pin to wait for interrupt. +// +// Calling Sequence +// i=RPI_waitForInterrupt(pin,timeOut) +// +// Parameters +// pin : The pin to check for interrupt. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// timeOut: The time (in milliseconds) for which to wait for interrupt. -1 to wait forever. +// +// Description +// When called, it will wait for an interrupt event to happen on that pin and the program will be stalled. The return value is -1 if an error occurred (and errno will be set appropriately), 0 if it timed out, or 1 on a successful interrupt event. +// +// Before using RPI_waitForInterrupt, first initialise the GPIO pin and at present the only way to do this is to use the gpio program, either in a script, or using the system() call from inside the program. +// Eg: To wait for a falling-edge interrupt on GPIO pin 0, setup the hardware using (before running the program): +// gpio edge 0 falling +// +// Examples +// i=RPI_waitForInterrupt(0,5000) +// See also +// +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Int#2#"+string(pin)+"#"+string(timeOut)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Interrupt/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Interrupt/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Interrupt/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Interrupt/names b/2.3-1/macros/Hardware/RasberryPi/Interrupt/names new file mode 100755 index 00000000..248c3e24 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Interrupt/names @@ -0,0 +1 @@ +RPI_waitForInterrupt diff --git a/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_boardRev.sci b/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_boardRev.sci new file mode 100755 index 00000000..91ddb333 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_boardRev.sci @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - 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 out=RPI_boardRev() +// Function to print the board revision. +// +// Calling Sequence +// rev=RPI_boardRev() +// +// Description +// This function returns the board revision of the Raspberry Pi. Returns either 1 or 2. +// +// Examples +// rev=RPI_boardRev() +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="bRv#0#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_padDrive.sci b/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_padDrive.sci new file mode 100755 index 00000000..f2d0b177 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_padDrive.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_padDrive(Group,value) +// Function to set the 'strength' of the pad drivers for a particular group of pins +// +// Calling Sequence +// RPI_padDrive(Group,value) +// +// Parameters +// Group: the group to act on, a number from 0 to 2 +// Value: the strength, from 0 to 7, to set for the group +// +// Description +// This sets the “strength” of the pad drivers for a particular group of pins. There are 3 groups of pins and the drive strength is from 0 to 7. Do not use this unless you know what you are doing +// +// Examples +// RPI_padDrive(0,5) +// See also +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pDr#2#"+string(Group)+"#"+string(value)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_sn3218Setup.sci b/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_sn3218Setup.sci new file mode 100755 index 00000000..0791c506 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Misc/RPI_sn3218Setup.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_sn3218Setup(pinBase) +// Function for setting up SN3218 I2C based LED controller. +// +// Calling Sequence +// RPI_sn3218Setup(pinBase) +// +// Parameters +// pinBase: any number above 64. The consecutive 18 pins will be allocated alongwith. +// +// Description +// This function sets up the extension module for the SN3218 I2C based LED controller.There is no I2C device address passed into the setup function – the SN3218 has a fixed I2C address of 0x54, so there’s no need to refer to it other than internally inside the driver. This also means that only one device can be connected to a Raspberry Pi. +// +// Examples +// RPI_sn3218Setup(67) +// See also +// RPI_sr595Setup, RPI_pcf8574Setup, RPI_pcf8591Setup, RPI_mcp23008Setup, RPI_mcp23016Setup, RPI_mcp23017Setup, RPI_mcp23s08Setup, RPI_mcp23s17Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sn3#1#"+string(pinBase)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Misc/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Misc/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Misc/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Misc/names b/2.3-1/macros/Hardware/RasberryPi/Misc/names new file mode 100755 index 00000000..35a4a425 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Misc/names @@ -0,0 +1,3 @@ +RPI_boardRev +RPI_padDrive +RPI_sn3218Setup diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_DelayMicro.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_DelayMicro.sci deleted file mode 100644 index bbb0bb3b..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_DelayMicro.sci +++ /dev/null @@ -1,38 +0,0 @@ -// 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 RPI_DelayMicro(time) -// Function to insert some delay in code execution. -// -// Calling Sequence -// RPI_DelayMicro(time) -// -// Parameters -// time: time(microseconds) for which execution is to be delayed -// -// Description -// this function can be used for insertig execution delays. 'time' should be -// specified in microseconds.'time' should be between (1-65536). -// Note: Delay inserted by this function is not accurate, but depedent on -// operating system, other running tasks etc. -// -// Examples -// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. -// -// See also -// RPI_DelayMicro -// -// -// Authors -// Siddhesh Wani -// - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_DelayMilli.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_DelayMilli.sci deleted file mode 100644 index 13b79625..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_DelayMilli.sci +++ /dev/null @@ -1,39 +0,0 @@ -// 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 RPI_DelayMilli(time) -// Function to insert some delay in milli seconds in code execution. -// -// Calling Sequence -// RPI_DelayMilli(time) -// -// Parameters -// time: time(milliseconds) for which execution is to be delayed -// -// Description -// This function can be used for insertig execution delays. 'time' should be -// specified in milliseconds. If more resolution is required, use 'RPI_DelayMicro' -// for inserting delay in microseconds. -// Note: Delay inserted by this function is not accurate, but depedent on -// operating system, other running tasks etc. -// -// Examples -// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. -// -// See also -// RPI_DelayMicro -// -// -// Authors -// Siddhesh Wani -// - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalIn.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalIn.sci deleted file mode 100644 index 781c49c8..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalIn.sci +++ /dev/null @@ -1,43 +0,0 @@ -// 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 state = RPI_DigitalIn(pin) -// Function to read current state on digital pins. -// -// Calling Sequence -// state = RPI_DigitalIn(pin) -// -// Parameters -// pin : pin of RPi to be used -// state : current state of the pin (0 -> LOW, 1 -> HIGH) -// -// Description -// This fucntion is used for reading the current state on gpio pins of RPi. 'RPI_DigitalSetup' function must be called before this for setting up pin as input. 'pin' must be specified from list given. 'state' specifies the input state (0 -> Low, 1-> High) -// Examples -// RPI_DigitalIn(RPI_GPIO_P1_03) //Reads the state of pin 3 of header P1. -// -// See also -// RPI_DigitalSetup RPI_DigitalOut -// -// -// 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,27,28,29,... - 31,31,33,35,36,37,38,40]; - -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 -state = 1; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalOut.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalOut.sci deleted file mode 100644 index dde3c934..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalOut.sci +++ /dev/null @@ -1,44 +0,0 @@ -// 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 RPI_DigitalOut(pin, state) -// Function to output desired state on digital pins. -// -// Calling Sequence -// RPI_DigitalOut(pin, state) -// -// Parameters -// pin : pin of RPi to be used -// state : desired state of the pin (0 -> LOW, 1 -> HIGH) -// -// Description -// This fucntion is used for outputting the desired state on gpio pins of RPi. 'RPI_DigitalSetup' function must be called before this for setting up pin as output. 'pin' must be specified from list given. 'state' specifies the output state (0 -> Low, 1-> High) -// Examples -// RPI_DigitalOut(RPI_GPIO_P1_03,0) //Changes the state of pin 3 of header P1 as 'Low'. -// -// See also -// RPI_DigitalSetup RPI_DigitalIn -// -// -// 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,27,28,29,... - 31,31,33,35,36,37,38,40]; - -PinIsGPIO = members(pin, supported_pins); //Check if output 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 -state = 1; - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci deleted file mode 100644 index 01d6e07d..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci +++ /dev/null @@ -1,36 +0,0 @@ -function RPI_DigitalSetup(pin, direction) -// Function to setup digital pins. -// -// Calling Sequence -// RPI_DigitalSetup(pin,direction) -// -// Parameters -// pin : pin of RPi to be used -// direction : direction to be set for pin -// 0 -> INPUT, 1 -> OUTPUT, 2->PWM 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(3,0) //Sets pin 3 of header P1 as input -// -// See also -// RPI_DigitalIn RPI_DigitalOut -// -// -// 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,27,28,29,... - 31,31,33,35,36,37,38,40]; - -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 -state = 1; - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.sci deleted file mode 100644 index 6c4db57a..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.sci +++ /dev/null @@ -1,39 +0,0 @@ -// 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 Micros = RPI_GetMicros() -// Function to get time in Microsecond since first setup function called. -// -// Calling Sequence -// Micros = RPI_GetMicros() -// -// Parameters -// Micros: time in Microseconds since first setup function called -// -// Description -// This function can be used to get time since first setup function called. -// Note: To use this function atleast one setup function must be called. -// -// Examples -// start = RPI_GetMicros() -// RPI_DelayMicro(1000) //This will delay the execution of next code by 100 ms. -// end = RPI_GetMicros() -// delay = end- start //This should be approximately 1000 us. -// -// See also -// RPI_GetMillis RPI_DelayMilli RPI_DelayMicro -// -// -// Authors -// Siddhesh Wani -// - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -Micros = 0; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.sci deleted file mode 100644 index c034a705..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.sci +++ /dev/null @@ -1,39 +0,0 @@ -// 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 Millis = RPI_GetMillis() -// Function to get time in millisecond since first setup function called. -// -// Calling Sequence -// Millis = RPI_GetMillis() -// -// Parameters -// Millis: time in milliseconds since first setup function called -// -// Description -// This function can be used to get time since first setup function called. -// Note: To use this function atleast one setup function must be called. -// -// Examples -// start = RPI_GetMillis() -// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. -// end = RPI_GetMillis() -// delay = end- start //This should be approximately 100ms. -// -// See also -// RPI_GetMicros RPI_DelayMilli RPI_DelayMicro -// -// -// Authors -// Siddhesh Wani -// - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -Millis = 0; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetClock.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetClock.sci deleted file mode 100644 index 8448d364..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetClock.sci +++ /dev/null @@ -1,35 +0,0 @@ -// 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 RPI_HardPWMSetClock(clock_divisor) -// Function to set PWM clock. PWM clock frequency is 19.2MHz, which can be reduced -// using suitable clock_divisor (1 to 2048, powers of 2) -// -// Calling Sequence -// RPI_HardPWMSetClock(clock_divisor) -// -// Parameters -// clock_divisor: Value can be from 1 to 2048, powers of 2. -// Description -// This function decides pwm clock. -// PWM frequency = (PWM Clock frequency/Clock divisor/range) -// PWM clock frequency = 19.2 MHz -// clock divisor is setup using RPI_HardPWMSetClock -// range is setup using RPI_HardPWMSetRange -// Examples -// -// See also -// RPI_HardPWMSetWrite RPI_HardPWMSetRange -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetMode.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetMode.sci deleted file mode 100644 index 57b82601..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetMode.sci +++ /dev/null @@ -1,32 +0,0 @@ -// 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 RPI_HardPWMSetMode(pwm_mode) -// Function to set PWM mode. Two modes are available - balanced and mark/space -// -// Calling Sequence -// RPI_HardPWMSetMode(pwm_mode) -// -// Parameters -// pwm_mode: decides pwm mode -// 0 -> balanced -// 1 -> mark/space -// Description -// This function decides pwm mode -// Examples -// -// See also -// RPI_HardPWMSetWrite RPI_HardPWMSetRange -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetRange.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetRange.sci deleted file mode 100644 index c2075e2d..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMSetRange.sci +++ /dev/null @@ -1,35 +0,0 @@ -// 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 RPI_HardPWMSetRange(range_val) -// Function to set range value for PWM. Range value along with clock divisor -// decides pwm frequency. Range value must be less than 1024 -// -// Calling Sequence -// RPI_HardPWMSetRange(range_val) -// -// Parameters -// range_val: range for pwm -// Description -// This function decides range for pwm. -// PWM frequency = (PWM Clock frequency/Clock divisor/range) -// PWM clock frequency = 19.2 MHz -// clock divisor is setup using RPI_HardPWMSetClock -// range is setup using RPI_HardPWMSetRange -// Examples -// -// See also -// RPI_HardPWMSetClock RPI_HardPWMWrite -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMWrite.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMWrite.sci deleted file mode 100644 index dba5e674..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_HardPWMWrite.sci +++ /dev/null @@ -1,39 +0,0 @@ -// 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 RPI_HardPWMWrite(pin,value) -// Function to change pwm duty on specified pin. Hardware PWM is available -// only on pin 12. So, only '12' should be provided as pin -// -// Calling Sequence -// RPI_HardPWMWrite(12,512) //Value must be smaller than the range set -// using RPI_HARDPWMSetRange -// -// Parameters -// pin: pin no on which pwm value is to be changed. Currently only 12 is allowed -// value: pwm value for given pin. This must be less than range value set -// Description -// This function changes pwm duty on specified pin. As for RPi, only one pin -// (pin 12) is available for hardware PWM. -// PWM frequency = (PWM Clock frequency/Clock divisor/range) -// PWM clock frequency = 19.2 MHz -// clock divisor is setup using RPI_HardPWMSetClock -// range is setup using RPI_HardPWMSetRange -// Actual PWM duty = value/range -// Examples -// -// See also -// RPI_HardPWMSetClock RPI_HardPWMSetRange -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.sci deleted file mode 100644 index c2354c1f..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.sci +++ /dev/null @@ -1,56 +0,0 @@ -// 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 RPI_PinISR(pin, edgetype, fn) -// Function to assign a function to be run when an interrupt occurs on -// specified pin. -// -// Calling Sequence -// RPI_PinISR(pin, edgetype, fn) -// -// Parameters -// pin : pin whose interrupt is to be configured -// edgetype: edge on which interrupt is to be monitored -// 1 -> Falling egde -// 2 -> Rising egde -// 3 -> Both egde -// fn: name of the function to be executed on interrupt occurance -// Description -// This functions monitors interrupt on specified pin for specified edge, -// When that interrupt occurs, function specified by 'fn' is executed. -// Examples -// RPI_PinISR(12, 0, Pin12ISR) //executes 'Pin12ISR' on falling edge on -// pin 12 -// See also -// RPI_ThreadCreate RPI_DigitalSetup -// -// -// 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,27,28,29,... - 31,31,33,35,36,37,38,40]; - -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 -EdgeTypeSupported = members(edgetype,[1 2 3]); - -if(EdgeTypeSupported == 0) - error(9999, 'SCI2CERROR: Given edgetype is incorrect. Please specify correct edgetype from [1,2,3]') -end - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialClose.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialClose.sci deleted file mode 100644 index f27dd432..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialClose.sci +++ /dev/null @@ -1,33 +0,0 @@ -// 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 RPI_SerialClose(fd) -// Function to close serial port specified by file descriptor. -// -// Calling Sequence -// RPI_SerialClose(fd) -// -// Parameters -// fd : file descriptor for opened port -// Description -// This functions closes the specified serial port -// Examples -// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' -// RPI_SerialClose(serial1) -// See also -// RPI_SerialOpen RPI_SerialSendChar -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialFlush.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialFlush.sci deleted file mode 100644 index 9bab386f..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialFlush.sci +++ /dev/null @@ -1,34 +0,0 @@ -// 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 data = RPI_SerialGetChar(fd) -// Function to read data from specified serial port -// -// Calling Sequence -// RPI_SerialGetCharfd) -// -// Parameters -// fd: file descriptor returned when serial port was opened -// Description -// This functions reads character form specified port. In case no -// character is available, -1 is returned after 10 sec. -// Examples -// serial = RPI_SetupSerial("/dev/ttyAMA0", 9600); -// RPI_SerialFlush(serial); -// bytes = RPI_SerialDataAvail(serial); -// -// See also -// RPI_SetupSerial RPI_SendData -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci deleted file mode 100644 index a26e5b97..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci +++ /dev/null @@ -1,36 +0,0 @@ -// 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 data = RPI_SerialGetChar(fd) -// Function to read data from specified serial port -// -// Calling Sequence -// RPI_SerialGetChar(fd) -// -// Parameters -// fd: file descriptor returned when serial port was opened -// Description -// This functions reads character form specified port. In case no -// character is available, -1 is returned after 10 sec. -// Examples -// serial = RPI_SetupSerial("/dev/ttyAMA0", 9600); -// bytes = RPI_SerialDataAvail(serial); -// if(bytes>0) -// data = RPI_SerialGetChar(serial) //Reads single character -// end -// See also -// RPI_SetupSerial RPI_SendData -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -data = 0; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci deleted file mode 100644 index 769b21d2..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci +++ /dev/null @@ -1,37 +0,0 @@ -// 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 RPI_SerialSendChar(fd, data) -// Function to send 8-bit char through serial port. -// -// Calling Sequence -// RPI_SerialSendChar(fd, data) -// -// Parameters -// fd : file descriptor for opened port -// data: 8-bit character data to be sent -// Description -// This functions sends input 8-bit character data on specified serial port -// Examples -// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' -// RPI_SerialSendChar(serial1, 'H'); -// RPI_SerialSendChar(serial1, 'i'); -// RPI_SerialClose(serial1); -// -// See also -// RPI_SerialOpen RPI_SerialClose -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendData.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendData.sci deleted file mode 100644 index c05852b1..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendData.sci +++ /dev/null @@ -1,38 +0,0 @@ -// 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 RPI_SerialSendData(fd, data) -// Function to send data through serial port. Data can be of any datatype and -// can be scalar or matrix -// -// Calling Sequence -// RPI_SerialSendData(fd, data) -// -// Parameters -// fd : file descriptor for opened port -// data: data to be sent -// Description -// This functions sends input data on specified serial port -// Examples -// A = [2 3; 4 5] -// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' -// RPI_SerialSendData(serial1, A); -// RPI_SerialClose(serial1); -// -// See also -// RPI_SerialOpen RPI_SerialClose -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSetup.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSetup.sci deleted file mode 100644 index 0f266610..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSetup.sci +++ /dev/null @@ -1,36 +0,0 @@ -// 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 fd = RPI_SerialSetup(port, baudrate) -// Function to setup serial port. -// -// Calling Sequence -// RPI_SerialSetup(port, baudrate) -// -// Parameters -// port : port of RPi to be used (eg. ) -// direction : direction to be set for pin (0 -> INPUT, 1 -> OUTPUT) -// fd : file descriptor for opened port, -1 for error -// Description -// This functions opens the specified serial port and returns file descriptor -// for the same -// Examples -// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' -// -// See also -// RPI_SerialClose RPI_SerialSendChar -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -fd = 0; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_adress.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_adress.sci new file mode 100755 index 00000000..4c9aa7f0 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_adress.sci @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - 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 + +global RPI_piAdress; +function RPI_adress(adress) + // Function for non-ssh connection to raspberry pi + // + // Calling Sequence + // RPI_adress(adress) + // + // Parameters + // address : Network address of the raspberry pi. Eg:192.168.137.214 + // + // Description + // This program is required for the functioning of the remaining toolbox if the server is manually run by the user. + // + // Examples + // RPI_adress('10.42.0.82') + // See also + // raspi,raspi_close + // + // Authors + // Jorawar Singh + + global RPI_piAdress; + RPI_piAdress=adress; +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIDataRW.sci b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIDataRW.sci new file mode 100755 index 00000000..186e68ff --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIDataRW.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_SPIDataRW(channel,data,len) +// Function to perform simultaneous read-write on SPI +// +// Calling Sequence +// RPI_SPIDataRW(channel,data,len) +// +// Parameters +// channel: channel number, 0 or 1 +// data : data to write as list of integers +// len : length of the data +// +// Description +// This performs a simultaneous write/read transaction over the selected SPI bus. Data that was in your buffer is overwritten by data returned from the SPI bus. +// +// Examples +// RPI_SPIDataRW(0,[13,58],2) +// See also +// RPI_SPISetup, RPI_SPISetupMode, RPI_SPIGetFd +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="SPD#3#"+string(channel)+"#"+string(data)+"#"+string(len)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIGetFd.sci b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIGetFd.sci new file mode 100755 index 00000000..43cfc098 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPIGetFd.sci @@ -0,0 +1,39 @@ +// Copyright (C) 2017 - 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 out=RPI_SPIGetFd(channel) +// +// Calling Sequence +// RPI_SPIGetFd(channel) +// +// Parameters +// channel: channel number, 0 or 1 +// +// Description +// +// +// Examples +// RPI_SPIGetFd(1) +// See also +// RPI_SPIDataRW, RPI_SPISetup, RPI_SPISetupMode +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="SPG#1#"+string(channel)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetup.sci b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetup.sci new file mode 100755 index 00000000..5654cf9b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetup.sci @@ -0,0 +1,43 @@ +// Copyright (C) 2017 - 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 RPI_SPISetup(channel,speed) +// Function to initialize SPI +// +// Calling Sequence +// RPI_SPISetup(channel,spped) +// +// Parameters +// channel: channel number, 0 or 1 +// speed : SPI clock speed in Hz +// +// Description +// This function initialises a channel (The Pi has 2 channels; 0 and 1). The speed parameter is an integer in the range 500,000 through 32,000,000 and represents the SPI clock speed in Hz. +// +//The returned value is the Linux file-descriptor for the device, or -1 on error. +// +// Examples +// RPI_SPISetup(1,500000) +// See also +// RPI_SPIDataRW, RPI_SPISetupMode, RPI_SPIGetFd +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="SPS#2#"+string(channel)+"#"+string(speed)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetupMode.sci b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetupMode.sci new file mode 100755 index 00000000..fec785ab --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/SPI/RPI_SPISetupMode.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_SPISetupMode(channel,speed,Mode) +// Function to initialize SPI +// +// Calling Sequence +// RPI_SPISetupMode(channel,spped,Mode) +// +// Parameters +// channel: channel number, 0 or 1 +// speed : SPI clock speed in Hz +// Mode : integer, mode to set +// +// Description +// +// Examples +// RPI_SPISetupMode(1,500000,2) +// See also +// RPI_SPIDataRW, RPI_SPISetup, RPI_SPIGetFd +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="SPM#23#"+string(channel)+"#"+string(speed)+"#"+string(Mode)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/SPI/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/SPI/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/SPI/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/SPI/names b/2.3-1/macros/Hardware/RasberryPi/SPI/names new file mode 100755 index 00000000..6f458a7e --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/SPI/names @@ -0,0 +1,4 @@ +RPI_SPIDataRW +RPI_SPIGetFd +RPI_SPISetup +RPI_SPISetupMode diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialClose.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialClose.sci new file mode 100755 index 00000000..6f54b655 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialClose.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_serialClose(fd) +// Function to close and open serial device +// +// Calling Sequence +// RPI_serialClose(fd) +// +// Parameters +// fd: file-descriptor obtained from RPI_serialOpen function +// +// Description +// This function closes the device identified by the file descriptor given. +// +// Examples +// RPI_serialClose(13) +// See also +// RPI_serialOpen, RPI_serialFlush, RPI_serialPutchar, RPI_serialPuts, RPI_serialPrintf, RPI_serialDataAvail, RPI_serialGetchar +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sCl#1#"+string(fd)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialDataAvail.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialDataAvail.sci new file mode 100755 index 00000000..9421e5b4 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialDataAvail.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_serialDataAvail(fd) +// Function to get number of readable character from the serial device +// +// Calling Sequence +// RPI_serialDataAvail(fd) +// +// Parameters +// fd: file-descriptor obtained from RPI_serialOpen function +// +// Description +// Returns the number of characters available for reading, or -1 for any error condition, in which case error number will be set appropriately. +// +// Examples +// RPI_serialDataAvail(13) +// See also +// RPI_serialOpen, RPI_serialClose, RPI_serialFlush, RPI_serialPutchar, RPI_serialPuts, RPI_serialPrintf, RPI_serialGetchar +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sDA#1#"+string(fd)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialFlush.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialFlush.sci new file mode 100755 index 00000000..845f70b3 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialFlush.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_serialFlush(fd) +// Function to discard all data to/from the serial device +// +// Calling Sequence +// RPI_serialFlush(fd) +// +// Parameters +// fd: file-descriptor obtained from RPI_serialOpen function +// +// Description +// This function discards all data received, or waiting to be send down the given device. +// +// Examples +// RPI_serialFlush(13) +// See also +// RPI_serialOpen, RPI_serialClose, RPI_serialPutchar, RPI_serialPuts, RPI_serialPrintf, RPI_serialDataAvail, RPI_serialGetchar +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sFl#1#"+string(fd)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialGetchar.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialGetchar.sci new file mode 100755 index 00000000..327fe356 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialGetchar.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_serialGetchar(fd) +// Function to get next character from serial device +// +// Calling Sequence +// RPI_serialGetchar(fd) +// +// Parameters +// fd: file-descriptor obtained from RPI_serialOpen function +// +// Description +// This function returns the next character available on the serial device. This call will block for up to 10 seconds if no data is available (when it will return -1). +// +// Examples +// RPI_serialGetchar(13) +// See also +// RPI_serialOpen, RPI_serialClose, RPI_serialFlush, RPI_serialPutchar, RPI_serialPuts, RPI_serialPrintf, RPI_serialDataAvail +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sGc#1#"+string(fd)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialOpen.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialOpen.sci new file mode 100755 index 00000000..684a6f20 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialOpen.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_serialOpen(device,baud) +// Function to initialize a serial device +// +// Calling Sequence +// RPI_serialOpen(device,baud) +// +// Parameters +// device: device to connect to +// baud : the baud rate for communication +// +// Description +// This function opens and initialises the serial device and sets the baud rate. It sets the port into “raw” mode (character at a time and no translations), and sets the read timeout to 10 seconds. The return value is the file descriptor or -1 for any error, in which case errno will be set as appropriate. +// +// Examples +// RPI_serialOpen("/dev/ttyAMA0", 9600) +// See also +// RPI_serialClose, RPI_serialFlush, RPI_serialPutchar, RPI_serialPuts, RPI_serialPrintf, RPI_serialDataAvail, RPI_serialGetchar +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sOp#2#"+string(device)+"#"+string(baud)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPrintf.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPrintf.sci new file mode 100755 index 00000000..668a9fff --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPrintf.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_serialPrintf(fd,msg) +// Function to print to serial device +// +// Calling Sequence +// RPI_serialPrintf(fd,msg) +// +// Parameters +// fd : file-descriptor obtained from RPI_serialOpen function +// msg: message to print +// +// Description +// This function emulates the system printf function to the serial device. +// +// Examples +// RPI_serialPrintf(13,'White Collar rocks') +// See also +// RPI_serialOpen, RPI_serialClose, RPI_serialFlush, RPI_serialPutchar, RPI_serialPuts, RPI_serialDataAvail, RPI_serialGetchar +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sPf#2#"+string(fd)+"#"+string(msg)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPutchar.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPutchar.sci new file mode 100755 index 00000000..ceea556c --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPutchar.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_serialPutchar(fd,character) +// Function to send a single byte to the serial device +// +// Calling Sequence +// RPI_serialPutchar(fd,character) +// +// Parameters +// fd : file-descriptor obtained from RPI_serialOpen function +// character: character to send to the serial device +// +// Description +// This function sends the single byte to the serial device identified by the given file descriptor. +// +// Examples +// RPI_serialPutchar(113,'s') +// See also +// RPI_serialOpen, RPI_serialClose, RPI_serialFlush, RPI_serialPuts, RPI_serialPrintf, RPI_serialDataAvail, RPI_serialGetchar +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sPc#2#"+string(fd)+"#"+string(character)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPuts.sci b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPuts.sci new file mode 100755 index 00000000..ecbbe057 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/RPI_serialPuts.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_serialPuts(fd,s) +// Function to send a null-terminalted string +// +// Calling Sequence +// RPI_serialPuts(fd,s) +// +// Parameters +// fd: file-descriptor obtained from RPI_serialOpen function +// s : string to send +// +// Description +// Sends the nul-terminated string to the serial device identified by the given file descriptor. +// +// Examples +// RPI_serialPuts(13,'Believe it, Dattebayo!\0') +// See also +// RPI_serialOpen, RPI_serialClose, RPI_serialFlush, RPI_serialPutchar, RPI_serialPrintf, RPI_serialDataAvail, RPI_serialGetchar +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sPs#2#"+string(fd)+"#"+string(s)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Serial/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Serial/names b/2.3-1/macros/Hardware/RasberryPi/Serial/names new file mode 100755 index 00000000..a652727e --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Serial/names @@ -0,0 +1,8 @@ +RPI_serialClose +RPI_serialDataAvail +RPI_serialFlush +RPI_serialGetchar +RPI_serialOpen +RPI_serialPrintf +RPI_serialPutchar +RPI_serialPuts diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_getAlt.sci b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_getAlt.sci new file mode 100755 index 00000000..ba3d204f --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_getAlt.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_getAlt(pin) +// Function to get the current mode of pin +// +// Calling Sequence +// s=RPI_getAlt(pin) +// +// Parameters +// pin: The pin number to read the voltage from. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// +// Description +// This function returns the current mode of the pin. Output will be 0 for INPUT, 1 for OUTPUT, 2 for PWM_OUT and 3 for CLOCK. +// +// Examples +// s=RPI_getAlt(0) +// See also +// RPI_pinNumbering, RPI_pinModeAlt +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="gAt#1#"+string(pin)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinMode.sci b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinMode.sci new file mode 100755 index 00000000..b6f52e61 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinMode.sci @@ -0,0 +1,60 @@ +// Copyright (C) 2017 - 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 RPI_pinMode(pin,Mode) +// Function to set the mode of the given pin. +// +// Calling Sequence +// RPI_pinMode(pin,Mode) +// +// Parameters +// pin : The pin number to act on. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// Mode: The mode in which to set the pin. +// +// Description +// This function configures the Raspberry Pi's given pin to work as the given mode (input/output/pwm/clock). Not all functions are available to all the pins. +// +// Mode can take the following values- +// +// 'in' -> sets the pin as input +// 'out' -> sets the pin as output +// 'pwm' -> sets the pin to PWM output. Only wiringPi pin 1 (BCM_GPIO pin 18) supports this function. +// 'clock' -> sets the pin to CLOCK output. Only wiringPi pin 7 (BCM_GPIO pin 4) supports this function. +// +// +// Examples +// RPI_pinMode(0,'out') +// See also +// RPI_pinNumbering +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + if Mode=='in' then + commande="pnM#2#"+string(pin)+"#0#"; + elseif Mode=='out' then + commande="pnM#2#"+string(pin)+"#1#"; + elseif Mode=='pwm' then + commande="pnM#2#"+string(pin)+"#2#"; + elseif Mode=='clock' then + commande="pnM#2#"+string(pin)+"#3#"; + else + error("Mode should be one of ""in/out/pwm/clock/soft_pwm/soft_tone/pwm_tone""."); + end + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinModeAlt.sci b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinModeAlt.sci new file mode 100755 index 00000000..dd0fa101 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinModeAlt.sci @@ -0,0 +1,55 @@ +// Copyright (C) 2017 - 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 RPI_pinModeAlt(pin,ALTMode) +// Function to set the current mode of pin +// +// Calling Sequence +// RPI_pinModeAlt(pin,ALTMode) +// +// Parameters +// pin : The pin number to read the voltage from. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// ALTMode: integer, from 0 to 7 +// +// Description +// This function sets the mode of the pin to either of the general GPIO (also set through RPI_pinMode function) or the alternatives available (not accessible through RPI_pinMode function). +// +// ALTMode can take the following values: +// +// 0 : Input +// 1 : Output +// 2 : ALT5 +// 3 : ALT4 +// 4 : ALT0 +// 5 : ALT1 +// 6 : ALT2 +// 7 : ALT3 +// +// +//The list of Alternate functions of all the pins can be found on page 102 of the official documentation: https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf +// +// Examples +// RPI_pinModeAlt(1,2) +// See also +// RPI_pinMode, RPI_pinNumbering, RPI_getAlt +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pMA#2#"+string(pin)+"#"+string(ALTMode)+"#"; + if getos()=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinNumbering.sci b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinNumbering.sci new file mode 100755 index 00000000..4716de80 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pinNumbering.sci @@ -0,0 +1,54 @@ +// Copyright (C) 2017 - 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 out=RPI_pinNumbering(pinSetup) +// Function to initialize wiringpi with the number sequence to be followed. +// +// Calling Sequence +// RPI_pinNumbering(pinSetup) +// +// Parameters +// pinSetup: The pin number sequence to follow +// +// Description +// This function must be called at the start of the program or the program will fail to work correctly. It tells the wiringpi which number sequence will be used to work on Raspberry Pi. Returns 0 if no errors encountered. Pin maps for the different pinSetups can be found at the link in bibliography. +// +// pinSetup can take the following values: +// +// 'wiringpi' -> This initialises wiringPi and assumes that the calling program is going to be using the wiringPi pin numbering scheme. This is a simplified numbering scheme which provides a mapping from virtual pin numbers to the real underlying Broadcom GPIO pin numbers. +// 'GPIO' -> Same as above, however it allows the calling programs to use the Broadcom GPIO pin numbers directly with no re-mapping. +// 'phys' -> Identical to above, however it allows the calling programs to use the physical pin numbers on the P1 connector only. +// +// +// Examples +// RPI_pinNumbering('wiringpi') +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + if (pinSetup=='wiringpi') then + commande="pN0#0#"; + elseif (pinSetup=='GPIO') then + commande="pN1#0#"; + elseif (pinSetup=='sys') then + commande="pN2#0#"; + elseif (pinSetup=='phys') then + commande="pN3#0#"; + else + error("pinSetup should be one of wiringpi/GPIO/sys/phys"); + end + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pullControl.sci b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pullControl.sci new file mode 100755 index 00000000..6354bf55 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Setup/RPI_pullControl.sci @@ -0,0 +1,60 @@ +// Copyright (C) 2017 - 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 RPI_pullControl(pin,RMode) +// Function to change the internal pull up/down resistor setting for a given pin. +// +// Calling Sequence +// RPI_pullControl(pin,RMode) +// +// Parameters +// pin : The pin number to act on. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// RMode: The mode for the internal resistance of the given pin. +// +// Description +// This sets the pull-up or pull-down resistor mode on the given pin, which should be set as an input using the PRI_pinMode function. The internal pull up/down +// resistors have a value of approximately 50KΩ on the Raspberry Pi. +// +// RMode can take values: +// +// 'up' -> pull to 3.3v +// 'down'-> pull to ground +// 'none'-> no pull up/down +// +// +// This function has no effect on the Raspberry Pi’s GPIO pins when in sys mode, set using RPI_pinNumbering function. To activate a pull-up/pull-down, use the gpio +// program in a script before starting the program. +// +// Examples +// RPI_pullControl(0,'down') +// See also +// RPI_pinNumbering, RPI_pinMode +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + if RMode=='up' then + commande="plC#2#"+string(pin)+"#2#"; + elseif RMode=='down' then + commande="plC#2#"+string(pin)+"#1#"; + elseif RMode=='none' then + commande="plC#2#"+string(pin)+"#0#"; + else + error("mode should be one of up/down/none"); + end + if getos()=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Setup/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Setup/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Setup/names b/2.3-1/macros/Hardware/RasberryPi/Setup/names new file mode 100755 index 00000000..38954982 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Setup/names @@ -0,0 +1,5 @@ +RPI_getAlt +RPI_pinMode +RPI_pinModeAlt +RPI_pinNumbering +RPI_pullControl diff --git a/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftIn.sci b/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftIn.sci new file mode 100755 index 00000000..2bdb89b8 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftIn.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_shiftIn(dpin,cpin,order) +// Function to shift 8-bit value appearing on dpin +// +// Calling Sequence +// RPI_shiftIn(dpin,cpin,order) +// +// Parameters +// dpin : datapin +// cpin : clockpin +// order: integer, 0 (LSB first) or 1 (MSB first) +// +// Description +// This shifts an 8-bit data value in with the data appearing on the dPin and the clock being sent out on the cPin. Order is either LSBFIRST or MSBFIRST. The data is sampled after the cPin goes high. (So cPin high, sample data, cPin low, repeat for 8 bits) The 8-bit value is returned by the function. +// +// Examples +// RPI_shiftIn(0,2,0) +// See also +// RPI_shiftOut +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="shI#3#"+string(dpin)+"#"+string(cpin)+"#"+string(order)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftOut.sci b/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftOut.sci new file mode 100755 index 00000000..c3485609 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_shiftOut.sci @@ -0,0 +1,43 @@ +// Copyright (C) 2017 - 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 RPI_shiftOut(dpin,cpin,order,val) +// Function to shift out 8-bit data with value=val +// +// Calling Sequence +// RPI_shiftOut(dpin,cpin,order,val) +// +// Parameters +// dpin : datapin +// cpin : clockpin +// order: integer, 0 (LSB first) or 1 (MSB first) +// val : integer, data to send +// +// Description +// The shifts an 8-bit data value val out with the data being sent out on dPin and the clock being sent out on the cPin. order is as above. Data is clocked out on the rising or falling edge – ie. dPin is set, then cPin is taken high then low – repeated for the 8 bits. +// +// Examples +// RPI_shiftOut(1,2,0,123) +// See also +// RPI_shiftIn +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="shO#4#"+string(dpin)+"#"+string(cpin)+"#"+string(order)+"#"+string(val)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_sr595Setup.sci b/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_sr595Setup.sci new file mode 100755 index 00000000..fb77f988 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Shift/RPI_sr595Setup.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - 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 RPI_sr595Setup(pinBase,numPins,dataPin,clockPin,latchPin) +// Function to setup sr5595 shift register chips +// +// Calling Sequence +// RPI_sr595Setup(pinBase,numPins,dataPin,clockPin,latchPin) +// +// Parameters +// pinBase : any number above 64. Consecutive number of numPins will be allocated alongwith. +// numPins : number of pins, can be 0-32, 8 pins per 74x595 +// dataPin : The Raspberry pin corresponding to the 74x595's data pin. Numbering sequence to be followed as initiated by RPI_pinNumbering function. +// clockPin: The Raspberry pin corresponding to the 74x595's clock pin. Numbering sequence to be followed as initiated by RPI_pinNumbering function. +// latchPin: The Raspberry pin corresponding to the 74x595's latch pin. Numbering sequence to be followed as initiated by RPI_pinNumbering function. +// +// Description +// This function sets up the extension module for the 74×595 shift register chips which can be used as general purpose output ports. Each instance can support up to 4 74×595’s daisy-chained together, giving a 32-bit output port using just 3 GPIO wires from the Raspberry Pi (or from any other GPIO expansion port connected to the Pi) One can have as many instances of these enabled in the system, provided there are 3 spare GPIO pins per instance. +// +// Examples +// RPI_sr595Setup(100,10,0,1,2) +// See also +// RPI_sn3218Setup, RPI_pcf8574Setup, RPI_pcf8591Setup, RPI_mcp23008Setup, RPI_mcp23016Setup, RPI_mcp23017Setup, RPI_mcp23s08Setup, RPI_mcp23s17Setup, RPI_pinNumbering +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sr5#5#"+string(pinBase)+"#"+string(numPins)+"#"+string(dataPin)+"#"+string(clockPin)+"#"+string(latchPin)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Shift/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Shift/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Shift/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Shift/names b/2.3-1/macros/Hardware/RasberryPi/Shift/names new file mode 100755 index 00000000..3fc17b6b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Shift/names @@ -0,0 +1,3 @@ +RPI_shiftIn +RPI_shiftOut +RPI_sr595Setup diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmCreate.sci b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmCreate.sci new file mode 100755 index 00000000..b0161c25 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmCreate.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - 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 out=RPI_softPwmCreate(pin,ival,pwmrange) +// Function to set up software pwm on a given pin +// +// Calling Sequence +// RPI_softPwmCreate(pin,ival,pwmrange) +// +// Parameters +// pin : pin to start software pwm on. Numbering sequence to follow as initiated using RPI_pinNumbering function +// ival : inital value +// pwmrange: range for the pwm +// +// Description +// This function creates a software controlled PWM pin. Any GPIO pin can be used. Using 100 for the range, the value can be anything from 0 (off) to 100 (fully on) for the given pin. +// +//The return value is 0 for success. Otherwise the global error number variable should be checked to see what went wrong. +// +// Examples +// RPI_softPwmCreate(1,25,250) +// See also +// RPI_softPwmStop, RPI_softPwmWrite, RPI_softToneCreate, RPI_softToneStop, RPI_softToneWrite, RPI_pinNumbering, RPI_softServoWrite, RIP_softServoSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sPC#3#"+string(pin)+"#"+string(ival)+"#"+string(pwmrange)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmStop.sci b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmStop.sci new file mode 100755 index 00000000..5a911c8b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmStop.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_softPwmStop(pin) +// Function to stop the software pwm on the pin +// +// Calling Sequence +// RPI_softPwmStop(pin) +// +// Parameters +// pin: pin to stop. Numbering sequence to follow as initiated using RPI_pinNumbering +// +// Description +// This function stops the software pwm on the specified pin. +// +// Examples +// RPI_softPwmStop(1) +// See also +// RPI_softPwmWrite, RPI_softToneCreate, RPI_softToneStop, RPI_softToneWrite, RPI_softPwmCreate, RPI_pinNumbering, RPI_softServoWrite, RIP_softServoSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sPS#1#"+string(pin)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmWrite.sci b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmWrite.sci new file mode 100755 index 00000000..349923fa --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softPwmWrite.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_softPwmWrite(pin,value) +// Function to update the softpwm value on the pin +// +// Calling Sequence +// RPI_softPwmWrite(pin,value) +// +// Parameters +// pin : pin to act on, should be initialised using RPI_softPwmCreate. Numbering sequence follows from_RPI pinNumbering +// value: value to write +// +// Description +// This updates the PWM value on the given pin. The value is checked to be in-range and pins that haven’t previously been initialised via softPwmCreate will be silently ignored. +// +// Examples +// RPI_softPwmWrite(1,250) +// See also +// RPI_softPwmStop, RPI_softToneCreate, RPI_softToneStop, RPI_softToneWrite, RPI_softPwmCreate, RPI_pinNumbering, RPI_softServoWrite, RIP_softServoSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sPW#2#"+string(pin)+"#"+string(value)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneCreate.sci b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneCreate.sci new file mode 100755 index 00000000..06adf83e --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneCreate.sci @@ -0,0 +1,43 @@ +// Copyright (C) 2017 - 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 RPI_softToneCreate(pin) +// Function to create a software controlled tone pin +// +// Calling Sequence +// RPI_softToneCreate(pin) +// +// Parameters +// pin: pin to create software tone on. Numbering sequence to be followed as initiated using RPI_pinNumbering +// +// Description +// This function creates a software controlled tone pin. Any GPIO pin can be used. Using 100 for the range, the value can be anything from 0 (off) to 100 (fully on) for the given pin. +// +//The return value is 0 for success. Otherwise the global error number variable should be checked to see what went wrong. +// +// +// Examples +// RPI_softToneCreate(1) +// See also +// RPI_softPwmStop, RPI_softPwmWrite, RPI_softToneStop, RPI_softToneWrite, RPI_softPwmCreate, RPI_pinNumbering, RPI_softServoWrite, RIP_softServoSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sTC#1#"+string(pin)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneStop.sci b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneStop.sci new file mode 100755 index 00000000..4ecc4208 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneStop.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_softToneStop(pin) +// Function to stop the software tone on the pin +// +// Calling Sequence +// RPI_softToneStop(pin) +// +// Parameters +// pin: soft tone pin to stop. Numbering sequence to follow as initiated using RPI_pinNumbering +// +// Description +// This function stops the software tone on the specified pin. +// +// Examples +// RPI_softToneStop(1) +// See also +// RPI_softPwmStop, RPI_softPwmWrite, RPI_softToneCreate, RPI_softToneWrite, RPI_softPwmCreate, RPI_pinNumbering, RPI_softServoWrite, RIP_softServoSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sTS#1#"+string(pin)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneWrite.sci b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneWrite.sci new file mode 100755 index 00000000..ba070a82 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/RPI_softToneWrite.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_softToneWrite(pin,freq) +// Function to update tone frquency on the soft tone pin +// +// Calling Sequence +// RPI_softToneWrite(pin,freq) +// +// Parameters +// pin : soft tone pin +// freq: frequency value to write +// +// Description +// This function updates the tone frequency value on the given pin. The tone will be played until you set the frequency to 0. +// +// Examples +// RPI_softToneWrite(1,200) +// See also +// RPI_softPwmStop, RPI_softPwmWrite, RPI_softToneCreate, RPI_softToneStop, RPI_softPwmCreate, RPI_softServoWrite, RIP_softServoSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="sTW#2#"+string(pin)+"#"+string(freq)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Soft/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Soft/names b/2.3-1/macros/Hardware/RasberryPi/Soft/names new file mode 100755 index 00000000..da06cbb5 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Soft/names @@ -0,0 +1,6 @@ +RPI_softPwmCreate +RPI_softPwmStop +RPI_softPwmWrite +RPI_softToneCreate +RPI_softToneStop +RPI_softToneWrite diff --git a/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delay.sci b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delay.sci new file mode 100755 index 00000000..bd868e80 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delay.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_delay(time) +// Function to introduce delay in milliseconds +// +// Calling Sequence +// RPI_delay(time) +// +// Parameters +// time: Time in milliseconds for which to pause the program execution. +// +// Description +// This causes program execution to pause for at least 'time' milliseconds. Due to the multi-tasking nature of Linux it could be longer. The maximum delay is an unsigned 32-bit integer or approximately 49 days. +// +// Examples +// RPI_delay(1000) +// See also +// RPI_delayMicro, RPI_micros, RPI_millis +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="deS#1#"+string(time)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delayMicro.sci b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delayMicro.sci new file mode 100755 index 00000000..a1b5d595 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_delayMicro.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_delayMicro(time) +// Function to introduce delay in microseconds +// +// Calling Sequence +// RPI_delayMicros(time) +// +// Parameters +// time: Time in microseconds for which to pause the program execution. +// +// Description +// This causes program execution to pause for at least 'time' microseconds. Due to the multi-tasking nature of Linux it could be longer. The maximum delay is an unsigned 32-bit integer or approximately 71 minutes. +// +// Examples +// RPI_delayMicro(1000) +// See also +// RPI_delay, RPI_micros, RPI_millis +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="deU#1#"+string(time)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_micros.sci b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_micros.sci new file mode 100755 index 00000000..058a8278 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_micros.sci @@ -0,0 +1,37 @@ +// Copyright (C) 2017 - 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 out=RPI_micros() +// Function to display the number of microseconds since the call to RPI_pinNumbering function. +// +// Calling Sequence +// t=RPI_micros() +// +// Description +// This returns the time in milliseconds since the call to RPI_pinNumbering function. It returns an unsigned 32-bit integer which wraps after approximately 71 minutes. +// +// Examples +// t=RPI_micros() +// See also +// RPI_millis, RPI_delay, RPI_delayMicro +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="mic#0#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_millis.sci b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_millis.sci new file mode 100755 index 00000000..baecddc2 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Timing/RPI_millis.sci @@ -0,0 +1,37 @@ +// Copyright (C) 2017 - 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 out=RPI_millis() +// Function to display the number of milliseconds since the call to RPI_pinNumbering function. +// +// Calling Sequence +// t=RPI_millis() +// +// Description +// This returns the time in microseconds since the call to RPI_pinNumbering function. It returns an unsigned 32-bit integer which wraps after 49 days. +// +// Examples +// t=RPI_millis() +// See also +// RPI_micros, RPI_delay, RPI_delayMicro +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="mil#0#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/Timing/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/Timing/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Timing/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/Timing/names b/2.3-1/macros/Hardware/RasberryPi/Timing/names new file mode 100755 index 00000000..0b47b345 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/Timing/names @@ -0,0 +1,4 @@ +RPI_delay +RPI_delayMicro +RPI_micros +RPI_millis diff --git a/2.3-1/macros/Hardware/RasberryPi/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/buildmacros.sce old mode 100644 new mode 100755 index 2954a424..07b564e3 --- a/2.3-1/macros/Hardware/RasberryPi/buildmacros.sce +++ b/2.3-1/macros/Hardware/RasberryPi/buildmacros.sce @@ -1,4 +1,49 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in -tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); +RPI_Directories = [ "Digital", ... + "gertBoard", ... + "I2C", ... + "Interrupt", ... + "lcd", ... + "lcd128x64", ... + "mcp", ... + "Misc", ... + "pcf", ... + "piGlow", ... + "pinMap", ... + "pwm", ... + "Serial", ... + "Setup", ... + "Shift", ... + "Soft", ... + "SPI", ... + "Timing"]; + +RPI_path_buildmacros = get_absolute_file_path("buildmacros.sce"); -clear tbx_build_macros; +for H=1:size(RPI_Directories,"*") + myfile = RPI_path_buildmacros + filesep() + RPI_Directories(H) + filesep() + "buildmacros.sce"; + if isfile(myfile) then + exec(myfile); + end +end + +clear RPI_path_buildmacros; + +function buildmacros() + macros_path = get_absolute_file_path("buildmacros.sce"); + tbx_build_macros(TOOLBOX_NAME, macros_path); + clear tbx_build_macros; +endfunction + +buildmacros(); +clear buildmacros; diff --git a/2.3-1/macros/Hardware/RasberryPi/cleanmacros.sce b/2.3-1/macros/Hardware/RasberryPi/cleanmacros.sce new file mode 100755 index 00000000..a6428b2a --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/cleanmacros.sce @@ -0,0 +1,20 @@ +// ==================================================================== +// This file is released under the 3-clause BSD license. See COPYING-BSD. +// ==================================================================== +function cleanmacros() + + libpath = get_absolute_file_path("cleanmacros.sce"); + + binfiles = ls(libpath+"/*.bin"); + for i = 1:size(binfiles,"*") + mdelete(binfiles(i)); + end + + mdelete(libpath+"/names"); + mdelete(libpath+"/lib"); +endfunction + +cleanmacros(); +clear cleanmacros; // remove cleanmacros on stack + +// ==================================================================== diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogRead.sci b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogRead.sci new file mode 100755 index 00000000..41bf877a --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogRead.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_analogRead(pin) +// Function to read the analog voltage at the given pin +// +// Calling Sequence +// v=RPI_analogRead(pin) +// +// Parameters +// pin: The pin number to read the voltage from. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// +// Description +// This function returns the value read on the supplied analog input pin. Additional analog modules need to be registered to enable this function for devices such as the Gertboard, quick2Wire analog board, etc. +// +// Examples +// v=RPI_analogRead(0) +// See also +// RPI_analogWrite, RPI_digitalRead, RPI_digitalWrite, RPI_pinNumbering, RPI_pinMode +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="anR#1#"+string(pin)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogWrite.sci b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogWrite.sci new file mode 100755 index 00000000..f7089f53 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_analogWrite.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_analogWrite(pin,Volt) +// Function to set analog voltage at given analog pin. +// +// Calling Sequence +// RPI_analogWrite(pin,Volt) +// +// Parameters +// pin : The pin number to set the voltage at. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// Volt: The analog voltage value to set at the pin. +// +// Description +// This writes the given value to the supplied analog pin. Additional analog modules need to be registered to enable this function for devices such as the Gertboard. +// +// Examples +// RPI_analogWrite(0,100) +// See also +// RPI_analogRead, RPI_digitalRead, RPI_digitalWrite, RPI_pinNumbering, RPI_pinMode +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="anW#2#"+string(pin)+"#"+string(Volt)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogRead.sci b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogRead.sci new file mode 100755 index 00000000..ce7e870e --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogRead.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 out=RPI_gertboardAnalogRead(pin) +// Function to read voltage from gertboard +// +// Calling Sequence +// RPI_gertboardAnalogRead(pin) +// +// Parameters +// pin:the pin to read the voltage from. Numbering follows the pinBase from RPI_gertboardSetup function. +// +// Description +// After initialinzing the pinBase using the RPI_gertboeardSetup function, reading channel pinBase + 0 reads the first analog input channel (pin DA0 on the Gertboard). Returns a value from 0 to 1023 representing the value on the supplied pin. +// +// Examples +// RPI_gertboardAnalogRead(101) +// See also +// RPI_gertboardAnalogSetup, RPI_gertboardAnalogWrite, RPI_gertboardSPISetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ +// http://pi4j.com/apidocs/com/pi4j/wiringpi/Gertboard.html + + commande="gAR#1#"+string(pin)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction + diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogSetup.sci b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogSetup.sci new file mode 100755 index 00000000..a8348110 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogSetup.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_gertboardAnalogSetup(pinBase) +// Function to setup the gertboard +// +// Calling Sequence +// RPI_getboardAnalogSetup(pinBase) +// +// Parameters +// pinBase:the base pin that the analog ports will appear as +// +// Description +// This function calls a setup routine that allocates 2 pins and overlays the analog to digital input pins with the digital to analog output pins. pinBase is the base pin that you want the analog ports to appear as. So reading channel pinBase + 0 reads the first analog input channel (pin DA0 on the Gertboard), and writing pinBase + 0 outputs to the first analog output channel. (Pin AD0) +// +// Examples +// RPI_getboardAnalogSetup(100) +// See also +// RPI_gertboardAnalogRead, RPI_gertboardAnalogWrite, RPI_gertboardSPISetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ +// http://pi4j.com/apidocs/com/pi4j/wiringpi/Gertboard.html + + commande="gAS#1#"+string(pinBase)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogWrite.sci b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogWrite.sci new file mode 100755 index 00000000..3f8f9dd6 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardAnalogWrite.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_gertboardAnalogWrite(pin,value) +// Function to write voltage value to pins on gertboard +// +// Calling Sequence +// RPI_gertboardAnalogWrite(pin,value) +// +// Parameters +// pin : the pin to read the voltage from. Numbering follows the pinBase from RPI_gertboardSetup function. +// value: voltage value to write +// +// Description +// After initialinzing the pinBase using the RPI_gertboeardSetup function, writing pinBase + 0 outputs to the first analog output channel. (Pin AD0). +// +// Examples +// RPI_gertboardAnalogWrite(100,100) +// See also +// RPI_gertboardAnalogSetup, RPI_gertboardAnalogRead, RPI_gertboardSPISetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ +// http://pi4j.com/apidocs/com/pi4j/wiringpi/Gertboard.html + + commande="gAW#2#"+string(pin)+"#"+string(value)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardSPISetup.sci b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardSPISetup.sci new file mode 100755 index 00000000..d4117b00 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/RPI_gertboardSPISetup.sci @@ -0,0 +1,39 @@ +// Copyright (C) 2017 - 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 RPI_gertboardSPISetup() +// Function to initialize SPI bus communication with gertboard +// +// Calling Sequence +// RPI_gertboardSPIsetup() +// +// Description +// This function must be called to initialize the SPI bus to communicate with the Gertboards ADC and DAC chips. +// +// Examples +// RPI_gertboardSPISetup() +// See also +// RPI_gertboardAnalogSetup, RPI_gertboardAnalogRead, RPI_gertboardAnalogWrite +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ +// http://pi4j.com/apidocs/com/pi4j/wiringpi/Gertboard.html + + commande="gSS#0#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction + diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/gertBoard/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/gertBoard/names b/2.3-1/macros/Hardware/RasberryPi/gertBoard/names new file mode 100755 index 00000000..27a469a1 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/gertBoard/names @@ -0,0 +1,6 @@ +RPI_analogRead +RPI_analogWrite +RPI_gertboardAnalogRead +RPI_gertboardAnalogSetup +RPI_gertboardAnalogWrite +RPI_gertboardSPISetup diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCharDef.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCharDef.sci new file mode 100755 index 00000000..905cca84 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCharDef.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - 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 RPI_lcdCharDef(fd,index,d0,d1,d2,d3,d4,d5,d6,d7) +// Function to redefine a user-definable character +// +// Calling Sequence +// RPI_lcdCharDef(fd,index,data) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// index: which character to redefine (0 to 7) +// d0-d7: integers from 0 to 255 erpresenting the elements of the array to form the character +// +// Description +// This function re-define one of the 8 user-definable characters in the display. +// +// The data array is 8 bytes which represent the character from the top-line to the bottom line. Note that the characters are actually 5×8, so only the lower 5 bits are used. +// +// Examples +// RPI_lcdCharDef(13,0,0,0,0,31,31,31,31,0) +// See also +// RPI_lcdCursorBlink, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lCD#10#"+string(fd)+"#"+string(index)+"#"+string(d0)+"#"+string(d1)+"#"+string(d2)+"#"+string(d3)+"#"+string(d4)+"#"+string(d5)+"#"+string(d6)+"#"+string(d7)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdClear.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdClear.sci new file mode 100755 index 00000000..6da7212d --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdClear.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_lcdClear(fd) +// Function to clear the lcd screen +// +// Calling Sequence +// RPI_lcdClear(fd) +// +// Parameters +// fd: file-descriptor obtained using RPI_lcdInit function +// +// Description +// This function clears the lcd screen. +// +// Examples +// RPI_lcdClear(13) +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lCl#1#"+string(fd)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursor.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursor.sci new file mode 100755 index 00000000..98c54712 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursor.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_lcdCursor(fd,state) +// Function to turn cursor on/off +// +// Calling Sequence +// RPI_lcdCursor(fd,state) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// state: 0 (for off) or 1 (for on) +// +// Description +// This function sets the visibility of cursor. +// +// Examples +// RPI_lcdCursor(13,1) +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lCu#2#"+string(fd)+"#"+string(state)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursorBlink.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursorBlink.sci new file mode 100755 index 00000000..b16ebc50 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdCursorBlink.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_lcdCursorBlink(fd,state) +// Function to turn cursor blinking on/off +// +// Calling Sequence +// RPI_lcdCursorBlink(fd,state) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// state: 0 (for off) or 1 (for on) +// +// Description +// This function sets the blinking of cursor. +// +// Examples +// RPI_lcdCursorBlink(13,1) +// See also +// RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lCB#2#"+string(fd)+"#"+string(state)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdDisplay.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdDisplay.sci new file mode 100755 index 00000000..de50af64 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdDisplay.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_lcdDisplay(fd,state) +// Function to turn display on/off +// +// Calling Sequence +// RPI_lcdDisplay(fd,state) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// state: 0 (for off) or 1 (for on) +// +// Description +// This function turns the display 'on' or 'off'. +// +// Examples +// RPI_lcdDisplay(13,1) +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lDs#2#"+string(fd)+"#"+string(state)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdHome.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdHome.sci new file mode 100755 index 00000000..0c4507f1 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdHome.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_lcdHome(fd) +// Function to send cursor back to the starting point (home) +// +// Calling Sequence +// RPI_lcdHome(fd) +// +// Parameters +// fd: file-descriptor obtained using RPI_lcdInit function +// +// Description +// This function sends the cursor to the top left (row=0,col=0) position on the lcd screen. +// +// Examples +// RPI_lcdHome(13) +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lHo#1#"+string(fd)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdInit.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdInit.sci new file mode 100755 index 00000000..c5ddb1e5 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdInit.sci @@ -0,0 +1,54 @@ +// Copyright (C) 2017 - 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 out=RPI_lcdInit(rows,cols,bits,rs,strb,d0,d1,d2,d3,d4,d5,d6,d7) +// Function to initialize lcd +// +// Calling Sequence +// RPI_lcdInit(rows,cols,bits,rs,strb,d0,d1,d2,d3,d4,d5,d6,d7) +// +// Parameters +// rows: numer of rows in lcd +// cols: numer of colums in lcd +// bits: number of bits wide on the interface (4 or 8) +// rs : pin number of display RS +// strb: pin number of strobe (E) +// d0 : pin number of data pin 1 +// d1 : pin number of data pin 2 +// d2 : pin number of data pin 3 +// d3 : pin number of data pin 4 +// d4 : pin number of data pin 5 +// d5 : pin number of data pin 6 +// d6 : pin number of data pin 7 +// d7 : pin number of data pin 8 +// +// Description +// This function initalizes an lcd display attaced to the Raspberry pi. The return value is the file-descriptor to be used for all subsequent calls to the lcd library when dealing with that LCD, or -1 to indicate a fault. (Usually incorrect parameters) +// +// The numberin sequence to be followed as initiated using RPI_pinNumbering +// +// Examples +// fd=RPI_lcdInit (2,16,8,11,10,0,1,2,3,4,5,6,7) ; +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand, RPI_pinNumbering +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lIn#13#"+string(rows)+"#"+string(cols)+"#"+string(bits)+"#"+string(rs)+"#"+string(strb)+"#"+string(d0)+"#"+string(d1)+"#"+string(d2)+"#"+string(d3)+"#"+string(d4)+"#"+string(d5)+"#"+string(d6)+"#"+string(d7)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPosition.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPosition.sci new file mode 100755 index 00000000..0f978324 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPosition.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_lcdPosition(fd,col,row) +// Function to move the cursor +// +// Calling Sequence +// RPI_lcdPosition(fd,col,row) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// col: column number to go to +// row: row number to go to +// +// Description +// This function set the position of the cursor for subsequent text entry. col=0 is the left-most edge any row=0 is the top line. +// +// Examples +// RPI_lcdPosition(13,0,1) +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lPo#3#"+string(fd)+"#"+string(col)+"#"+string(row)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPrintf.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPrintf.sci new file mode 100755 index 00000000..833bf44a --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPrintf.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_lcdPrintf(fd,String) +// Function to print on the lcd screen +// +// Calling Sequence +// RPI_lcdPrintf(fd,String) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// String: string to print on the screen +// +// Description +// This function outputs a single ASCII character, a string or a formatted string using the usual printf formatting commands. +// +// Examples +// RPI_lcdPrintf(13,'We live in the shadows to serve the light.') +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lPf#2#"+string(fd)+"#"+String+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPutchar.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPutchar.sci new file mode 100755 index 00000000..337691d8 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPutchar.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_lcdPutchar(fd,character) +// Function to print on the lcd screen +// +// Calling Sequence +// RPI_lcdPutchar(fd,charcter) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// charcter: integer, 0 to 255, character to print +// +// Description +// This function outputs a single ASCII character, a string or a formatted string using the usual printf formatting commands. +// +// Examples +// RPI_lcdPutchar(13,200) +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lPc#2#"+string(fd)+"#"+string(character)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPuts.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPuts.sci new file mode 100755 index 00000000..8584309d --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdPuts.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_lcdPuts(fd,character) +// Function to print on the lcd screen +// +// Calling Sequence +// RPI_lcdPuts(fd,character) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// character: character to print +// +// Description +// This function outputs a single ASCII character, a string or a formatted string using the usual printf formatting commands. +// +// Examples +// RPI_lcdPuts(13,'K') +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lPu#2#"+string(fd)+"#"+string(character)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction + diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdSendCommand.sci b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdSendCommand.sci new file mode 100755 index 00000000..db677bef --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/RPI_lcdSendCommand.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_lcdSendCommand(fd,command) +// Function to send command to lcd +// +// Calling Sequence +// RPI_lcdSendCommand(fd,command) +// +// Parameters +// fd : file-descriptor obtained using RPI_lcdInit function +// command: A command, binary, to submit to the LCD. +// +// Description +// This function sends any arbitrary command to the LCD. +// +// Examples +// RPI_lcdSendCommand(13,00) +// See also +// RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdHome, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="lSC#2#"+string(fd)+"#"+string(command)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/lcd/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd/names b/2.3-1/macros/Hardware/RasberryPi/lcd/names new file mode 100755 index 00000000..8f87ff8b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd/names @@ -0,0 +1,12 @@ +RPI_lcdCharDef +RPI_lcdClear +RPI_lcdCursor +RPI_lcdCursorBlink +RPI_lcdDisplay +RPI_lcdHome +RPI_lcdInit +RPI_lcdPosition +RPI_lcdPrintf +RPI_lcdPutchar +RPI_lcdPuts +RPI_lcdSendCommand diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64Orientation.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64Orientation.sci new file mode 100755 index 00000000..5bfe4dcd --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64Orientation.sci @@ -0,0 +1,48 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64Orientation(mode) +// Function to set lcd orientation. +// +// Calling Sequence +// RPI_lcd128x64Orientation(mode) +// +// Parameters +// mode: Orientation Mode, integer from 0 to 3 +// +// Description +// This function sets the orientation of the lcd display. +// +// mode can take values: +// +// 0 :Portrait +// 1 :Landscape +// 2 :Portrait, flipped +// 3 :Landscape, flipped +// +// +// Examples +// RPI_lcd128x64Orientation(1) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="LOn#1#"+string(mode)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64circle.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64circle.sci new file mode 100755 index 00000000..96358a32 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64circle.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64circle(x,y,r,color,fill) +// Function to draw a circle +// +// Calling Sequence +// RPI_lcd128x64circle(x,y,r,color,fill) +// +// Parameters +// x : integer, x coordinate of centre +// y : integer, y coordinate of centre +// r : integer, radius of the circle +// color: integer, color of the rectangle +// fill : 0 (for empty) or 1 (for filled) +// +// Description +// This function draws a circle of radius r with x,y as centre, specified color and fill. +// +// Examples +// RPI_lcd128x64circle(3,3,2,0,0) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Lci#5#"+string(x)+"#"+string(y)+"#"+string(r)+"#"+string(color)+"#"+string(fill)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64clear.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64clear.sci new file mode 100755 index 00000000..5b800491 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64clear.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64clear(color) +// Function to clear the lcd screen +// +// Calling Sequence +// RPI_lcd128x64clear(color) +// +// Parameters +// color: integer, color of the lcd +// +// Description +// This function clears the lcd display to the given colour. +// +// Examples +// RPI_lcd128x64clear(0) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="LCl#1#"+string(color)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64ellipse.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64ellipse.sci new file mode 100755 index 00000000..b4281e61 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64ellipse.sci @@ -0,0 +1,45 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64ellipse(cx,cy,xr,yr,color,fill) +// Function to draw a ellipse +// +// Calling Sequence +// RPI_lcd128x64ellipse(cx,cy,xr,yr,color,fill) +// +// Parameters +// cx : integer, x coordinate of centre +// cy : integer, y coordinate of centre +// xr : integer, x radius +// yr : integer, y radius +// color: integer, color pf the ellipse +// fill : 0 (for empty) or 1 (for filled) +// +// Description +// This function draws an ellipse with centre at (cx,cy) x and y radii as xr and yr, specified color and fill +// +// Examples +// RPI_lcd128x64ellipse() +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Lel#6#"+string(cx)+"#"+string(cy)+"#"+string(xr)+"#"+string(yr)+"#"+string(color)+"#"+string(fill)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64line.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64line.sci new file mode 100755 index 00000000..951a6639 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64line.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64line(x0,y0,x1,y1,color) +// Function to plota line. +// +// Calling Sequence +// RPI_lcd128x64line(x0,y0,x1,y1,color) +// +// Parameters +// x0 : integer, initial x coordinate +// y0 : integer, initial y coordinate +// x1 : integer, final x coordinate +// y1 : integer, final y coordinate +// color: integer, color of the line +// +// Description +// This function plots a line from (x0,y0) to (x1,y1). +// +// Examples +// RPI_lcd128x64line(0,0,1,1,0) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Lli#5#"+string(x0)+"#"+string(y0)+"#"+string(x1)+"#"+string(y1)+"#"+string(color)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64lineTo.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64lineTo.sci new file mode 100755 index 00000000..466713eb --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64lineTo.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64lineTo(x,y,color) +// Function to plot a line +// +// Calling Sequence +// RPI_lcd128x64lineTo(x,y,color) +// +// Parameters +// x : integer, final x coordinate +// y : integer, final y coordinate +// color: integer, color of the line +// +// Description +// This function draws a line from the current position to the point (x,y) specified. +// +// Examples +// RPI_lcd128x64lineTo(2,2,0) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="LlT#3#"+string(x)+"#"+string(y)+"#"+string(color)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64point.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64point.sci new file mode 100755 index 00000000..287b022a --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64point.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64point(x,y,color) +// Function to plot a point +// +// Calling Sequence +// RPI_lcd128x64point(x,y,color) +// +// Parameters +// x : integer, x coordinate +// y : integer, y coordinate +// color: integer, color of the point +// +// Description +// This function plots a point at x,y. +// +// Examples +// RPI_lcd128x64point(2,2,0) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Lpo#3#"+string(x)+"#"+string(y)+"#"+string(color)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64putchar.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64putchar.sci new file mode 100755 index 00000000..a6b27240 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64putchar.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64putchar(x,y,c,bg,fg) +// Function to print a single character. +// +// Calling Sequence +// RPI_lcd128x64putchar(x,y,c,bg,fg) +// +// Parameters +// x : integer, x coordinate of starting point +// y : integer, y coordinate of starting point +// c : integer, from 0 to 255, character to print +// bg: integer, background color +// fg: integer, foreground color +// +// Description +// This function prints a single character to the screen. +// +// Examples +// RPI_lcd128x64putchar(0,1,128,1,0) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Lpc#5#"+string(x)+"#"+string(y)+"#"+string(c)+"#"+string(bg)+"#"+string(fg)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64puts.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64puts.sci new file mode 100755 index 00000000..6785f067 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64puts.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64puts(x,y,s,bf,fg) +// Function to send a string to the lcd display +// +// Calling Sequence +// RPI_lcd128x64puts(x,y,s,bg,fg) +// +// Parameters +// x : integer, x coordinate of starting point +// y : integer, y coordinate of starting point +// s : string to send +// bg: integer, background color +// fg: integer, foreground color +// +// Description +// This function sends a string to the display. Obeys \n and \r formatting. +// +// Examples +// RPI_lcd128x64puts(0,0,'Talos guide you',0,1) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="LPu#5#"+string(x)+"#"+string(y)+"#"+string(s)+"#"+string(bg)+"#"+string(fg)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64rectangle.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64rectangle.sci new file mode 100755 index 00000000..ccda4c62 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64rectangle.sci @@ -0,0 +1,45 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64rectangle(x1,y1,x2,y2,color,fill) +// Function to draw a rectangle +// +// Calling Sequence +// RPI_lcd128x64rectangle(x1,y1,x2,y2,color,fill) +// +// Parameters +// x1 : integer, x coordinate of upper left corner +// y1 : integer, y coordinate of upper left corner +// x2 : integer, x coordinate of lower right corner +// y2 : integer, y coordinate of lower right corner +// color: integer, color of the rectangle +// fill : 0 (for empty) or 1 (for filled) +// +// Description +// This function draws a rectangle with (x1,y1) as the upper left point and (x2,y2) as the lower right point with specified color and fill. +// +// Examples +// RPI_lcd128x64rectangle(0,0,1,1,0,1) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Lre#6#"+string(x1)+"#"+string(y1)+"#"+string(x2)+"#"+string(y2)+"#"+string(color)+"#"+string(fill)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setOrigin.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setOrigin.sci new file mode 100755 index 00000000..996b0623 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setOrigin.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_lcd128x64setOrigin(x,y) +// Function to set origin +// +// Calling Sequence +// RPI_lcd128x64setOrigin(x,y) +// +// Parameters +// x: x coordinate +// y: y coordinate +// +// Description +// This function sets the origin of the lcd display +// +// Examples +// RPI_lcd128x64setOrigin(1,0) +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="LOr#2#"+string(x)+"#"+string(y)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setup.sci b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setup.sci new file mode 100755 index 00000000..60ded7d8 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/RPI_lcd128x64setup.sci @@ -0,0 +1,37 @@ +// Copyright (C) 2017 - 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 out=RPI_lcd128x64setup() +// Function to initialize the lcd display +// +// Calling Sequence +// RPI_lcd128x64setup() +// +// Description +// This function initialises the lcd display. +// +// Examples +// RPI_lcd128x64setup() +// See also +// RPI_lcd128x64setup, RPI_lcd128x64update, RPI_lcd128x64setOrigin, RPI_lcd128x64Orientation, RPI_lcd128x64orientCoord, RPI_lcd128x64ScreenSize, RPI_lcd128x64point, RPI_lcd128x64line, RPI_lcd128x64lineTo, RPI_lcd128x64rectangle, RPI_lcd128x64circle, RPI_lcd128x64ellipse, RPI_lcd128x64putchar, RPI_lcd128x64puts, RPI_lcd128x64clear, RPI_lcdCursorBlink, RPI_lcdCharDef, RPI_lcdClear, RPI_lcdCursor, RPI_lcdDisplay, RPI_lcdInit, RPI_lcdPutchar, RPI_lcdPosition, RPI_lcdPrintf, RPI_lcdPuts, RPI_lcdSendCommand +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="Lse#0#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/lcd128x64/names b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/names new file mode 100755 index 00000000..82439718 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/lcd128x64/names @@ -0,0 +1,12 @@ +RPI_lcd128x64Orientation +RPI_lcd128x64circle +RPI_lcd128x64clear +RPI_lcd128x64ellipse +RPI_lcd128x64line +RPI_lcd128x64lineTo +RPI_lcd128x64point +RPI_lcd128x64putchar +RPI_lcd128x64puts +RPI_lcd128x64rectangle +RPI_lcd128x64setOrigin +RPI_lcd128x64setup diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23008Setup.sci b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23008Setup.sci new file mode 100755 index 00000000..03963bd1 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23008Setup.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_mcp23008Setup(pinBase,i2cAddress) +// Function for setting up 8-bit MCP23008 I2C GPIO expansion chip. +// +// Calling Sequence +// RPI_mcp23008Setup(pinBase,i2cAddress) +// +// Parameters +// pinBase : any number above 64. The consecutive 8 pins will be allocated alongwith. +// i2cAdress: integer, the I2C address obtained using RPI_i2cdetect function +// +// Description +// This function sets up the extension module for the 8-bit MCP23008 I2C GPIO expansion chip. +// +// Examples +// RPI_mcp23008Setup(73,64) +// See also +// RPI_sr595Setup, RPI_pcf8574Setup, RPI_pcf8591Setup, RPI_mcp23016Setup, RPI_mcp23017Setup, RPI_mcp23s08Setup, RPI_mcp23s17Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="mp8#2#"+string(pinBase)+"#"+string(i2cAddress)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23016Setup.sci b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23016Setup.sci new file mode 100755 index 00000000..0424616e --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23016Setup.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_mcp23016Setup(pinBase,i2cAddress) +// Function for setting up 16-bit MCP23016 I2C GPIO expansion chip. +// +// Calling Sequence +// RPI_mcp23016Setup(pinBase,i2cAddress) +// +// Parameters +// pinBase : any number above 64. The consecutive 16 pins will be allocated alongwith. +// i2cAdress: integer, the I2C address obtained using RPI_i2cdetect function +// +// Description +// This function sets up the extension module for the MCP23017 (16-bit) I2C GPIO expansion chips. The MCP23016 is the fore-runner of the MCP23017 GPIO expansion chip and may be present on some older interface boards. +// +// Examples +// RPI_mcp23016Setup(73,100) +// See also +// RPI_sr595Setup, RPI_pcf8574Setup, RPI_pcf8591Setup, RPI_mcp23008Setup, RPI_mcp23017Setup, RPI_mcp23s08Setup, RPI_mcp23s17Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="mp6#2#"+string(pinBase)+"#"+string(i2cAddress)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23017Setup.sci b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23017Setup.sci new file mode 100755 index 00000000..c453ebb3 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23017Setup.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 out=RPI_mcp23017Setup(pinBase,i2cAddress) +// Function for setting up 16-bit MCP23017 I2C GPIO expansion chip. +// +// Calling Sequence +// RPI_mcp23017Setup(pinBase,i2cAddress) +// +// Parameters +// pinBase : any number above 64. The consecutive 16 pins will be allocated alongwith. +// i2cAdress: integer, the I2C address obtained using RPI_i2cdetect function +// +// Description +// This function setups the extension module for the 16-bit MCP23017 I2C GPIO expansion chip. +// +// Examples +// RPI_mcp23017Setup(73,100) +// See also +// RPI_sr595Setup, RPI_pcf8574Setup, RPI_pcf8591Setup, RPI_mcp23008Setup, RPI_mcp23016Setup, RPI_mcp23s08Setup, RPI_mcp23s17Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="mp7#2#"+string(pinBase)+"#"+string(i2cAddress)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s08Setup.sci b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s08Setup.sci new file mode 100755 index 00000000..b5b215b6 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s08Setup.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 out=RPI_mcp23s08Setup(pinBase,spiPort,devId) +// Function for setting up 8-bit MCP23s08 SPI GPIO expansion chip. +// +// Calling Sequence +// RPI_mcp23s08Setup(pinBase,spiPort,devId) +// +// Parameters +// pinBase: any number above 64. The consecutive 8 pins will be allocated alongwith. +// spiPort: 0 or 1 for one of the two SPI ports on the Raspberry Pi. +// devId : the ID of the MCP23s08 on the SPI port. +// +// Description +// This function setups the extension module for the 8-bit MCP23s08 SPI GPIO expansion chip. +// +// Examples +// RPI_mcp23s08Setup(67,1,0) +// See also +// RPI_sr595Setup, RPI_pcf8574Setup, RPI_pcf8591Setup, RPI_mcp23008Setup, RPI_mcp23016Setup, RPI_mcp23017Setup, RPI_mcp23s17Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="ms8#3#"+string(pinBase)+"#"+string(spiPort)+"#"+string(devId)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s17Setup.sci b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s17Setup.sci new file mode 100755 index 00000000..4ba9fd65 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/mcp/RPI_mcp23s17Setup.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 out=RPI_mcp23s17Setup(pinBase,spiPort,devId) +// Function for setting up 16-bit MCP23s17 SPI GPIO expansion chip. +// +// Calling Sequence +// RPI_mcp23s17Setup(pinBase,spiPort,devId) +// +// Parameters +// pinBase: any number above 64. The consecutive 16 pins will be allocated alongwith. +// spiPort: 0 or 1 for one of the two SPI ports on the Raspberry Pi. +// devId : the ID of the MCP23s17 on the SPI port. +// +// Description +// This function setups the extension module for the 16-bit MCP23s17 SPI GPIO expansion chip. +// +// Examples +// RPI_mcp23s17Setup(67,0,0) +// See also +// RPI_sr595Setup, RPI_pcf8574Setup, RPI_pcf8591Setup, RPI_mcp23008Setup, RPI_mcp23016Setup, RPI_mcp23017Setup, RPI_mcp23s08Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="ms7#3#"+string(pinBase)+"#"+string(spiPort)+"#"+string(devId)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/mcp/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/mcp/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/mcp/names b/2.3-1/macros/Hardware/RasberryPi/mcp/names new file mode 100755 index 00000000..23e7af04 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/mcp/names @@ -0,0 +1,5 @@ +RPI_mcp23008Setup +RPI_mcp23016Setup +RPI_mcp23017Setup +RPI_mcp23s08Setup +RPI_mcp23s17Setup diff --git a/2.3-1/macros/Hardware/RasberryPi/names b/2.3-1/macros/Hardware/RasberryPi/names old mode 100644 new mode 100755 index fa647761..9f20c937 --- a/2.3-1/macros/Hardware/RasberryPi/names +++ b/2.3-1/macros/Hardware/RasberryPi/names @@ -1,21 +1,5 @@ GetRPISupportFunctions IsRPISupportFunction -RPI_DelayMicro -RPI_DelayMilli -RPI_DigitalIn -RPI_DigitalOut -RPI_DigitalSetup -RPI_GetMicros -RPI_GetMillis -RPI_HardPWMSetClock -RPI_HardPWMSetMode -RPI_HardPWMSetRange -RPI_HardPWMWrite -RPI_PinISR -RPI_SerialClose -RPI_SerialFlush -RPI_SerialGetChar -RPI_SerialSendChar -RPI_SerialSendData -RPI_SerialSetup -u16RPISerialDataAvail +RPI_adress +raspi +raspi_close diff --git a/2.3-1/macros/Hardware/RasberryPi/old/GetRPISupportFunctions.sci b/2.3-1/macros/Hardware/RasberryPi/old/GetRPISupportFunctions.sci new file mode 100644 index 00000000..3e6397b2 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/GetRPISupportFunctions.sci @@ -0,0 +1,48 @@ +function RPiSupportFunctions = GetRPISupportFunctions() +// ----------------------------------------------------------------- +// Get list of RPI peripherals supported +// +// Input data: +// None +// +// Output data: +// None +// Copyright (C) 2017 - 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 +// +// ----------------------------------------------------------------- + +RPiSupportFunctions = [ + "RPI_DigitalIn" + "RPI_DigitalOut" + "RPI_DigitalSetup" + "RPI_DelayMilli" + "RPI_DelayMicro" + "RPI_GetMillis" + "RPI_GetMicros" + "RPI_SerialSetup" + "RPI_SerialClose" + "RPI_SerialSendChar" + "RPI_SerialFlush" + "RPI_SerialGetChar" + "RPI_ThreadCreate" + "RPI_PinISR" + "RPI_HardPWMWrite" + "RPI_HardPWMSetRange" + "RPI_HardPWMSetClock" + "RPI_HardPWMSetMode" + ]; + +//Note: "RPI_SerialSendData" is removed since distinction between input data +//types is required + + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/IsRPISupportFunction.sci b/2.3-1/macros/Hardware/RasberryPi/old/IsRPISupportFunction.sci new file mode 100644 index 00000000..c6a2c365 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/IsRPISupportFunction.sci @@ -0,0 +1,32 @@ +function Output = IsRPISupportFunction(FunName) +// ----------------------------------------------------------------- +// Check whether input function name is a RPi support function or not. +// +// Input data: +// FunName: Name of the function to be checked +// +// Output data: +// Output: True or False depending whether given function is a RPi +// support functions or not +// +// Copyright (C) 2017 - 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 +// +// ----------------------------------------------------------------- + +//Get list of supported functions for AVR +RPISupportFunctions = GetRPISupportFunctions(); + +//Check whether input function is present in above list or not +FunNameInRPISupport = members(FunName,RPISupportFunctions); +Output = bool2s(FunNameInRPISupport~=0); + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMicro.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMicro.sci new file mode 100644 index 00000000..bbb0bb3b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMicro.sci @@ -0,0 +1,38 @@ +// 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 RPI_DelayMicro(time) +// Function to insert some delay in code execution. +// +// Calling Sequence +// RPI_DelayMicro(time) +// +// Parameters +// time: time(microseconds) for which execution is to be delayed +// +// Description +// this function can be used for insertig execution delays. 'time' should be +// specified in microseconds.'time' should be between (1-65536). +// Note: Delay inserted by this function is not accurate, but depedent on +// operating system, other running tasks etc. +// +// Examples +// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. +// +// See also +// RPI_DelayMicro +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMilli.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMilli.sci new file mode 100644 index 00000000..13b79625 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMilli.sci @@ -0,0 +1,39 @@ +// 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 RPI_DelayMilli(time) +// Function to insert some delay in milli seconds in code execution. +// +// Calling Sequence +// RPI_DelayMilli(time) +// +// Parameters +// time: time(milliseconds) for which execution is to be delayed +// +// Description +// This function can be used for insertig execution delays. 'time' should be +// specified in milliseconds. If more resolution is required, use 'RPI_DelayMicro' +// for inserting delay in microseconds. +// Note: Delay inserted by this function is not accurate, but depedent on +// operating system, other running tasks etc. +// +// Examples +// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. +// +// See also +// RPI_DelayMicro +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalIn.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalIn.sci new file mode 100644 index 00000000..781c49c8 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalIn.sci @@ -0,0 +1,43 @@ +// 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 state = RPI_DigitalIn(pin) +// Function to read current state on digital pins. +// +// Calling Sequence +// state = RPI_DigitalIn(pin) +// +// Parameters +// pin : pin of RPi to be used +// state : current state of the pin (0 -> LOW, 1 -> HIGH) +// +// Description +// This fucntion is used for reading the current state on gpio pins of RPi. 'RPI_DigitalSetup' function must be called before this for setting up pin as input. 'pin' must be specified from list given. 'state' specifies the input state (0 -> Low, 1-> High) +// Examples +// RPI_DigitalIn(RPI_GPIO_P1_03) //Reads the state of pin 3 of header P1. +// +// See also +// RPI_DigitalSetup RPI_DigitalOut +// +// +// 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,27,28,29,... + 31,31,33,35,36,37,38,40]; + +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 +state = 1; +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalOut.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalOut.sci new file mode 100644 index 00000000..dde3c934 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalOut.sci @@ -0,0 +1,44 @@ +// 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 RPI_DigitalOut(pin, state) +// Function to output desired state on digital pins. +// +// Calling Sequence +// RPI_DigitalOut(pin, state) +// +// Parameters +// pin : pin of RPi to be used +// state : desired state of the pin (0 -> LOW, 1 -> HIGH) +// +// Description +// This fucntion is used for outputting the desired state on gpio pins of RPi. 'RPI_DigitalSetup' function must be called before this for setting up pin as output. 'pin' must be specified from list given. 'state' specifies the output state (0 -> Low, 1-> High) +// Examples +// RPI_DigitalOut(RPI_GPIO_P1_03,0) //Changes the state of pin 3 of header P1 as 'Low'. +// +// See also +// RPI_DigitalSetup RPI_DigitalIn +// +// +// 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,27,28,29,... + 31,31,33,35,36,37,38,40]; + +PinIsGPIO = members(pin, supported_pins); //Check if output 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 +state = 1; + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalSetup.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalSetup.sci new file mode 100644 index 00000000..01d6e07d --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalSetup.sci @@ -0,0 +1,36 @@ +function RPI_DigitalSetup(pin, direction) +// Function to setup digital pins. +// +// Calling Sequence +// RPI_DigitalSetup(pin,direction) +// +// Parameters +// pin : pin of RPi to be used +// direction : direction to be set for pin +// 0 -> INPUT, 1 -> OUTPUT, 2->PWM 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(3,0) //Sets pin 3 of header P1 as input +// +// See also +// RPI_DigitalIn RPI_DigitalOut +// +// +// 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,27,28,29,... + 31,31,33,35,36,37,38,40]; + +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 +state = 1; + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMicros.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMicros.sci new file mode 100644 index 00000000..6c4db57a --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMicros.sci @@ -0,0 +1,39 @@ +// 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 Micros = RPI_GetMicros() +// Function to get time in Microsecond since first setup function called. +// +// Calling Sequence +// Micros = RPI_GetMicros() +// +// Parameters +// Micros: time in Microseconds since first setup function called +// +// Description +// This function can be used to get time since first setup function called. +// Note: To use this function atleast one setup function must be called. +// +// Examples +// start = RPI_GetMicros() +// RPI_DelayMicro(1000) //This will delay the execution of next code by 100 ms. +// end = RPI_GetMicros() +// delay = end- start //This should be approximately 1000 us. +// +// See also +// RPI_GetMillis RPI_DelayMilli RPI_DelayMicro +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +Micros = 0; +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMillis.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMillis.sci new file mode 100644 index 00000000..c034a705 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMillis.sci @@ -0,0 +1,39 @@ +// 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 Millis = RPI_GetMillis() +// Function to get time in millisecond since first setup function called. +// +// Calling Sequence +// Millis = RPI_GetMillis() +// +// Parameters +// Millis: time in milliseconds since first setup function called +// +// Description +// This function can be used to get time since first setup function called. +// Note: To use this function atleast one setup function must be called. +// +// Examples +// start = RPI_GetMillis() +// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. +// end = RPI_GetMillis() +// delay = end- start //This should be approximately 100ms. +// +// See also +// RPI_GetMicros RPI_DelayMilli RPI_DelayMicro +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +Millis = 0; +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetClock.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetClock.sci new file mode 100644 index 00000000..8448d364 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetClock.sci @@ -0,0 +1,35 @@ +// 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 RPI_HardPWMSetClock(clock_divisor) +// Function to set PWM clock. PWM clock frequency is 19.2MHz, which can be reduced +// using suitable clock_divisor (1 to 2048, powers of 2) +// +// Calling Sequence +// RPI_HardPWMSetClock(clock_divisor) +// +// Parameters +// clock_divisor: Value can be from 1 to 2048, powers of 2. +// Description +// This function decides pwm clock. +// PWM frequency = (PWM Clock frequency/Clock divisor/range) +// PWM clock frequency = 19.2 MHz +// clock divisor is setup using RPI_HardPWMSetClock +// range is setup using RPI_HardPWMSetRange +// Examples +// +// See also +// RPI_HardPWMSetWrite RPI_HardPWMSetRange +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci new file mode 100644 index 00000000..57b82601 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci @@ -0,0 +1,32 @@ +// 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 RPI_HardPWMSetMode(pwm_mode) +// Function to set PWM mode. Two modes are available - balanced and mark/space +// +// Calling Sequence +// RPI_HardPWMSetMode(pwm_mode) +// +// Parameters +// pwm_mode: decides pwm mode +// 0 -> balanced +// 1 -> mark/space +// Description +// This function decides pwm mode +// Examples +// +// See also +// RPI_HardPWMSetWrite RPI_HardPWMSetRange +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetRange.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetRange.sci new file mode 100644 index 00000000..c2075e2d --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetRange.sci @@ -0,0 +1,35 @@ +// 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 RPI_HardPWMSetRange(range_val) +// Function to set range value for PWM. Range value along with clock divisor +// decides pwm frequency. Range value must be less than 1024 +// +// Calling Sequence +// RPI_HardPWMSetRange(range_val) +// +// Parameters +// range_val: range for pwm +// Description +// This function decides range for pwm. +// PWM frequency = (PWM Clock frequency/Clock divisor/range) +// PWM clock frequency = 19.2 MHz +// clock divisor is setup using RPI_HardPWMSetClock +// range is setup using RPI_HardPWMSetRange +// Examples +// +// See also +// RPI_HardPWMSetClock RPI_HardPWMWrite +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMWrite.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMWrite.sci new file mode 100644 index 00000000..dba5e674 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMWrite.sci @@ -0,0 +1,39 @@ +// 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 RPI_HardPWMWrite(pin,value) +// Function to change pwm duty on specified pin. Hardware PWM is available +// only on pin 12. So, only '12' should be provided as pin +// +// Calling Sequence +// RPI_HardPWMWrite(12,512) //Value must be smaller than the range set +// using RPI_HARDPWMSetRange +// +// Parameters +// pin: pin no on which pwm value is to be changed. Currently only 12 is allowed +// value: pwm value for given pin. This must be less than range value set +// Description +// This function changes pwm duty on specified pin. As for RPi, only one pin +// (pin 12) is available for hardware PWM. +// PWM frequency = (PWM Clock frequency/Clock divisor/range) +// PWM clock frequency = 19.2 MHz +// clock divisor is setup using RPI_HardPWMSetClock +// range is setup using RPI_HardPWMSetRange +// Actual PWM duty = value/range +// Examples +// +// See also +// RPI_HardPWMSetClock RPI_HardPWMSetRange +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_PinISR.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_PinISR.sci new file mode 100644 index 00000000..c2354c1f --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_PinISR.sci @@ -0,0 +1,56 @@ +// 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 RPI_PinISR(pin, edgetype, fn) +// Function to assign a function to be run when an interrupt occurs on +// specified pin. +// +// Calling Sequence +// RPI_PinISR(pin, edgetype, fn) +// +// Parameters +// pin : pin whose interrupt is to be configured +// edgetype: edge on which interrupt is to be monitored +// 1 -> Falling egde +// 2 -> Rising egde +// 3 -> Both egde +// fn: name of the function to be executed on interrupt occurance +// Description +// This functions monitors interrupt on specified pin for specified edge, +// When that interrupt occurs, function specified by 'fn' is executed. +// Examples +// RPI_PinISR(12, 0, Pin12ISR) //executes 'Pin12ISR' on falling edge on +// pin 12 +// See also +// RPI_ThreadCreate RPI_DigitalSetup +// +// +// 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,27,28,29,... + 31,31,33,35,36,37,38,40]; + +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 +EdgeTypeSupported = members(edgetype,[1 2 3]); + +if(EdgeTypeSupported == 0) + error(9999, 'SCI2CERROR: Given edgetype is incorrect. Please specify correct edgetype from [1,2,3]') +end + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialClose.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialClose.sci new file mode 100644 index 00000000..f27dd432 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialClose.sci @@ -0,0 +1,33 @@ +// 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 RPI_SerialClose(fd) +// Function to close serial port specified by file descriptor. +// +// Calling Sequence +// RPI_SerialClose(fd) +// +// Parameters +// fd : file descriptor for opened port +// Description +// This functions closes the specified serial port +// Examples +// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' +// RPI_SerialClose(serial1) +// See also +// RPI_SerialOpen RPI_SerialSendChar +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialFlush.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialFlush.sci new file mode 100644 index 00000000..9bab386f --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialFlush.sci @@ -0,0 +1,34 @@ +// 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 data = RPI_SerialGetChar(fd) +// Function to read data from specified serial port +// +// Calling Sequence +// RPI_SerialGetCharfd) +// +// Parameters +// fd: file descriptor returned when serial port was opened +// Description +// This functions reads character form specified port. In case no +// character is available, -1 is returned after 10 sec. +// Examples +// serial = RPI_SetupSerial("/dev/ttyAMA0", 9600); +// RPI_SerialFlush(serial); +// bytes = RPI_SerialDataAvail(serial); +// +// See also +// RPI_SetupSerial RPI_SendData +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialGetChar.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialGetChar.sci new file mode 100644 index 00000000..a26e5b97 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialGetChar.sci @@ -0,0 +1,36 @@ +// 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 data = RPI_SerialGetChar(fd) +// Function to read data from specified serial port +// +// Calling Sequence +// RPI_SerialGetChar(fd) +// +// Parameters +// fd: file descriptor returned when serial port was opened +// Description +// This functions reads character form specified port. In case no +// character is available, -1 is returned after 10 sec. +// Examples +// serial = RPI_SetupSerial("/dev/ttyAMA0", 9600); +// bytes = RPI_SerialDataAvail(serial); +// if(bytes>0) +// data = RPI_SerialGetChar(serial) //Reads single character +// end +// See also +// RPI_SetupSerial RPI_SendData +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +data = 0; +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendChar.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendChar.sci new file mode 100644 index 00000000..769b21d2 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendChar.sci @@ -0,0 +1,37 @@ +// 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 RPI_SerialSendChar(fd, data) +// Function to send 8-bit char through serial port. +// +// Calling Sequence +// RPI_SerialSendChar(fd, data) +// +// Parameters +// fd : file descriptor for opened port +// data: 8-bit character data to be sent +// Description +// This functions sends input 8-bit character data on specified serial port +// Examples +// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' +// RPI_SerialSendChar(serial1, 'H'); +// RPI_SerialSendChar(serial1, 'i'); +// RPI_SerialClose(serial1); +// +// See also +// RPI_SerialOpen RPI_SerialClose +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendData.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendData.sci new file mode 100644 index 00000000..c05852b1 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendData.sci @@ -0,0 +1,38 @@ +// 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 RPI_SerialSendData(fd, data) +// Function to send data through serial port. Data can be of any datatype and +// can be scalar or matrix +// +// Calling Sequence +// RPI_SerialSendData(fd, data) +// +// Parameters +// fd : file descriptor for opened port +// data: data to be sent +// Description +// This functions sends input data on specified serial port +// Examples +// A = [2 3; 4 5] +// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' +// RPI_SerialSendData(serial1, A); +// RPI_SerialClose(serial1); +// +// See also +// RPI_SerialOpen RPI_SerialClose +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSetup.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSetup.sci new file mode 100644 index 00000000..0f266610 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSetup.sci @@ -0,0 +1,36 @@ +// 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 fd = RPI_SerialSetup(port, baudrate) +// Function to setup serial port. +// +// Calling Sequence +// RPI_SerialSetup(port, baudrate) +// +// Parameters +// port : port of RPi to be used (eg. ) +// direction : direction to be set for pin (0 -> INPUT, 1 -> OUTPUT) +// fd : file descriptor for opened port, -1 for error +// Description +// This functions opens the specified serial port and returns file descriptor +// for the same +// Examples +// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' +// +// See also +// RPI_SerialClose RPI_SerialSendChar +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +fd = 0; +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/old/buildmacros.sce new file mode 100644 index 00000000..2954a424 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/buildmacros.sce @@ -0,0 +1,4 @@ + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/old/names b/2.3-1/macros/Hardware/RasberryPi/old/names new file mode 100644 index 00000000..fa647761 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/names @@ -0,0 +1,21 @@ +GetRPISupportFunctions +IsRPISupportFunction +RPI_DelayMicro +RPI_DelayMilli +RPI_DigitalIn +RPI_DigitalOut +RPI_DigitalSetup +RPI_GetMicros +RPI_GetMillis +RPI_HardPWMSetClock +RPI_HardPWMSetMode +RPI_HardPWMSetRange +RPI_HardPWMWrite +RPI_PinISR +RPI_SerialClose +RPI_SerialFlush +RPI_SerialGetChar +RPI_SerialSendChar +RPI_SerialSendData +RPI_SerialSetup +u16RPISerialDataAvail diff --git a/2.3-1/macros/Hardware/RasberryPi/old/u16RPISerialDataAvail.sci b/2.3-1/macros/Hardware/RasberryPi/old/u16RPISerialDataAvail.sci new file mode 100644 index 00000000..6eb29a1c --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/old/u16RPISerialDataAvail.sci @@ -0,0 +1,37 @@ +// 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 bytes = RPI_SerialDataAvail(fd) +// Function to get number of data bytes available on serial port specified by +// file descriptor +// Calling Sequence +// RPI_SerialDataAvail(fd) +// +// Parameters +// fd : file descriptor for already opened serial port +// Description +// This functions returns number of characters available to read, +// otherwise reads -1 in case of error. This function can be used to check +// new data is available on serial port +// Examples +// serial = RPI_SerialOpen("/dev/ttyAMA0", 9600); +// charsToRead = RPI_SerialDataAvail(serial); +// See also +// RPI_SerialOpen RPI_SerialGetChar +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +bytes = 0; + +endfunction \ No newline at end of file diff --git a/2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8574Setup.sci b/2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8574Setup.sci new file mode 100755 index 00000000..f3e79429 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8574Setup.sci @@ -0,0 +1,43 @@ +// Copyright (C) 2017 - 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 RPI_pcf8574Setup(pinBase,i2cAddress) +// Function for setting up PCF8574 8-bit GPIO expander IC +// +// Calling Sequence +// RPI_pcf8574Setup(pinBase,i2cAddress) +// +// Parameters +// pinBase : any number above 64. The consecutive 8 pins will be allocated alongwith. +// i2cAddress: I2C address obtained using RPI_i2cdetect function +// +// Description +// This function sets up the extension module for the PCF8574 8-bit GPIO expander IC. Can be called multiple times for multiple PCF8574 using different pinBase for each. +// +//You don’t need to specify the number of pins here – the PCF8754 has 8 pins. +// +// Examples +// RPI_pcf8574Setup(67,100) +// See also +// RPI_pcf8591Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pf7#2#"+string(pinBase)+"#"+string(i2cAddress)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8591Setup.sci b/2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8591Setup.sci new file mode 100755 index 00000000..87054907 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pcf/RPI_pcf8591Setup.sci @@ -0,0 +1,43 @@ +// Copyright (C) 2017 - 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 RPI_pcf8591Setup(pinBase,i2cAddress) +// Function for setting up 8-bit PCF8591 Analog IO expander IC +// +// Calling Sequence +// RPI_pcf8591Setup(pinBase,i2cAddress) +// +// Parameters +// pinBase : any number above 64.The consecutive 4 pins will be allocated alongwith. +// i2cAddress: I2C address obtained using RPI_i2cdetect function +// +// Description +// This function sets up the extension module for the PCF8591 8-bit GPIO expander IC. Can be called multiple times for multiple PCF8591 using different pinBase for each. +// +//Specifying the number of pins is not necessary – the PCF8791 has 4 pins – the analog output uses base pin number 0 – the same as analog input 0. +// +// Examples +// RPI_pcf8591Setup(67,64) +// See also +// RPI_pcf8574Setup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pf9#2#"+string(pinBase)+"#"+string(i2cAddress)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pcf/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/pcf/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pcf/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/pcf/names b/2.3-1/macros/Hardware/RasberryPi/pcf/names new file mode 100755 index 00000000..3e326a01 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pcf/names @@ -0,0 +1,2 @@ +RPI_pcf8574Setup +RPI_pcf8591Setup diff --git a/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlow1.sci b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlow1.sci new file mode 100755 index 00000000..e093238c --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlow1.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_piGlow1(leg,ring,intensity) +// Function to modify a single LED on the piGlow +// +// Calling Sequence +// RPI_piGlow1(leg,ring,intensity) +// +// Parameters +// leg : leg number +// ring : ring number +// intensity: brightness from 0 (off) to 255 (full) +// +// Description +// The function modifies the brightness of the single specified LED. +// +// Examples +// RPI_piGlow1(0,0,125) +// See also +// RPI_piGlowLeg, RPI_piGlowRing, RPI_piGlowSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pG1#3#"+string(leg)+"#"+string(ring)+"#"+string(intensity)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowLeg.sci b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowLeg.sci new file mode 100755 index 00000000..d0425797 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowLeg.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_piGlowLeg(leg,intensity) +// Function to modify a full leg of LEDs on the piGlow +// +// Calling Sequence +// RPI_piGlowLeg(leg,intensity) +// +// Parameters +// leg : leg number +// intensity: brightness from 0 (off) to 255 (full) +// +// Description +// This function modifies the brightness of all the LEDs in the single specified leg of piGlow. +// +// Examples +// RPI_piGlowLeg(0,100) +// See also +// RPI_piGlow1, RPI_piGlowRing, RPI_piGlowSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pGL#2#"+string(leg)+"#"+string(intensity)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowRing.sci b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowRing.sci new file mode 100755 index 00000000..ef816205 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowRing.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_piGlowRing(ring,intensity) +// Function to modify a full ring of LEDs on the piGlow +// +// Calling Sequence +// RPI_piGlowRing(ring,intensity) +// +// Parameters +// ring : ring number +// intensity: brightness from 0 (off) to 255 (full) +// +// Description +// This function modifies the brightness of all the LEDs in the single specified ring of piGlow. +// +// Examples +// RPI_piGlowRing(1,200) +// See also +// RPI_piGlowLeg, RPI_piGlow1, RPI_piGlowSetup +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pGR#2#"+string(ring)+"#"+string(intensity)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowSetup.sci b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowSetup.sci new file mode 100755 index 00000000..718fa3b6 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/piGlow/RPI_piGlowSetup.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - 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 RPI_piGlowSetup(Empty) +// Function to initialize the piGlow board +// +// Calling Sequence +// RPI_piGlowSetup(Empty) +// +// Parameters +// Empty: integer, 0 or 1. If 1, then all the LEDs will be turned off to start with. +// +// Description +// This initialises the PiGlow devLib software. The I2C kernel module needs to be pre-loaded. ThePiGlow board has an SN3218 I2C LED controller and 18 LEDs arranged in 3 “legs” of 6 LEDs. (or 6 “rings” of 3 LEDs). +// +// The LED colours in each leg match and are in the order Red (at the outside), Yellow, Orange, Green, Blue and White (in the center) +// +// Examples +// RPI_piGlowSetup(TRUE) +// See also +// RPI_piGlowLeg, RPI_piGlow1, RPI_piGlowRing +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pGS#1#"+string(Empty)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/piGlow/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/piGlow/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/piGlow/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/piGlow/names b/2.3-1/macros/Hardware/RasberryPi/piGlow/names new file mode 100755 index 00000000..b63ec8f7 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/piGlow/names @@ -0,0 +1,4 @@ +RPI_piGlow1 +RPI_piGlowLeg +RPI_piGlowRing +RPI_piGlowSetup diff --git a/2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_physToGpio.sci b/2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_physToGpio.sci new file mode 100755 index 00000000..9a59caa2 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_physToGpio.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_physToGpio(pin) +// Function to check the GPIO pin number corresponding to given physical pin number. +// +// Calling Sequence +// p=RPI_physToGpio(pin) +// +// Parameters +// pin: The pin number to check in physical numbering sequence. +// +// Description +// This funtion return the GPIO pin number corresponding to the supplied physical pin number. +// +// Examples +// p=RPI_physToGpio(11) +// See also +// RPI_wpiToGpio +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="ptG#1#"+string(pin)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_wpiToGpio.sci b/2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_wpiToGpio.sci new file mode 100755 index 00000000..deed4264 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pinMap/RPI_wpiToGpio.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 out=RPI_wpiToGpio(pin) +// Function to check the GPIO pin number corresponding to given wiringpi pin number. +// +// Calling Sequence +// p=RPI_wpiToGpio(pin) +// +// Parameters +// pin: The pin number to check in wiringpi numbering sequence. +// +// Description +// This funtion return the GPIO pin number corresponding to the supplied wiringpi pin number. +// +// Examples +// p=RPI_wpiToGpio(0) +// See also +// RPI_physToGpio +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="wtG#1#"+string(pin)+"#"; + if getos()=="Linux" then + out=unix_g("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + [out,RPI_winR]=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pinMap/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/pinMap/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pinMap/buildmacros.sce @@ -0,0 +1,14 @@ +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/pinMap/names b/2.3-1/macros/Hardware/RasberryPi/pinMap/names new file mode 100755 index 00000000..71efa237 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pinMap/names @@ -0,0 +1,2 @@ +RPI_physToGpio +RPI_wpiToGpio diff --git a/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmClock.sci b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmClock.sci new file mode 100755 index 00000000..d0653537 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmClock.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_pwmClock(value) +// Function to set the divisor for the PWM clock. +// +// Calling Sequence +// RPI_pwmClock(value) +// +// Parameters +// value: The divisor for the PWM clock. +// +// Description +// This function sets the divisor for the PWM clock. +// +// Examples +// RPI_pwmClock(100) +// See also +// RPI_pwmMode, RPI_pwmRange, RPI_pwmToneWrite, RPI_pwmWrite +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pwC#1#"+string(value)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmMode.sci b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmMode.sci new file mode 100755 index 00000000..13d0c367 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmMode.sci @@ -0,0 +1,46 @@ +// Copyright (C) 2017 - 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 RPI_pwmMode(Mode) +// Function to set the mode for the PWM generator +// +// Calling Sequence +// RPI_pwmMode(mode) +// +// Parameters +// mode: The mode to set for the PWM generator. 'ms' (for mark:space) or 'bal' (for balanced) +// +// Description +// This function sets the mode for the PWM generator. The PWM generator can run in 2 modes – “balanced” and “mark:space”. The mark:space mode is traditional, however the default mode in the Pi is “balanced”. Switch modes by supplying the parameter: bal or ms +// +// Examples +// RPI_pwmMode('bal') +// See also +// RPI_pwmRange, RPI_pwmClock, RPI_pwmToneWrite, RPI_pwmWrite +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + if Mode=='ms' then + commande="pwM#1#0#"; + elseif Mode=='bal' then + commande="pwM#1#1#"; + else: + error("mode should be ""ms"" or ""bal"""); + end + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmRange.sci b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmRange.sci new file mode 100755 index 00000000..6a1503a0 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmRange.sci @@ -0,0 +1,40 @@ +// Copyright (C) 2017 - 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 RPI_pwmRange(value) +// Function to set the divisor for the PWM clock. +// +// Calling Sequence +// RPI_pwmRange(value) +// +// Parameters +// value: maximum of the range for the PWM generator. +// +// Description +// This function sets the range register in the PWM generator. The default is 1024. +// +// Examples +// RPI_pwmRange(512) +// See also +// RPI_pwmMode, RPI_pwmClock, RPI_pwmToneWrite, RPI_pwmWrite +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pwR#1#"+string(value)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmToneWrite.sci b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmToneWrite.sci new file mode 100755 index 00000000..d7ff6eda --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmToneWrite.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2017 - 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 RPI_pwmToneWrite(pin,freq) +// Function to write a tone of a given frequency to the pin +// +// Calling Sequence +// RPI_pwmToneWrite(pin,freq) +// +// Parameters +// pin : The pin to set the frequency on. Numbering to be followed as initiated using RPI_pinNumbering. +// freq: frequency to write +// +// Description +// This function write the given frequency tone to the given pin. +// +// Examples +// RPI_pwmToneWrite(0,100) +// See also +// RPI_pwmMode, RPI_pwmRange, RPI_pwmClock, RPI_pwmWrite, PRI_pinNumbering +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + commande="pwT#2#"+string(pin)+"#"+string(freq)+"#"; + if getos=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmWrite.sci b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmWrite.sci new file mode 100755 index 00000000..113547af --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pwm/RPI_pwmWrite.sci @@ -0,0 +1,45 @@ +// Copyright (C) 2017 - 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 RPI_pwmWrite(pin,value) +// Function to write voltage value to the PWM register for the given pin. +// +// Calling Sequence +// RPI_pwmWrite(pin,value) +// +// Parameters +// pin : The pin number set the voltage at. Numbering sequence to be followed as initiated using RPI_pinNumbering function. +// value: The voltage to set at the given pin. Range is 0-1024. +// +// Description +// Writes the value to the PWM register for the given pin. The Raspberry Pi has one on-board PWM pin, pin 1 (BMC_GPIO 18, Phys 12). Other PWM devices may have other PWM ranges. +// +// Examples +// RPI_pwmWrite(1,500) +// See also +// RPI_pwmMode, RPI_pwmRange, RPI_pwmClock, RPI_pwmToneWrite +// +// Authors +// Jorawar Singh +// +// Bibliography +// http://wiringpi.com/reference/ + + if [0logs.txt 2>&1"); + disp("Step 3/6") + TCL_EvalStr("exec ssh-copy-id -i /home/"+local+"/.ssh/id_rsa.pub "+username+"@"+adress+" > logs.txt 2>&1"); + disp("Step 4/6") + TCL_EvalStr("exec rsync -avz "+RPI_MacrosPath+"serverWP.py "+username+"@"+adress+":.scilab/ >logs.txt"); + disp("Step 5/6") + TCL_EvalStr("exec ssh "+username+"@"+adress+" sudo python /home/"+username+"/.scilab/serverWP.py &"); + disp("Step 6/6") + TCL_EvalStr(["file delete logs.txt";"file delete &1"]); + endfunction +elseif getos()=='Windows' then + tempPath=get_absolute_file_path("raspi.sci"); + RPI_MacrosPath=strsubst(tempPath,'\','/'); + RPI_MacrosPath=part(RPI_MacrosPath,1:(length(RPI_MacrosPath)-7)); + RPI_MacrosPath=RPI_MacrosPath+'src/python/'; + function raspi(adress,username) + // Function to initiate the connection to the raspberry pi + // + // Calling Sequence + // raspi(adress,username) + // + // Parameters + // address : Network address of the raspberry pi. Eg:10.42.0.82 + // username: username on the raspberry pi. + // + // Description + // This program initiates the connection to the raspberry pi at the given address by running the python server script on port 9077 on the pi. + // + // Examples + // raspi('169.254.191.116','pi') + // See also + // raspi_close + // + // Authors + // Jorawar Singh + + global RPI_piAdress; + RPI_piAdress=adress; + + disp("Step 1/3") + TCL_EvalStr("exec mintty ssh "+username+"@"+adress+" mkdir .scilab"); + disp("Step 2/3") + TCL_EvalStr("exec mintty scp "+RPI_MacrosPath+"serverWP.py "+username+"@"+adress+":/home/"+username+"/.scilab/"); + disp("Step 3/3 (Wait ~15 seconds)") + TCL_EvalStr("exec mintty ssh "+username+"@"+adress+" sudo python /home/"+username+"/.scilab/serverWP.py &"); + sleep(15000) + TCL_EvalStr("exec taskkill /IM mintty.exe"); + endfunction +end diff --git a/2.3-1/macros/Hardware/RasberryPi/raspi_close.sci b/2.3-1/macros/Hardware/RasberryPi/raspi_close.sci new file mode 100755 index 00000000..b5bb0ee7 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/raspi_close.sci @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - 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 raspi_close() +// Function to close an open Raspberry-Pi connection. +// +// Calling Sequence +// raspi_close() +// +// Description +// This function causes the pyhton server script running on Raspberry pi to close, irrespective of it being started natively on pi or by using raspi function. +// +// Examples +// raspi_close() +// See also +// raspi +// +// Authors +// Jorawar Singh + + commande="cls#0#"; + if getos()=="Linux" then + unix_w("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + elseif getos()=="Windows" then + RPI_winR=dos("python -c ""import socket;s=socket.socket();s.connect((''"+RPI_piAdress+"'',9077));s.send(''"+commande+"'');print(s.recv(1024));s.close()"""); + end +endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci b/2.3-1/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci deleted file mode 100644 index 6eb29a1c..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci +++ /dev/null @@ -1,37 +0,0 @@ -// 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 bytes = RPI_SerialDataAvail(fd) -// Function to get number of data bytes available on serial port specified by -// file descriptor -// Calling Sequence -// RPI_SerialDataAvail(fd) -// -// Parameters -// fd : file descriptor for already opened serial port -// Description -// This functions returns number of characters available to read, -// otherwise reads -1 in case of error. This function can be used to check -// new data is available on serial port -// Examples -// serial = RPI_SerialOpen("/dev/ttyAMA0", 9600); -// charsToRead = RPI_SerialDataAvail(serial); -// See also -// RPI_SerialOpen RPI_SerialGetChar -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -bytes = 0; - -endfunction \ No newline at end of file diff --git a/2.3-1/macros/Scilab-Arduino/buildmacros.sce b/2.3-1/macros/Scilab-Arduino/buildmacros.sce old mode 100644 new mode 100755 index dfeb4755..7d533f7b --- a/2.3-1/macros/Scilab-Arduino/buildmacros.sce +++ b/2.3-1/macros/Scilab-Arduino/buildmacros.sce @@ -1,28 +1,13 @@ -// 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; +// Copyright (C) 2017 - 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: Jorawar Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); -- cgit From 61834243d140ff50b49a6153ec33ac533688ed20 Mon Sep 17 00:00:00 2001 From: Jorawar Singh Date: Sun, 16 Jul 2017 22:41:14 +0530 Subject: Toolbox merge, RPI demos and structured demos --- .../RasberryPi/old/GetRPISupportFunctions.sci | 48 ------------------- .../RasberryPi/old/IsRPISupportFunction.sci | 32 ------------- .../Hardware/RasberryPi/old/RPI_DelayMicro.sci | 38 --------------- .../Hardware/RasberryPi/old/RPI_DelayMilli.sci | 39 --------------- .../Hardware/RasberryPi/old/RPI_DigitalIn.sci | 43 ----------------- .../Hardware/RasberryPi/old/RPI_DigitalOut.sci | 44 ----------------- .../Hardware/RasberryPi/old/RPI_DigitalSetup.sci | 36 -------------- .../Hardware/RasberryPi/old/RPI_GetMicros.sci | 39 --------------- .../Hardware/RasberryPi/old/RPI_GetMillis.sci | 39 --------------- .../RasberryPi/old/RPI_HardPWMSetClock.sci | 35 -------------- .../Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci | 32 ------------- .../RasberryPi/old/RPI_HardPWMSetRange.sci | 35 -------------- .../Hardware/RasberryPi/old/RPI_HardPWMWrite.sci | 39 --------------- .../macros/Hardware/RasberryPi/old/RPI_PinISR.sci | 56 ---------------------- .../Hardware/RasberryPi/old/RPI_SerialClose.sci | 33 ------------- .../Hardware/RasberryPi/old/RPI_SerialFlush.sci | 34 ------------- .../Hardware/RasberryPi/old/RPI_SerialGetChar.sci | 36 -------------- .../Hardware/RasberryPi/old/RPI_SerialSendChar.sci | 37 -------------- .../Hardware/RasberryPi/old/RPI_SerialSendData.sci | 38 --------------- .../Hardware/RasberryPi/old/RPI_SerialSetup.sci | 36 -------------- .../macros/Hardware/RasberryPi/old/buildmacros.sce | 4 -- 2.3-1/macros/Hardware/RasberryPi/old/names | 21 -------- .../RasberryPi/old/u16RPISerialDataAvail.sci | 37 -------------- 23 files changed, 831 deletions(-) delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/GetRPISupportFunctions.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/IsRPISupportFunction.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMicro.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMilli.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalIn.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalOut.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalSetup.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMicros.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMillis.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetClock.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetRange.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMWrite.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_PinISR.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialClose.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialFlush.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialGetChar.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendChar.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendData.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSetup.sci delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/buildmacros.sce delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/names delete mode 100644 2.3-1/macros/Hardware/RasberryPi/old/u16RPISerialDataAvail.sci (limited to '2.3-1/macros') diff --git a/2.3-1/macros/Hardware/RasberryPi/old/GetRPISupportFunctions.sci b/2.3-1/macros/Hardware/RasberryPi/old/GetRPISupportFunctions.sci deleted file mode 100644 index 3e6397b2..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/GetRPISupportFunctions.sci +++ /dev/null @@ -1,48 +0,0 @@ -function RPiSupportFunctions = GetRPISupportFunctions() -// ----------------------------------------------------------------- -// Get list of RPI peripherals supported -// -// Input data: -// None -// -// Output data: -// None -// Copyright (C) 2017 - 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 -// -// ----------------------------------------------------------------- - -RPiSupportFunctions = [ - "RPI_DigitalIn" - "RPI_DigitalOut" - "RPI_DigitalSetup" - "RPI_DelayMilli" - "RPI_DelayMicro" - "RPI_GetMillis" - "RPI_GetMicros" - "RPI_SerialSetup" - "RPI_SerialClose" - "RPI_SerialSendChar" - "RPI_SerialFlush" - "RPI_SerialGetChar" - "RPI_ThreadCreate" - "RPI_PinISR" - "RPI_HardPWMWrite" - "RPI_HardPWMSetRange" - "RPI_HardPWMSetClock" - "RPI_HardPWMSetMode" - ]; - -//Note: "RPI_SerialSendData" is removed since distinction between input data -//types is required - - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/IsRPISupportFunction.sci b/2.3-1/macros/Hardware/RasberryPi/old/IsRPISupportFunction.sci deleted file mode 100644 index c6a2c365..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/IsRPISupportFunction.sci +++ /dev/null @@ -1,32 +0,0 @@ -function Output = IsRPISupportFunction(FunName) -// ----------------------------------------------------------------- -// Check whether input function name is a RPi support function or not. -// -// Input data: -// FunName: Name of the function to be checked -// -// Output data: -// Output: True or False depending whether given function is a RPi -// support functions or not -// -// Copyright (C) 2017 - 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 -// -// ----------------------------------------------------------------- - -//Get list of supported functions for AVR -RPISupportFunctions = GetRPISupportFunctions(); - -//Check whether input function is present in above list or not -FunNameInRPISupport = members(FunName,RPISupportFunctions); -Output = bool2s(FunNameInRPISupport~=0); - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMicro.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMicro.sci deleted file mode 100644 index bbb0bb3b..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMicro.sci +++ /dev/null @@ -1,38 +0,0 @@ -// 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 RPI_DelayMicro(time) -// Function to insert some delay in code execution. -// -// Calling Sequence -// RPI_DelayMicro(time) -// -// Parameters -// time: time(microseconds) for which execution is to be delayed -// -// Description -// this function can be used for insertig execution delays. 'time' should be -// specified in microseconds.'time' should be between (1-65536). -// Note: Delay inserted by this function is not accurate, but depedent on -// operating system, other running tasks etc. -// -// Examples -// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. -// -// See also -// RPI_DelayMicro -// -// -// Authors -// Siddhesh Wani -// - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMilli.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMilli.sci deleted file mode 100644 index 13b79625..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DelayMilli.sci +++ /dev/null @@ -1,39 +0,0 @@ -// 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 RPI_DelayMilli(time) -// Function to insert some delay in milli seconds in code execution. -// -// Calling Sequence -// RPI_DelayMilli(time) -// -// Parameters -// time: time(milliseconds) for which execution is to be delayed -// -// Description -// This function can be used for insertig execution delays. 'time' should be -// specified in milliseconds. If more resolution is required, use 'RPI_DelayMicro' -// for inserting delay in microseconds. -// Note: Delay inserted by this function is not accurate, but depedent on -// operating system, other running tasks etc. -// -// Examples -// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. -// -// See also -// RPI_DelayMicro -// -// -// Authors -// Siddhesh Wani -// - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalIn.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalIn.sci deleted file mode 100644 index 781c49c8..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalIn.sci +++ /dev/null @@ -1,43 +0,0 @@ -// 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 state = RPI_DigitalIn(pin) -// Function to read current state on digital pins. -// -// Calling Sequence -// state = RPI_DigitalIn(pin) -// -// Parameters -// pin : pin of RPi to be used -// state : current state of the pin (0 -> LOW, 1 -> HIGH) -// -// Description -// This fucntion is used for reading the current state on gpio pins of RPi. 'RPI_DigitalSetup' function must be called before this for setting up pin as input. 'pin' must be specified from list given. 'state' specifies the input state (0 -> Low, 1-> High) -// Examples -// RPI_DigitalIn(RPI_GPIO_P1_03) //Reads the state of pin 3 of header P1. -// -// See also -// RPI_DigitalSetup RPI_DigitalOut -// -// -// 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,27,28,29,... - 31,31,33,35,36,37,38,40]; - -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 -state = 1; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalOut.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalOut.sci deleted file mode 100644 index dde3c934..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalOut.sci +++ /dev/null @@ -1,44 +0,0 @@ -// 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 RPI_DigitalOut(pin, state) -// Function to output desired state on digital pins. -// -// Calling Sequence -// RPI_DigitalOut(pin, state) -// -// Parameters -// pin : pin of RPi to be used -// state : desired state of the pin (0 -> LOW, 1 -> HIGH) -// -// Description -// This fucntion is used for outputting the desired state on gpio pins of RPi. 'RPI_DigitalSetup' function must be called before this for setting up pin as output. 'pin' must be specified from list given. 'state' specifies the output state (0 -> Low, 1-> High) -// Examples -// RPI_DigitalOut(RPI_GPIO_P1_03,0) //Changes the state of pin 3 of header P1 as 'Low'. -// -// See also -// RPI_DigitalSetup RPI_DigitalIn -// -// -// 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,27,28,29,... - 31,31,33,35,36,37,38,40]; - -PinIsGPIO = members(pin, supported_pins); //Check if output 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 -state = 1; - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalSetup.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalSetup.sci deleted file mode 100644 index 01d6e07d..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_DigitalSetup.sci +++ /dev/null @@ -1,36 +0,0 @@ -function RPI_DigitalSetup(pin, direction) -// Function to setup digital pins. -// -// Calling Sequence -// RPI_DigitalSetup(pin,direction) -// -// Parameters -// pin : pin of RPi to be used -// direction : direction to be set for pin -// 0 -> INPUT, 1 -> OUTPUT, 2->PWM 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(3,0) //Sets pin 3 of header P1 as input -// -// See also -// RPI_DigitalIn RPI_DigitalOut -// -// -// 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,27,28,29,... - 31,31,33,35,36,37,38,40]; - -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 -state = 1; - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMicros.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMicros.sci deleted file mode 100644 index 6c4db57a..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMicros.sci +++ /dev/null @@ -1,39 +0,0 @@ -// 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 Micros = RPI_GetMicros() -// Function to get time in Microsecond since first setup function called. -// -// Calling Sequence -// Micros = RPI_GetMicros() -// -// Parameters -// Micros: time in Microseconds since first setup function called -// -// Description -// This function can be used to get time since first setup function called. -// Note: To use this function atleast one setup function must be called. -// -// Examples -// start = RPI_GetMicros() -// RPI_DelayMicro(1000) //This will delay the execution of next code by 100 ms. -// end = RPI_GetMicros() -// delay = end- start //This should be approximately 1000 us. -// -// See also -// RPI_GetMillis RPI_DelayMilli RPI_DelayMicro -// -// -// Authors -// Siddhesh Wani -// - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -Micros = 0; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMillis.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMillis.sci deleted file mode 100644 index c034a705..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_GetMillis.sci +++ /dev/null @@ -1,39 +0,0 @@ -// 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 Millis = RPI_GetMillis() -// Function to get time in millisecond since first setup function called. -// -// Calling Sequence -// Millis = RPI_GetMillis() -// -// Parameters -// Millis: time in milliseconds since first setup function called -// -// Description -// This function can be used to get time since first setup function called. -// Note: To use this function atleast one setup function must be called. -// -// Examples -// start = RPI_GetMillis() -// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. -// end = RPI_GetMillis() -// delay = end- start //This should be approximately 100ms. -// -// See also -// RPI_GetMicros RPI_DelayMilli RPI_DelayMicro -// -// -// Authors -// Siddhesh Wani -// - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -Millis = 0; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetClock.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetClock.sci deleted file mode 100644 index 8448d364..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetClock.sci +++ /dev/null @@ -1,35 +0,0 @@ -// 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 RPI_HardPWMSetClock(clock_divisor) -// Function to set PWM clock. PWM clock frequency is 19.2MHz, which can be reduced -// using suitable clock_divisor (1 to 2048, powers of 2) -// -// Calling Sequence -// RPI_HardPWMSetClock(clock_divisor) -// -// Parameters -// clock_divisor: Value can be from 1 to 2048, powers of 2. -// Description -// This function decides pwm clock. -// PWM frequency = (PWM Clock frequency/Clock divisor/range) -// PWM clock frequency = 19.2 MHz -// clock divisor is setup using RPI_HardPWMSetClock -// range is setup using RPI_HardPWMSetRange -// Examples -// -// See also -// RPI_HardPWMSetWrite RPI_HardPWMSetRange -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci deleted file mode 100644 index 57b82601..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetMode.sci +++ /dev/null @@ -1,32 +0,0 @@ -// 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 RPI_HardPWMSetMode(pwm_mode) -// Function to set PWM mode. Two modes are available - balanced and mark/space -// -// Calling Sequence -// RPI_HardPWMSetMode(pwm_mode) -// -// Parameters -// pwm_mode: decides pwm mode -// 0 -> balanced -// 1 -> mark/space -// Description -// This function decides pwm mode -// Examples -// -// See also -// RPI_HardPWMSetWrite RPI_HardPWMSetRange -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetRange.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetRange.sci deleted file mode 100644 index c2075e2d..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMSetRange.sci +++ /dev/null @@ -1,35 +0,0 @@ -// 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 RPI_HardPWMSetRange(range_val) -// Function to set range value for PWM. Range value along with clock divisor -// decides pwm frequency. Range value must be less than 1024 -// -// Calling Sequence -// RPI_HardPWMSetRange(range_val) -// -// Parameters -// range_val: range for pwm -// Description -// This function decides range for pwm. -// PWM frequency = (PWM Clock frequency/Clock divisor/range) -// PWM clock frequency = 19.2 MHz -// clock divisor is setup using RPI_HardPWMSetClock -// range is setup using RPI_HardPWMSetRange -// Examples -// -// See also -// RPI_HardPWMSetClock RPI_HardPWMWrite -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMWrite.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMWrite.sci deleted file mode 100644 index dba5e674..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_HardPWMWrite.sci +++ /dev/null @@ -1,39 +0,0 @@ -// 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 RPI_HardPWMWrite(pin,value) -// Function to change pwm duty on specified pin. Hardware PWM is available -// only on pin 12. So, only '12' should be provided as pin -// -// Calling Sequence -// RPI_HardPWMWrite(12,512) //Value must be smaller than the range set -// using RPI_HARDPWMSetRange -// -// Parameters -// pin: pin no on which pwm value is to be changed. Currently only 12 is allowed -// value: pwm value for given pin. This must be less than range value set -// Description -// This function changes pwm duty on specified pin. As for RPi, only one pin -// (pin 12) is available for hardware PWM. -// PWM frequency = (PWM Clock frequency/Clock divisor/range) -// PWM clock frequency = 19.2 MHz -// clock divisor is setup using RPI_HardPWMSetClock -// range is setup using RPI_HardPWMSetRange -// Actual PWM duty = value/range -// Examples -// -// See also -// RPI_HardPWMSetClock RPI_HardPWMSetRange -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_PinISR.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_PinISR.sci deleted file mode 100644 index c2354c1f..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_PinISR.sci +++ /dev/null @@ -1,56 +0,0 @@ -// 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 RPI_PinISR(pin, edgetype, fn) -// Function to assign a function to be run when an interrupt occurs on -// specified pin. -// -// Calling Sequence -// RPI_PinISR(pin, edgetype, fn) -// -// Parameters -// pin : pin whose interrupt is to be configured -// edgetype: edge on which interrupt is to be monitored -// 1 -> Falling egde -// 2 -> Rising egde -// 3 -> Both egde -// fn: name of the function to be executed on interrupt occurance -// Description -// This functions monitors interrupt on specified pin for specified edge, -// When that interrupt occurs, function specified by 'fn' is executed. -// Examples -// RPI_PinISR(12, 0, Pin12ISR) //executes 'Pin12ISR' on falling edge on -// pin 12 -// See also -// RPI_ThreadCreate RPI_DigitalSetup -// -// -// 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,27,28,29,... - 31,31,33,35,36,37,38,40]; - -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 -EdgeTypeSupported = members(edgetype,[1 2 3]); - -if(EdgeTypeSupported == 0) - error(9999, 'SCI2CERROR: Given edgetype is incorrect. Please specify correct edgetype from [1,2,3]') -end - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialClose.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialClose.sci deleted file mode 100644 index f27dd432..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialClose.sci +++ /dev/null @@ -1,33 +0,0 @@ -// 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 RPI_SerialClose(fd) -// Function to close serial port specified by file descriptor. -// -// Calling Sequence -// RPI_SerialClose(fd) -// -// Parameters -// fd : file descriptor for opened port -// Description -// This functions closes the specified serial port -// Examples -// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' -// RPI_SerialClose(serial1) -// See also -// RPI_SerialOpen RPI_SerialSendChar -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialFlush.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialFlush.sci deleted file mode 100644 index 9bab386f..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialFlush.sci +++ /dev/null @@ -1,34 +0,0 @@ -// 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 data = RPI_SerialGetChar(fd) -// Function to read data from specified serial port -// -// Calling Sequence -// RPI_SerialGetCharfd) -// -// Parameters -// fd: file descriptor returned when serial port was opened -// Description -// This functions reads character form specified port. In case no -// character is available, -1 is returned after 10 sec. -// Examples -// serial = RPI_SetupSerial("/dev/ttyAMA0", 9600); -// RPI_SerialFlush(serial); -// bytes = RPI_SerialDataAvail(serial); -// -// See also -// RPI_SetupSerial RPI_SendData -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialGetChar.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialGetChar.sci deleted file mode 100644 index a26e5b97..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialGetChar.sci +++ /dev/null @@ -1,36 +0,0 @@ -// 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 data = RPI_SerialGetChar(fd) -// Function to read data from specified serial port -// -// Calling Sequence -// RPI_SerialGetChar(fd) -// -// Parameters -// fd: file descriptor returned when serial port was opened -// Description -// This functions reads character form specified port. In case no -// character is available, -1 is returned after 10 sec. -// Examples -// serial = RPI_SetupSerial("/dev/ttyAMA0", 9600); -// bytes = RPI_SerialDataAvail(serial); -// if(bytes>0) -// data = RPI_SerialGetChar(serial) //Reads single character -// end -// See also -// RPI_SetupSerial RPI_SendData -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -data = 0; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendChar.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendChar.sci deleted file mode 100644 index 769b21d2..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendChar.sci +++ /dev/null @@ -1,37 +0,0 @@ -// 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 RPI_SerialSendChar(fd, data) -// Function to send 8-bit char through serial port. -// -// Calling Sequence -// RPI_SerialSendChar(fd, data) -// -// Parameters -// fd : file descriptor for opened port -// data: 8-bit character data to be sent -// Description -// This functions sends input 8-bit character data on specified serial port -// Examples -// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' -// RPI_SerialSendChar(serial1, 'H'); -// RPI_SerialSendChar(serial1, 'i'); -// RPI_SerialClose(serial1); -// -// See also -// RPI_SerialOpen RPI_SerialClose -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendData.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendData.sci deleted file mode 100644 index c05852b1..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSendData.sci +++ /dev/null @@ -1,38 +0,0 @@ -// 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 RPI_SerialSendData(fd, data) -// Function to send data through serial port. Data can be of any datatype and -// can be scalar or matrix -// -// Calling Sequence -// RPI_SerialSendData(fd, data) -// -// Parameters -// fd : file descriptor for opened port -// data: data to be sent -// Description -// This functions sends input data on specified serial port -// Examples -// A = [2 3; 4 5] -// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' -// RPI_SerialSendData(serial1, A); -// RPI_SerialClose(serial1); -// -// See also -// RPI_SerialOpen RPI_SerialClose -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSetup.sci b/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSetup.sci deleted file mode 100644 index 0f266610..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/RPI_SerialSetup.sci +++ /dev/null @@ -1,36 +0,0 @@ -// 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 fd = RPI_SerialSetup(port, baudrate) -// Function to setup serial port. -// -// Calling Sequence -// RPI_SerialSetup(port, baudrate) -// -// Parameters -// port : port of RPi to be used (eg. ) -// direction : direction to be set for pin (0 -> INPUT, 1 -> OUTPUT) -// fd : file descriptor for opened port, -1 for error -// Description -// This functions opens the specified serial port and returns file descriptor -// for the same -// Examples -// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' -// -// See also -// RPI_SerialClose RPI_SerialSendChar -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. -fd = 0; -endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/old/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/old/buildmacros.sce deleted file mode 100644 index 2954a424..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/buildmacros.sce +++ /dev/null @@ -1,4 +0,0 @@ - -tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); - -clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/RasberryPi/old/names b/2.3-1/macros/Hardware/RasberryPi/old/names deleted file mode 100644 index fa647761..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/names +++ /dev/null @@ -1,21 +0,0 @@ -GetRPISupportFunctions -IsRPISupportFunction -RPI_DelayMicro -RPI_DelayMilli -RPI_DigitalIn -RPI_DigitalOut -RPI_DigitalSetup -RPI_GetMicros -RPI_GetMillis -RPI_HardPWMSetClock -RPI_HardPWMSetMode -RPI_HardPWMSetRange -RPI_HardPWMWrite -RPI_PinISR -RPI_SerialClose -RPI_SerialFlush -RPI_SerialGetChar -RPI_SerialSendChar -RPI_SerialSendData -RPI_SerialSetup -u16RPISerialDataAvail diff --git a/2.3-1/macros/Hardware/RasberryPi/old/u16RPISerialDataAvail.sci b/2.3-1/macros/Hardware/RasberryPi/old/u16RPISerialDataAvail.sci deleted file mode 100644 index 6eb29a1c..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/old/u16RPISerialDataAvail.sci +++ /dev/null @@ -1,37 +0,0 @@ -// 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 bytes = RPI_SerialDataAvail(fd) -// Function to get number of data bytes available on serial port specified by -// file descriptor -// Calling Sequence -// RPI_SerialDataAvail(fd) -// -// Parameters -// fd : file descriptor for already opened serial port -// Description -// This functions returns number of characters available to read, -// otherwise reads -1 in case of error. This function can be used to check -// new data is available on serial port -// Examples -// serial = RPI_SerialOpen("/dev/ttyAMA0", 9600); -// charsToRead = RPI_SerialDataAvail(serial); -// See also -// RPI_SerialOpen RPI_SerialGetChar -// -// -// Authors -// Siddhesh Wani -// ----------------------------------------------------------------- - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - -bytes = 0; - -endfunction \ No newline at end of file -- cgit