diff options
author | Brijeshcr | 2017-07-20 19:39:55 +0530 |
---|---|---|
committer | Brijeshcr | 2017-07-20 19:39:55 +0530 |
commit | 215a24b64f6d0ec3fcef06c2634926f730b3dcc5 (patch) | |
tree | 48072b76fe009ec8423ba9e179fef964db666a3a | |
parent | 9a2e3e3174a9ff35ba9b739cec4a0b8c052a8dbe (diff) | |
parent | dbf6486fa17d277729e0d6f77c2a6b93cbdd9424 (diff) | |
download | Scilab2C-215a24b64f6d0ec3fcef06c2634926f730b3dcc5.tar.gz Scilab2C-215a24b64f6d0ec3fcef06c2634926f730b3dcc5.tar.bz2 Scilab2C-215a24b64f6d0ec3fcef06c2634926f730b3dcc5.zip |
Added RPI demo and lcd128x64 fixed
256 files changed, 6432 insertions, 822 deletions
diff --git a/2.3-1/demos/Arduino/Arduino.dem.gateway.sce b/2.3-1/demos/Arduino/Arduino.dem.gateway.sce new file mode 100644 index 00000000..417291ac --- /dev/null +++ b/2.3-1/demos/Arduino/Arduino.dem.gateway.sce @@ -0,0 +1,22 @@ +// 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, Yash Pratap Singh Tomar +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + + +subdemolist = ["Arduino blink", "blink.dem.sce"; + "Arduino digital input", "digital_in.dem.sce"; + "Arduino analog voltage i/o", "analog_in_out_volt.dem.sce"; + "Arduino analog output", "analog_out.dem.sce"; + "Arduino DC motor", "dc_motor.dem.sce"; + "Arduino Master write", "master_write.dem.sce"; + ]; + +global SCI2CHOME; +subdemolist(:,2) = SCI2CHOME + "/demos/Arduino/"+ subdemolist(:,2); diff --git a/2.3-1/demos/analog_in_out_volt.dem.sce b/2.3-1/demos/Arduino/analog_in_out_volt.dem.sce index ca6da611..ca6da611 100644 --- a/2.3-1/demos/analog_in_out_volt.dem.sce +++ b/2.3-1/demos/Arduino/analog_in_out_volt.dem.sce diff --git a/2.3-1/demos/analog_out.dem.sce b/2.3-1/demos/Arduino/analog_out.dem.sce index 65a1e279..65a1e279 100644 --- a/2.3-1/demos/analog_out.dem.sce +++ b/2.3-1/demos/Arduino/analog_out.dem.sce diff --git a/2.3-1/demos/blink.dem.sce b/2.3-1/demos/Arduino/blink.dem.sce index b01d3dae..b01d3dae 100644 --- a/2.3-1/demos/blink.dem.sce +++ b/2.3-1/demos/Arduino/blink.dem.sce diff --git a/2.3-1/demos/dc_motor.dem.sce b/2.3-1/demos/Arduino/dc_motor.dem.sce index 36c0badd..36c0badd 100644 --- a/2.3-1/demos/dc_motor.dem.sce +++ b/2.3-1/demos/Arduino/dc_motor.dem.sce diff --git a/2.3-1/demos/digital_in.dem.sce b/2.3-1/demos/Arduino/digital_in.dem.sce index 2eb4c3a0..2eb4c3a0 100644 --- a/2.3-1/demos/digital_in.dem.sce +++ b/2.3-1/demos/Arduino/digital_in.dem.sce diff --git a/2.3-1/demos/master_write.dem.sce b/2.3-1/demos/Arduino/master_write.dem.sce index cdf522db..cdf522db 100644 --- a/2.3-1/demos/master_write.dem.sce +++ b/2.3-1/demos/Arduino/master_write.dem.sce diff --git a/2.3-1/demos/CT/CT.dem.gateway.sce b/2.3-1/demos/CT/CT.dem.gateway.sce new file mode 100644 index 00000000..1aba91e4 --- /dev/null +++ b/2.3-1/demos/CT/CT.dem.gateway.sce @@ -0,0 +1,18 @@ +// 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, Sandeep Gupta +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + + +subdemolist = ["Discrete Cosine Transform" , "test_dct.dem.sce"; + "Inverse Cosine Transform" , "test_idct.dem.sce"; + ]; + +global SCI2CHOME; +subdemolist(:,2) = SCI2CHOME + "/demos/CT/"+ subdemolist(:,2); diff --git a/2.3-1/demos/test_dct.dem.sce b/2.3-1/demos/CT/test_dct.dem.sce index b1b62475..b1b62475 100644 --- a/2.3-1/demos/test_dct.dem.sce +++ b/2.3-1/demos/CT/test_dct.dem.sce diff --git a/2.3-1/demos/test_idct.dem.sce b/2.3-1/demos/CT/test_idct.dem.sce index b1d33392..b1d33392 100644 --- a/2.3-1/demos/test_idct.dem.sce +++ b/2.3-1/demos/CT/test_idct.dem.sce diff --git a/2.3-1/demos/Filter.dem.sce b/2.3-1/demos/Filters/Filter.dem.sce index 100b37b3..100b37b3 100644 --- a/2.3-1/demos/Filter.dem.sce +++ b/2.3-1/demos/Filters/Filter.dem.sce diff --git a/2.3-1/demos/FilterResponse.dem.sce b/2.3-1/demos/Filters/FilterResponse.dem.sce index 7104836d..7104836d 100644 --- a/2.3-1/demos/FilterResponse.dem.sce +++ b/2.3-1/demos/Filters/FilterResponse.dem.sce diff --git a/2.3-1/demos/Filters/Filters.dem.gateway.sce b/2.3-1/demos/Filters/Filters.dem.gateway.sce new file mode 100644 index 00000000..274d0e4f --- /dev/null +++ b/2.3-1/demos/Filters/Filters.dem.gateway.sce @@ -0,0 +1,19 @@ +// 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, Sandeep Gupta +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + + +subdemolist = ["High Pass Filter", "Filter.dem.sce"; + "Analog Filters","analogFilter.dem.sce"; + "Filter Responses","FilterResponse.dem.sce"; + ]; + +global SCI2CHOME; +subdemolist(:,2) = SCI2CHOME + "/demos/Filters/"+ subdemolist(:,2); diff --git a/2.3-1/demos/analogFilter.dem.sce b/2.3-1/demos/Filters/analogFilter.dem.sce index 674c9543..674c9543 100644 --- a/2.3-1/demos/analogFilter.dem.sce +++ b/2.3-1/demos/Filters/analogFilter.dem.sce diff --git a/2.3-1/demos/FULLRF.dem.sce b/2.3-1/demos/LinearAlgebra/FULLRF.dem.sce index 3aeeba20..3aeeba20 100644 --- a/2.3-1/demos/FULLRF.dem.sce +++ b/2.3-1/demos/LinearAlgebra/FULLRF.dem.sce diff --git a/2.3-1/demos/GIVENS.dem.sce b/2.3-1/demos/LinearAlgebra/GIVENS.dem.sce index 0ab2d2a7..0ab2d2a7 100644 --- a/2.3-1/demos/GIVENS.dem.sce +++ b/2.3-1/demos/LinearAlgebra/GIVENS.dem.sce diff --git a/2.3-1/demos/HESS.dem.sce b/2.3-1/demos/LinearAlgebra/HESS.dem.sce index 4c70d67b..4c70d67b 100644 --- a/2.3-1/demos/HESS.dem.sce +++ b/2.3-1/demos/LinearAlgebra/HESS.dem.sce diff --git a/2.3-1/demos/HOUSEHOLDER.dem.sce b/2.3-1/demos/LinearAlgebra/HOUSEHOLDER.dem.sce index 74474071..74474071 100644 --- a/2.3-1/demos/HOUSEHOLDER.dem.sce +++ b/2.3-1/demos/LinearAlgebra/HOUSEHOLDER.dem.sce diff --git a/2.3-1/demos/LinearAlgebra/LinearAlgebra.dem.gateway.sce b/2.3-1/demos/LinearAlgebra/LinearAlgebra.dem.gateway.sce new file mode 100644 index 00000000..ef99e531 --- /dev/null +++ b/2.3-1/demos/LinearAlgebra/LinearAlgebra.dem.gateway.sce @@ -0,0 +1,27 @@ +// 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, Sandeep Gupta +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + + +subdemolist = ["Singular Value Decomposition", "SVD.dem.sce"; + "Singular Value Approximation", "SVA.dem.sce"; + "SQROOT", "SQROOT.dem.sce"; + "SPEC", "SPEC.dem.sce"; + "ROWCOMP","ROWCOMP.dem.sce"; + "QR Decomposition", "QR.dem.sce"; + "NORM type 2", "NORM.dem.sce"; + "HOUSEHOLDER","HOUSEHOLDER.dem.sce"; + "HESS", "HESS.dem.sce"; + "GIVENS Transformation", "GIVENS.dem.sce"; + "Full rank factorization","FULLRF.dem.sce"; + ]; + +global SCI2CHOME; +subdemolist(:,2) = SCI2CHOME + "/demos/LinearAlgebra/"+ subdemolist(:,2); diff --git a/2.3-1/demos/NORM.dem.sce b/2.3-1/demos/LinearAlgebra/NORM.dem.sce index 1de3feba..1de3feba 100644 --- a/2.3-1/demos/NORM.dem.sce +++ b/2.3-1/demos/LinearAlgebra/NORM.dem.sce diff --git a/2.3-1/demos/QR.dem.sce b/2.3-1/demos/LinearAlgebra/QR.dem.sce index 7d2fc1a3..7d2fc1a3 100644 --- a/2.3-1/demos/QR.dem.sce +++ b/2.3-1/demos/LinearAlgebra/QR.dem.sce diff --git a/2.3-1/demos/ROWCOMP.dem.sce b/2.3-1/demos/LinearAlgebra/ROWCOMP.dem.sce index 6557eb4c..6557eb4c 100644 --- a/2.3-1/demos/ROWCOMP.dem.sce +++ b/2.3-1/demos/LinearAlgebra/ROWCOMP.dem.sce diff --git a/2.3-1/demos/SPEC.dem.sce b/2.3-1/demos/LinearAlgebra/SPEC.dem.sce index 423c1520..423c1520 100644 --- a/2.3-1/demos/SPEC.dem.sce +++ b/2.3-1/demos/LinearAlgebra/SPEC.dem.sce diff --git a/2.3-1/demos/SQROOT.dem.sce b/2.3-1/demos/LinearAlgebra/SQROOT.dem.sce index 676d5e52..676d5e52 100644 --- a/2.3-1/demos/SQROOT.dem.sce +++ b/2.3-1/demos/LinearAlgebra/SQROOT.dem.sce diff --git a/2.3-1/demos/SVA.dem.sce b/2.3-1/demos/LinearAlgebra/SVA.dem.sce index 3ced74f5..3ced74f5 100644 --- a/2.3-1/demos/SVA.dem.sce +++ b/2.3-1/demos/LinearAlgebra/SVA.dem.sce diff --git a/2.3-1/demos/SVD.dem.sce b/2.3-1/demos/LinearAlgebra/SVD.dem.sce index aa35cce9..aa35cce9 100644 --- a/2.3-1/demos/SVD.dem.sce +++ b/2.3-1/demos/LinearAlgebra/SVD.dem.sce diff --git a/2.3-1/demos/RPi/RPi.dem.gateway.sce b/2.3-1/demos/RPi/RPi.dem.gateway.sce new file mode 100644 index 00000000..c125e9c7 --- /dev/null +++ b/2.3-1/demos/RPi/RPi.dem.gateway.sce @@ -0,0 +1,18 @@ +// 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, Sandeep Gupta +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + + +subdemolist = ["Wait and Blink","test_wait_and_blink.dem.sce"; + "LCD","test_lcd.dem.sce" + ]; + +global SCI2CHOME; +subdemolist(:,2) = SCI2CHOME + "/demos/RPi/"+ subdemolist(:,2); diff --git a/2.3-1/demos/RPi/test_lcd.dem.sce b/2.3-1/demos/RPi/test_lcd.dem.sce new file mode 100644 index 00000000..2bd19516 --- /dev/null +++ b/2.3-1/demos/RPi/test_lcd.dem.sce @@ -0,0 +1,19 @@ +// 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, Sandeep Gupta +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in +// + +lines(0); + +global SCI2CHOME + +scilab2c(SCI2CHOME + "/tests/unit_tests/test_RPi/lcd.sci", TMPDIR,SCI2CHOME + "/tests/unit_tests/test_RPi/", "All", "make" ,"RPi", "uno"); + +editor([TMPDIR+"/main.c"]); diff --git a/2.3-1/demos/RPi/test_wait_and_blink.dem.sce b/2.3-1/demos/RPi/test_wait_and_blink.dem.sce new file mode 100644 index 00000000..31396c60 --- /dev/null +++ b/2.3-1/demos/RPi/test_wait_and_blink.dem.sce @@ -0,0 +1,19 @@ +// 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, Sandeep Gupta +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in +// + +lines(0); + +global SCI2CHOME + +scilab2c(SCI2CHOME + "/tests/unit_tests/test_RPi/wait_and_blink.sci", TMPDIR,SCI2CHOME + "/tests/unit_tests/test_RPi/", "All", "make" ,"RPi", "uno"); + +editor([TMPDIR+"/main.c"]); diff --git a/2.3-1/demos/scilab2c.dem.gateway.sce b/2.3-1/demos/scilab2c.dem.gateway.sce index bc158bfa..1e2a6c7f 100644 --- a/2.3-1/demos/scilab2c.dem.gateway.sce +++ b/2.3-1/demos/scilab2c.dem.gateway.sce @@ -12,36 +12,17 @@ demopath = get_absolute_file_path("scilab2c.dem.gateway.sce"); -subdemolist = ["Trigonometric Identity" , "TrigonometricIdentity.dem.sce"; +subdemolist =["Linear Algebra","LinearAlgebra/LinearAlgebra.dem.gateway.sce"; + "Arduino","Arduino/Arduino.dem.gateway.sce"; + "Cosine Transforms","CT/CT.dem.gateway.sce"; + "Filters","Filters/Filters.dem.gateway.sce"; + "Raspberry Pi","RPi/RPi.dem.gateway.sce"; + "Trigonometric Identity" , "TrigonometricIdentity.dem.sce"; "Linear Regression" , "LinearRegression.dem.sce"; "Symbols", "Symbols.dem.sce"; - "High Pass Filter", "Filter.dem.sce"; - "Jacobi functions","Jacobi.dem.sce"; - "Analog Filters","analogFilter.dem.sce"; - "Discrete Cosine Transform" , "test_dct.dem.sce"; - "Inverse Cosine Transform" , "test_idct.dem.sce"; - "String Functions","string.dem.sce"; - "Filter Responses","FilterResponse.dem.sce"; - "Singular Value Decomposition", "SVD.dem.sce"; - "Singular Value Approximation", "SVA.dem.sce"; - "SQROOT", "SQROOT.dem.sce"; - "SPEC", "SPEC.dem.sce"; - "ROWCOMP","ROWCOMP.dem.sce"; - "QR Decomposition", "QR.dem.sce"; - "NORM type 2", "NORM.dem.sce"; - "HOUSEHOLDER","HOUSEHOLDER.dem.sce"; - "HESS", "HESS.dem.sce"; - "GIVENS Transformation", "GIVENS.dem.sce"; - "Full rank factorization","FULLRF.dem.sce"; - "Arduino blink", "blink.dem.sce"; - "Arduino digital input", "digital_in.dem.sce"; - "Arduino analog voltage i/o", "analog_in_out_volt.dem.sce"; - "Arduino analog output", "analog_out.dem.sce"; - "Arduino DC motor", "dc_motor.dem.sce"; - "Arduino Master write", "master_write.dem.sce"; - "Ffilt coeff. of FIR low pass filter","ffilt.dem.sce"; - "Design of FIR linear phase filters using freq. samping technique","fsfirlin.dem.sce"; - "Samples of sinc function","filt_sinc.dem.sce"; - ]; - + "Jacobi functions","Jacobi.dem.sce"; + "String Functions","string.dem.sce"; + "Ffilt coeff. of FIR low pass filter","ffilt.dem.sce"; + "Design of FIR linear phase filters using freq. samping technique","fsfirlin.dem.sce"; + "Samples of sinc function","filt_sinc.dem.sce";] subdemolist(:,2) = demopath + subdemolist(:,2); diff --git a/2.3-1/etc/scilab2c.start b/2.3-1/etc/scilab2c.start index 91a5861e..330def7a 100644 --- a/2.3-1/etc/scilab2c.start +++ b/2.3-1/etc/scilab2c.start @@ -22,6 +22,24 @@ sci2c_ToolInitlib = lib(pathmacros + "ToolInitialization" + filesep()); sci2c_finDeps = lib(pathmacros + "findDeps" + filesep()); sci2c_AVRlib = lib(pathmacros + "Hardware\AVR" + filesep()); sci2c_RPilib = lib(pathmacros + "Hardware\RasberryPi"+ filesep()); +sci2c_RPI_Digitallib = lib(pathmacros + "Hardware\RasberryPi\Digital" + filesep()); +sci2c_RPI_gertBoardlib = lib(pathmacros + "Hardware\RasberryPi\gertBoard" + filesep()); +sci2c_RPI_I2Clib = lib(pathmacros + "Hardware\RasberryPi\I2C" + filesep()); +sci2c_RPI_Interruptlib = lib(pathmacros + "Hardware\RasberryPi\Interrupt" + filesep()); +sci2c_RPI_lcdlib = lib(pathmacros + "Hardware\RasberryPi\lcd" + filesep()); +sci2c_RPI_lcd128x64lib = lib(pathmacros + "Hardware\RasberryPi\lcd128x64" + filesep()); +sci2c_RPI_mcplib = lib(pathmacros + "Hardware\RasberryPi\mcp" + filesep()); +sci2c_RPI_Misclib = lib(pathmacros + "Hardware\RasberryPi\Misc" + filesep()); +sci2c_RPI_pcflib = lib(pathmacros + "Hardware\RasberryPi\pcf" + filesep()); +sci2c_RPI_piGlowlib = lib(pathmacros + "Hardware\RasberryPi\piGlow" + filesep()); +sci2c_RPI_pinMaplib = lib(pathmacros + "Hardware\RasberryPi\pinMap" + filesep()); +sci2c_RPI_pwmlib = lib(pathmacros + "Hardware\RasberryPi\pwm" + filesep()); +sci2c_RPI_Seriallib = lib(pathmacros + "Hardware\RasberryPi\Serial" + filesep()); +sci2c_RPI_Setuplib = lib(pathmacros + "Hardware\RasberryPi\Setup" + filesep()); +sci2c_RPI_Shiftlib = lib(pathmacros + "Hardware\RasberryPi\Shift" + filesep()); +sci2c_RPI_Softlib = lib(pathmacros + "Hardware\RasberryPi\Soft" + filesep()); +sci2c_RPI_SPIlib = lib(pathmacros + "Hardware\RasberryPi\SPI" + filesep()); +sci2c_RPI_Timinglib = lib(pathmacros + "Hardware\RasberryPi\Timing" + filesep()); sci2c_ScilabArduinolib = lib(pathmacros + "Scilab-Arduino" + filesep()); sci2c_CVCorelib = lib(pathmacros + "ImageProcessing\core" + filesep()); sci2c_CVHighguilib = lib(pathmacros + "ImageProcessing\highgui" + filesep()); diff --git a/2.3-1/includes/sci2clib.h b/2.3-1/includes/sci2clib.h index 10476ea5..19169a94 100644 --- a/2.3-1/includes/sci2clib.h +++ b/2.3-1/includes/sci2clib.h @@ -187,6 +187,9 @@ extern "C" { /*interfacing isscalar*/ #include "isscalar.h" #include "int_isscalar.h" +/*interfacing isvector*/ +#include "isvector.h" +#include "int_isvector.h" /*interfacing iscolumn*/ #include "iscolumn.h" #include "int_iscolumn.h" @@ -470,6 +473,9 @@ extern "C" { /*interfacing matrix*/ #include "int_matrix.h" #include "matrix.h" +/*interfacing nnz*/ +#include "int_nnz.h" +#include "nnz.h" /*interfacing cumprod*/ #include "int_cumprod.h" #include "cumprod.h" @@ -600,6 +606,9 @@ extern "C" { /* interfacing mean */ #include "mean.h" #include "int_mean.h" +/* interfacing median */ +#include "median.h" +#include "int_median.h" /* interfacing stdevf */ #include "stdevf.h" #include "int_stdevf.h" diff --git a/2.3-1/jar/scilab_en_US_help.jar b/2.3-1/jar/scilab_en_US_help.jar Binary files differindex 45e15edf..90c41f4b 100644 --- a/2.3-1/jar/scilab_en_US_help.jar +++ b/2.3-1/jar/scilab_en_US_help.jar diff --git a/2.3-1/jar/scilab_en_US_help.jar.orig b/2.3-1/jar/scilab_en_US_help.jar.orig Binary files differdeleted file mode 100644 index 0b187e27..00000000 --- a/2.3-1/jar/scilab_en_US_help.jar.orig +++ /dev/null diff --git a/2.3-1/macros/ASTManagement/lib b/2.3-1/macros/ASTManagement/lib Binary files differdeleted file mode 100644 index dee4362f..00000000 --- a/2.3-1/macros/ASTManagement/lib +++ /dev/null diff --git a/2.3-1/macros/CCodeGeneration/lib b/2.3-1/macros/CCodeGeneration/lib Binary files differdeleted file mode 100644 index 3d4fed1d..00000000 --- a/2.3-1/macros/CCodeGeneration/lib +++ /dev/null diff --git a/2.3-1/macros/ErrorMessages/lib b/2.3-1/macros/ErrorMessages/lib Binary files differdeleted file mode 100644 index ba3b9a5a..00000000 --- a/2.3-1/macros/ErrorMessages/lib +++ /dev/null diff --git a/2.3-1/macros/FunctionAnnotation/lib b/2.3-1/macros/FunctionAnnotation/lib Binary files differdeleted file mode 100644 index 239105c8..00000000 --- a/2.3-1/macros/FunctionAnnotation/lib +++ /dev/null diff --git a/2.3-1/macros/FunctionList/lib b/2.3-1/macros/FunctionList/lib Binary files differdeleted file mode 100644 index 1c722dd0..00000000 --- a/2.3-1/macros/FunctionList/lib +++ /dev/null diff --git a/2.3-1/macros/GeneralFunctions/lib b/2.3-1/macros/GeneralFunctions/lib Binary files differdeleted file mode 100644 index 7586a91b..00000000 --- a/2.3-1/macros/GeneralFunctions/lib +++ /dev/null diff --git a/2.3-1/macros/Hardware/AVR/lib b/2.3-1/macros/Hardware/AVR/lib Binary files differdeleted file mode 100644 index ed4c52b8..00000000 --- a/2.3-1/macros/Hardware/AVR/lib +++ /dev/null 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- +// <itemizedlist> +// <listitem><para>'in' -> sets the pin as input</para></listitem> +// <listitem><para>'out' -> sets the pin as output</para></listitem> +// <listitem><para>'pwm' -> sets the pin to PWM output. Only wiringPi pin 1 (BCM_GPIO pin 18) supports this function.</para></listitem> +// <listitem><para>'clock' -> sets the pin to CLOCK output. Only wiringPi pin 7 (BCM_GPIO pin 4) supports this function.</para></listitem> +// </itemizedlist> +// +// 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: +// <itemizedlist> +// <listitem>0 : Input</listitem> +// <listitem>1 : Output</listitem> +// <listitem>2 : ALT5</listitem> +// <listitem>3 : ALT4</listitem> +// <listitem>4 : ALT0</listitem> +// <listitem>5 : ALT1</listitem> +// <listitem>6 : ALT2</listitem> +// <listitem>7 : ALT3</listitem> +// </itemizedlist> +// +//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: +// <itemizedlist> +// <listitem>'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.</listitem> +// <listitem>'GPIO' -> Same as above, however it allows the calling programs to use the Broadcom GPIO pin numbers directly with no re-mapping.</listitem> +// <listitem>'phys' -> Identical to above, however it allows the calling programs to use the physical pin numbers on the P1 connector only.</listitem> +// </itemizedlist> +// +// 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: +// <itemizedlist> +// <listitem>'up' -> pull to 3.3v</listitem> +// <listitem>'down'-> pull to ground</listitem> +// <listitem>'none'-> no pull up/down</listitem> +// </itemizedlist> +// +// 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 index 2954a424..07b564e3 100644..100755 --- 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: +// <itemizedlist> +// <listitem>0 :Portrait</listitem> +// <listitem>1 :Landscape</listitem> +// <listitem>2 :Portrait, flipped</listitem> +// <listitem>3 :Landscape, flipped</listitem> +// </itemizedlist> +// +// 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 Binary files differdeleted file mode 100644 index eec912f5..00000000 --- a/2.3-1/macros/Hardware/RasberryPi/lib +++ /dev/null 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 index fa647761..9f20c937 100644..100755 --- 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/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 [0<value,value<1024] then + commande="pwW#2#"+string(pin)+"#"+string(value)+"#"; + else + error("Voltage has to be between 0 and 1024"); + 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/buildmacros.sce b/2.3-1/macros/Hardware/RasberryPi/pwm/buildmacros.sce new file mode 100755 index 00000000..7d533f7b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pwm/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/pwm/names b/2.3-1/macros/Hardware/RasberryPi/pwm/names new file mode 100755 index 00000000..87e70884 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/pwm/names @@ -0,0 +1,5 @@ +RPI_pwmClock +RPI_pwmMode +RPI_pwmRange +RPI_pwmToneWrite +RPI_pwmWrite diff --git a/2.3-1/macros/Hardware/RasberryPi/raspi.sci b/2.3-1/macros/Hardware/RasberryPi/raspi.sci new file mode 100755 index 00000000..4da09ca4 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/raspi.sci @@ -0,0 +1,94 @@ +// 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;
+
+if getos()=="Linux" then
+ RPI_MacrosPath=get_absolute_file_path("raspi.sci");
+ RPI_MacrosPath=part(RPI_MacrosPath,1:(length(RPI_MacrosPath)-7));
+ RPI_MacrosPath=RPI_MacrosPath+'src/python/';
+// disp("Linux");
+ function raspi(adress,local,username)
+ // Function to initiate the connection to the raspberry pi
+ //
+ // Calling Sequence
+ // raspi(adress,local,username)
+ //
+ // Parameters
+ // address : Network address of the raspberry pi. Eg:10.42.0.82
+ // local : username of the local computer.
+ // 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('10.42.0.82','panda','pi')
+ // See also
+ // raspi_close
+ //
+ // Authors
+ // Jorawar Singh
+
+ global RPI_piAdress;
+ RPI_piAdress=adress;
+
+ disp("Step 1/6")
+ TCL_EvalStr("if {[file exists /home/"+local+"/.ssh/id_rsa]} {} else {exec ssh-keygen -N """" -f /home/"+local+"/.ssh/id_rsa -q}");
+ disp("Step 2/6")
+ TCL_EvalStr("exec ssh-add >logs.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 Binary files differdeleted file mode 100644 index 40b7b0a1..00000000 --- a/2.3-1/macros/ImageProcessing/core/lib +++ /dev/null diff --git a/2.3-1/macros/ImageProcessing/highgui/lib b/2.3-1/macros/ImageProcessing/highgui/lib Binary files differdeleted file mode 100644 index 0d7f88a9..00000000 --- a/2.3-1/macros/ImageProcessing/highgui/lib +++ /dev/null diff --git a/2.3-1/macros/ImageProcessing/imgproc/lib b/2.3-1/macros/ImageProcessing/imgproc/lib Binary files differdeleted file mode 100644 index 63b5e7e9..00000000 --- a/2.3-1/macros/ImageProcessing/imgproc/lib +++ /dev/null diff --git a/2.3-1/macros/Scilab-Arduino/buildmacros.sce b/2.3-1/macros/Scilab-Arduino/buildmacros.sce index dfeb4755..7d533f7b 100644..100755 --- 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 Binary files differdeleted file mode 100644 index a62fd4e4..00000000 --- a/2.3-1/macros/Scilab-Arduino/lib +++ /dev/null diff --git a/2.3-1/macros/SymbolTable/lib b/2.3-1/macros/SymbolTable/lib Binary files differdeleted file mode 100644 index 4379c83d..00000000 --- a/2.3-1/macros/SymbolTable/lib +++ /dev/null diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index 265dd953..f5cad92d 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -1047,6 +1047,39 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+// -------------------
+// --- Class Isvector. ---
+// -------------------
+ClassName = 'Isvector';
+
+// --- 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');
+//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');
+//---Function list class. ----
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('d2'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('s2'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('s0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('g2'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('g0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('z2'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('z0'+ArgSeparator+'g0',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'isvector';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
// -------------------
// --- Class Iscolumn. ---
// -------------------
@@ -1911,6 +1944,11 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'median'; // BJ : Done AS : Float_Done
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
FunctionName = 'st_deviation'; // BJ : Not implemented
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
@@ -6237,6 +6275,30 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,E INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
//------------------------------------
+//---- Class RPI_0IN_i8 ------------
+//------------------------------------
+ClassName = 'RPI_0IN_i8';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 0',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''i8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo(''+ArgSeparator+'i80',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'RPI_lcd128x64setup';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
//---- Class RPI_1IN_u8_Void -------
//------------------------------------
ClassName = 'RPI_1IN_u8_Void';
@@ -6288,6 +6350,14 @@ FunctionName = 'RPI_softToneStop'; PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'RPI_lcd128x64clear';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'RPI_lcd128x64Orientation';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
//------------------------------------
//---- Class RPI_1IN_u16_Void ------
@@ -6562,6 +6632,7 @@ PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); // --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
PrintStringInfo('u80u80'+ArgSeparator+'',ClassFileName,'file','y');
+PrintStringInfo('u80d0'+ArgSeparator+'',ClassFileName,'file','y');
PrintStringInfo('d0d0'+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
@@ -6609,6 +6680,10 @@ FunctionName = 'RPI_serialPutchar'; PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'RPI_lcd128x64setOrigin';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
//------------------------------------
//---- Class RPI_2IN_u8u16_Void ----
@@ -6822,9 +6897,9 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,E INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
//------------------------------------
-//---- Class RPI_2IN_u16u8_u8 -----
+//---- Class RPI_2IN_u16u8_i8 -----
//------------------------------------
-ClassName = 'RPI_2IN_u16u8_u8';
+ClassName = 'RPI_2IN_u16u8_i8';
// --- Class Annotation. ---
PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
@@ -6837,8 +6912,8 @@ PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); // --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-PrintStringInfo('u160u80'+ArgSeparator+'u80',ClassFileName,'file','y');
-PrintStringInfo('d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u160u80'+ArgSeparator+'i80',ClassFileName,'file','y');
+PrintStringInfo('d0d0'+ArgSeparator+'i80',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
FunctionName = 'RPI_pcf8574Setup';
@@ -6871,11 +6946,16 @@ ClassName = 'RPI_3IN_u8u8u8_Void'; PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
PrintStringInfo('NIN= 3',ClassFileName,'file','y');
-PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 0',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
// --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
PrintStringInfo('u80u80u80'+ArgSeparator+'',ClassFileName,'file','y');
+PrintStringInfo('u80u80d0'+ArgSeparator+'',ClassFileName,'file','y');
+PrintStringInfo('u80d0d0'+ArgSeparator+'',ClassFileName,'file','y');
PrintStringInfo('d0d0d0'+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
@@ -6887,6 +6967,18 @@ FunctionName = 'RPI_piGlow1'; PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'RPI_serialPutchar';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'RPI_lcd128x64point';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'RPI_lcd128x64lineTo';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
//------------------------------------
//---- Class RPI_3IN_u16u16u16_i8 --
@@ -6898,6 +6990,9 @@ PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
PrintStringInfo('NIN= 3',ClassFileName,'file','y');
PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''i8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
// --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
@@ -6924,6 +7019,9 @@ PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
PrintStringInfo('NIN= 3',ClassFileName,'file','y');
PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
// --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
@@ -7040,6 +7138,72 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+//---------------------------------------
+//---- Class RPI_5IN_u8u8u8u8u8_Void --
+//---------------------------------------
+ClassName = 'RPI_5IN_u8u8u8u8u8_Void';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 5',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 0',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('u80u80u80u80u80'+ArgSeparator+'i80',ClassFileName,'file','y');
+PrintStringInfo('d0d0d0d0d0'+ArgSeparator+'i80',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'RPI_lcd128x64line';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'RPI_lcd128x64circle';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'RPI_lcd128x64putchar';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'RPI_lcd128x64puts';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//-----------------------------------------
+//---- Class RPI_6IN_u8u8u8u8u8u8_Void --
+//-----------------------------------------
+ClassName = 'RPI_6IN_u8u8u8u8u8u8_Void';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 6',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 0',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('u80u80u80u80u80u80'+ArgSeparator+'i80',ClassFileName,'file','y');
+PrintStringInfo('d0d0d0d0d0d0'+ArgSeparator+'i80',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'RPI_lcd128x64rectangle';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'RPI_lcd128x64ellipse';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
//------------------------------------
//---- Class RPI_10IN_u8x10_Void ---
//------------------------------------
@@ -7057,6 +7221,7 @@ PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); // --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
PrintStringInfo('u80u80u80u80u80u80u80u80u80u80'+ArgSeparator+'',ClassFileName,'file','y');
+PrintStringInfo('u80d0d0d0d0d0d0d0d0d0'+ArgSeparator+'',ClassFileName,'file','y');
PrintStringInfo('d0d0d0d0d0d0d0d0d0d0'+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
@@ -7073,7 +7238,7 @@ ClassName = 'RPI_13IN_u8x13_u8'; // --- Class Annotation. ---
PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
-PrintStringInfo('NIN= 10',ClassFileName,'file','y');
+PrintStringInfo('NIN= 13',ClassFileName,'file','y');
PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
@@ -7243,30 +7408,50 @@ PrintStringInfo('OUT(1).SZ(2)= IN(3).VAL',ClassFileName,'file','y'); ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
PrintStringInfo('d2d0d0'+ArgSeparator+'d2',ClassFileName,'file','y');
PrintStringInfo('d2s0s0'+ArgSeparator+'d2',ClassFileName,'file','y');
-PrintStringInfo('d2u160u160'+ArgSeparator+'d2',ClassFileName,'file','y');
-PrintStringInfo('d2u80u80'+ArgSeparator+'d2',ClassFileName,'file','y');
PrintStringInfo('z2d0d0'+ArgSeparator+'z2',ClassFileName,'file','y');
PrintStringInfo('z2s0s0'+ArgSeparator+'z2',ClassFileName,'file','y');
-
PrintStringInfo('s2d0d0'+ArgSeparator+'s2',ClassFileName,'file','y');
PrintStringInfo('s2s0s0'+ArgSeparator+'s2',ClassFileName,'file','y');
-PrintStringInfo('s2u160u160'+ArgSeparator+'s2',ClassFileName,'file','y');
-PrintStringInfo('s2u80u80'+ArgSeparator+'s2',ClassFileName,'file','y');
-PrintStringInfo('u162'+ArgSeparator+'u162',ClassFileName,'file','y');
-PrintStringInfo('i162'+ArgSeparator+'i162',ClassFileName,'file','y');
-
PrintStringInfo('u162d0d0'+ArgSeparator+'u162',ClassFileName,'file','y');
PrintStringInfo('u162s0s0'+ArgSeparator+'u162',ClassFileName,'file','y');
-PrintStringInfo('u82g2'+ArgSeparator+'u82',ClassFileName,'file','y');
-PrintStringInfo('i82g2'+ArgSeparator+'i82',ClassFileName,'file','y');
-PrintStringInfo('u162g2'+ArgSeparator+'u162',ClassFileName,'file','y');
-PrintStringInfo('i162g2'+ArgSeparator+'i162',ClassFileName,'file','y');
+
// --- Annotation Function And Function List Function. ---
FunctionName = 'matrix';
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+//------------------------------------
+//---- Class NNZ---------------------
+//------------------------------------
+ClassName = 'NNZ';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+
+//Arguements specified: initial value, start time, time vector, ode function
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u16''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d2'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('d0'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('z2'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('z0'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('s2'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('s0'+ArgSeparator+'u160',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'nnz';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
//------------------------------------
//---- Class TRIU ---------------------
diff --git a/2.3-1/macros/ToolInitialization/lib b/2.3-1/macros/ToolInitialization/lib Binary files differdeleted file mode 100644 index 670a52e0..00000000 --- a/2.3-1/macros/ToolInitialization/lib +++ /dev/null diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci index a00d15e4..07ffd01e 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.sci +++ b/2.3-1/macros/findDeps/getAllHeaders.sci @@ -66,6 +66,7 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/matrixOperations/includes/diag.h" "src/c/matrixOperations/includes/cumsum.h" "src/c/matrixOperations/includes/matrix.h" + "src/c/matrixOperations/includes/nnz.h" "src/c/matrixOperations/includes/cumprod.h" "src/c/matrixOperations/includes/triu.h" "src/c/matrixOperations/includes/tril.h" @@ -133,6 +134,7 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/elementaryFunctions/includes/nthroot.h" "src/c/elementaryFunctions/includes/issquare.h" "src/c/elementaryFunctions/includes/isscalar.h" + "src/c/elementaryFunctions/includes/isvector.h" "src/c/elementaryFunctions/includes/iscolumn.h" "src/c/elementaryFunctions/includes/ismatrix.h" "src/c/elementaryFunctions/includes/asind.h" @@ -141,6 +143,7 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/statisticsFunctions/includes/variance.h" "src/c/statisticsFunctions/includes/sum.h" "src/c/statisticsFunctions/includes/mean.h" + "src/c/statisticsFunctions/includes/median.h" "src/c/statisticsFunctions/includes/meanf.h" "src/c/statisticsFunctions/includes/stdevf.h" "src/c/statisticsFunctions/includes/prod.h" diff --git a/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci index ece1685d..87b2be68 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.sci +++ b/2.3-1/macros/findDeps/getAllInterfaces.sci @@ -54,6 +54,7 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/matrixOperations/interfaces/int_diag.h" "src/c/matrixOperations/interfaces/int_cumsum.h" "src/c/matrixOperations/interfaces/int_matrix.h" + "src/c/matrixOperations/interfaces/int_nnz.h" "src/c/matrixOperations/interfaces/int_cumprod.h" "src/c/matrixOperations/interfaces/int_triu.h" "src/c/matrixOperations/interfaces/int_tril.h" @@ -104,6 +105,7 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/elementaryFunctions/interfaces/int_nthroot.h" "src/c/elementaryFunctions/interfaces/int_issquare.h" "src/c/elementaryFunctions/interfaces/int_isscalar.h" + "src/c/elementaryFunctions/interfaces/int_isvector.h" "src/c/elementaryFunctions/interfaces/int_iscolumn.h" "src/c/elementaryFunctions/interfaces/int_ismatrix.h" "src/c/elementaryFunctions/interfaces/int_logspace.h" @@ -130,6 +132,7 @@ function allInterfaces = getAllInterfaces(SharedInfo) "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_median.h" "src/c/statisticsFunctions/interfaces/int_meanf.h" "src/c/statisticsFunctions/interfaces/int_stdevf.h" "src/c/statisticsFunctions/interfaces/int_prod.h" diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci index b72a19f4..e4bb69d2 100644 --- a/2.3-1/macros/findDeps/getAllSources.sci +++ b/2.3-1/macros/findDeps/getAllSources.sci @@ -308,6 +308,12 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/matrixOperations/matrix/smatrixa.c" "src/c/matrixOperations/matrix/u16matrixa.c" "src/c/matrixOperations/matrix/zmatrixa.c" + "src/c/matrixOperations/nnz/dnnza.c" + "src/c/matrixOperations/nnz/dnnzs.c" + "src/c/matrixOperations/nnz/snnza.c" + "src/c/matrixOperations/nnz/snnzs.c" + "src/c/matrixOperations/nnz/znnza.c" + "src/c/matrixOperations/nnz/znnzs.c" "src/c/matrixOperations/triu/dtriua.c" "src/c/matrixOperations/triu/striua.c" "src/c/matrixOperations/triu/u8triua.c" @@ -798,7 +804,6 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/elementaryFunctions/nthroot/snthroota.c" "src/c/elementaryFunctions/nthroot/snthroot1a.c" "src/c/elementaryFunctions/nthroot/snthroots.c" - "src/c/elementaryFunctions/isscalar/disscalara.c" "src/c/elementaryFunctions/isscalar/disscalars.c" "src/c/elementaryFunctions/isscalar/gisscalars.c" @@ -817,6 +822,14 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/elementaryFunctions/iscolumn/ziscolumns.c" "src/c/elementaryFunctions/iscolumn/u16iscolumna.c" "src/c/elementaryFunctions/iscolumn/u16iscolumns.c" + "src/c/elementaryFunctions/isvector/disvectora.c" + "src/c/elementaryFunctions/isvector/disvectors.c" + "src/c/elementaryFunctions/isvector/gisvectors.c" + "src/c/elementaryFunctions/isvector/gisvectora.c" + "src/c/elementaryFunctions/isvector/sisvectors.c" + "src/c/elementaryFunctions/isvector/sisvectora.c" + "src/c/elementaryFunctions/isvector/zisvectora.c" + "src/c/elementaryFunctions/isvector/zisvectors.c" "src/c/elementaryFunctions/ismatrix/dismatrixa.c" "src/c/elementaryFunctions/ismatrix/dismatrixs.c" //"src/c/elementaryFunctions/ismatrix/gismatrixs.c" @@ -915,6 +928,18 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/statisticsFunctions/meanf/zmeanfdz.c" "src/c/statisticsFunctions/meanf/cmeanfsc.c" "src/c/statisticsFunctions/meanf/zcolumnmeanfa.c" +"src/c/statisticsFunctions/median/dmediana.c" +"src/c/statisticsFunctions/median/dmedianrowa.c" +"src/c/statisticsFunctions/median/dmediancola.c" +"src/c/statisticsFunctions/median/smediana.c" +"src/c/statisticsFunctions/median/smedianrowa.c" +"src/c/statisticsFunctions/median/smediancola.c" +"src/c/statisticsFunctions/median/u16mediana.c" +"src/c/statisticsFunctions/median/u16medianrowa.c" +"src/c/statisticsFunctions/median/u16mediancola.c" +"src/c/statisticsFunctions/median/zmediana.c" +"src/c/statisticsFunctions/median/zmediancola.c" +"src/c/statisticsFunctions/median/zmedianrowa.c" "src/c/statisticsFunctions/prod/srowproda.c" "src/c/statisticsFunctions/prod/drowproda.c" "src/c/statisticsFunctions/prod/dproda.c" diff --git a/2.3-1/macros/findDeps/lib b/2.3-1/macros/findDeps/lib Binary files differdeleted file mode 100644 index afcd3cab..00000000 --- a/2.3-1/macros/findDeps/lib +++ /dev/null diff --git a/2.3-1/macros/lib b/2.3-1/macros/lib Binary files differdeleted file mode 100644 index 551263ea..00000000 --- a/2.3-1/macros/lib +++ /dev/null diff --git a/2.3-1/src/c/auxiliaryFunctions/abs/zabss.c b/2.3-1/src/c/auxiliaryFunctions/abs/zabss.c index 4e7b4dd3..7ada57d1 100644 --- a/2.3-1/src/c/auxiliaryFunctions/abs/zabss.c +++ b/2.3-1/src/c/auxiliaryFunctions/abs/zabss.c @@ -16,6 +16,7 @@ #include "sqrt.h" #include "max.h" #include "min.h" +#include "doubleComplex.h" double zabss(doubleComplex in) { double real = dabss(zreals(in)); diff --git a/2.3-1/src/c/elementaryFunctions/includes/isvector.h b/2.3-1/src/c/elementaryFunctions/includes/isvector.h new file mode 100644 index 00000000..5f45abbe --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/isvector.h @@ -0,0 +1,38 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __ISVECTOR_H__ +#define __ISVECTOR_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +char disvectora(double* , int); +char disvectors(double); +char sisvectora( float* , int); +char sisvectors( float); +char gisvectora(char* , int); +char gisvectors(char); +char zisvectora(doubleComplex*, int); +char zisvectors(doubleComplex); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_isvector.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_isvector.h new file mode 100644 index 00000000..6d943bd3 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_isvector.h @@ -0,0 +1,26 @@ + /*This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_ISVECTOR_H__ +#define __INT_ISVECTOR_H__ + +#define d2isvectorg0(in, size ) disvectora(in, size[0]) +#define d0isvectorg0(in) disvectors(in) +#define s2isvectorg0(in , size) sisvectora(in, size[0]) +#define s0isvectorg0(in) sisvectors(in) +#define g2isvectorg0(in, size) gisvectora(in, size[0]) +#define g0isvectorg0(in) gisvectors(in) +#define z2isvectorg0(in, size) zisvectora(in , size[0]) +#define z0isvectorg0(in) zisvectors(in) + + +#endif diff --git a/2.3-1/src/c/elementaryFunctions/isvector/disvectora.c b/2.3-1/src/c/elementaryFunctions/isvector/disvectora.c new file mode 100644 index 00000000..3c41027f --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/disvectora.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" +char disvectora(double* inp, int size1) +{ + if(size1 ==1) + return 'T'; + return 'F'; +} diff --git a/2.3-1/src/c/elementaryFunctions/isvector/disvectors.c b/2.3-1/src/c/elementaryFunctions/isvector/disvectors.c new file mode 100644 index 00000000..703e6673 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/disvectors.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" + +char disvectors(double inp) +{ + double out='F'; + + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/isvector/gisvectora.c b/2.3-1/src/c/elementaryFunctions/isvector/gisvectora.c new file mode 100644 index 00000000..d2e261e9 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/gisvectora.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" +#include "string.h" +char gisvectora(char *inp, int size1) +{ + if(size1 ==1) + return 'T'; + return 'F'; +} diff --git a/2.3-1/src/c/elementaryFunctions/isvector/gisvectors.c b/2.3-1/src/c/elementaryFunctions/isvector/gisvectors.c new file mode 100644 index 00000000..72118603 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/gisvectors.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" + +char gisvectors(char inp) +{ + char out='F'; + + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/isvector/sisvectora.c b/2.3-1/src/c/elementaryFunctions/isvector/sisvectora.c new file mode 100644 index 00000000..09ad6515 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/sisvectora.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" +char sisvectora(float* inp, int size1) +{ + if(size1 ==1) + return 'T'; + return 'F'; +} diff --git a/2.3-1/src/c/elementaryFunctions/isvector/sisvectors.c b/2.3-1/src/c/elementaryFunctions/isvector/sisvectors.c new file mode 100644 index 00000000..019bd464 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/sisvectors.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" + +char sisvectors(float inp) +{ + char out='F'; + + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/isvector/zisvectora.c b/2.3-1/src/c/elementaryFunctions/isvector/zisvectora.c new file mode 100644 index 00000000..fba78124 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/zisvectora.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "doubleComplex.h" +#include "isvector.h" +#include "types.h" + +char zisvectora(doubleComplex *inp, int size1) +{ + if(size1 ==1) + return 'T'; + return 'F'; +} diff --git a/2.3-1/src/c/elementaryFunctions/isvector/zisvectors.c b/2.3-1/src/c/elementaryFunctions/isvector/zisvectors.c new file mode 100644 index 00000000..bc9e5ce6 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isvector/zisvectors.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" +#include "doubleComplex.h" + +char zisvectors(doubleComplex inp) +{ + char out='F'; + + return out; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralLCD128x64.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralLCD128x64.h index d541c9fd..93bdf279 100644 --- a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralLCD128x64.h +++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralLCD128x64.h @@ -22,13 +22,17 @@ extern "C" { int8 RPI_lcd128x64setup(void); void u8RPI_lcd128x64clears(uint8 colour); void u8RPI_lcd128x64Orientations(uint8 orientation); + void u8RPI_lcd128x64setOrigins(uint8 x, uint8 y); + void u8RPI_lcd128x64points(uint8 x, uint8 y, uint8 colour); void u8RPI_lcd128x64lineTos(uint8 x, uint8 y, uint8 colour); + void u8RPI_lcd128x64lines(uint8 x0, uint8 y0, uint8 x1, uint8 y1, uint8 colour); void u8RPI_lcd128x64circles(uint8 x, uint8 y, uint8 r, uint8 colour, uint8 filled); void u8RPI_lcd128x64putchars(uint8 x, uint8 y, uint8 c, uint8 bgCol, uint8 fgCol); void u8RPI_lcd128x64putss(uint8 x, uint8 y, char *str,int size, uint8 bgCol, uint8 fgCol); + void u8RPI_lcd128x64rectangles(uint8 x1, uint8 y1, uint8 x2, uint8 y2, uint8 colour, uint8 filled); void u8RPI_lcd128x64ellipses(uint8 cx, uint8 cy, uint8 xRadius, uint8 yRadius, uint8 colour, uint8 filled); diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD.h index e6dcb7db..803f93e3 100644 --- a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD.h +++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD.h @@ -21,18 +21,22 @@ extern "C" { #endif #define u80u80u80u80u80u80u80u80u80u80RPI_lcdCharDef(fd,index,d0,d1,d2,d3,d4,d5,d6,d7) u8RPI_lcdCharDefs(fd,index,d0,d1,d2,d3,d4,d5,d6,d7); +#define u80d0d0d0d0d0d0d0d0d0RPI_lcdCharDef(fd,index,d0,d1,d2,d3,d4,d5,d6,d7) u8RPI_lcdCharDefs(fd,index,d0,d1,d2,d3,d4,d5,d6,d7); #define d0d0d0d0d0d0d0d0d0d0RPI_lcdCharDef(fd,index,d0,d1,d2,d3,d4,d5,d6,d7) u8RPI_lcdCharDefs(fd,index,d0,d1,d2,d3,d4,d5,d6,d7); #define u80RPI_lcdClear(fd) u8RPI_lcdClears(fd); #define d0RPI_lcdClear(fd) u8RPI_lcdClears(fd); #define u80u80RPI_lcdCursorBlink(fd,state) u8RPI_lcdCursorBlinks(fd,state); +#define u80d0RPI_lcdCursorBlink(fd,state) u8RPI_lcdCursorBlinks(fd,state); #define d0d0RPI_lcdCursorBlink(fd,state) u8RPI_lcdCursorBlinks(fd,state); #define u80u80RPI_lcdCursor(fd,state) u8RPI_lcdCursors(fd,state); +#define u80d0RPI_lcdCursor(fd,state) u8RPI_lcdCursors(fd,state); #define d0d0RPI_lcdCursor(fd,state) u8RPI_lcdCursors(fd,state); #define u80u80RPI_lcdDisplay(fd,state) u8RPI_lcdDisplays(fd,state); +#define u80d0RPI_lcdDisplay(fd,state) u8RPI_lcdDisplays(fd,state); #define d0d0RPI_lcdDisplay(fd,state) u8RPI_lcdDisplays(fd,state); #define u80RPI_lcdHome(fd) u8RPI_lcdHomes(fd); @@ -42,12 +46,15 @@ extern "C" { #define d0d0d0d0d0d0d0d0d0d0d0d0d0RPI_lcdIniti80(rows,cols,bits,rs,strb,d0,d1,d2,d3,d4,d5,d6,d7) u8RPI_lcdInits(rows,cols,bits,rs,strb,d0,d1,d2,d3,d4,d5,d6,d7); #define u80u80u80RPI_lcdPosition(fd,row,col) u8RPI_lcdPositions(fd,row,col); +#define u80d0d0RPI_lcdPosition(fd,row,col) u8RPI_lcdPositions(fd,row,col); #define d0d0d0RPI_lcdPosition(fd,row,col) u8RPI_lcdPositions(fd,row,col); #define u80u80RPI_lcdPutchar(fd,char) u8RPI_lcdPutchars(fd,char); +#define u80d0RPI_lcdPutchar(fd,char) u8RPI_lcdPutchars(fd,char); #define d0d0RPI_lcdPutchar(fd,char) u8RPI_lcdPutchars(fd,char); #define u80u80RPI_lcdSendCommand(fd,cmd) u8RPI_lcdSendCommands(fd,cmd); +#define u80d0RPI_lcdSendCommand(fd,cmd) u8RPI_lcdSendCommands(fd,cmd); #define d0d0RPI_lcdSendCommand(fd,cmd) u8RPI_lcdSendCommands(fd,cmd); #define u80g2RPI_lcdPuts(fd,msg,size) u8RPI_lcdPutss(fd,msg,size[1]);; diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD128x64.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD128x64.h index 77cc433c..8bb4b17e 100644 --- a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD128x64.h +++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD128x64.h @@ -33,6 +33,7 @@ extern "C" { #define u80u80u80RPI_lcd128x64point(x,y,colour) u8RPI_lcd128x64points(x,y,colour); #define d0d0d0RPI_lcd128x64point(x,y,colour) u8RPI_lcd128x64points(x,y,colour); + #define u80u80u80RPI_lcd128x64lineTo(x,y,colour) u8RPI_lcd128x64lineTos(x,y,colour); #define d0d0d0RPI_lcd128x64lineTo(x,y,colour) u8RPI_lcd128x64lineTos(x,y,colour); diff --git a/2.3-1/src/c/matrixOperations/includes/matrix.h b/2.3-1/src/c/matrixOperations/includes/matrix.h index dbb0e223..582fd221 100644 --- a/2.3-1/src/c/matrixOperations/includes/matrix.h +++ b/2.3-1/src/c/matrixOperations/includes/matrix.h @@ -16,6 +16,8 @@ #include "types.h" #include "doubleComplex.h" +#include "uint16.h" + #ifdef __cplusplus extern "C" { diff --git a/2.3-1/src/c/matrixOperations/includes/nnz.h b/2.3-1/src/c/matrixOperations/includes/nnz.h new file mode 100644 index 00000000..c7d2d491 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/includes/nnz.h @@ -0,0 +1,37 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __NNZ_H__ +#define __NNZ_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint16 dnnza(double* , int , int); +uint16 dnnzs(double); +uint16 snnza( float* , int , int); +uint16 snnzs( float); +uint16 znnza(doubleComplex *, int , int); +uint16 znnzs(doubleComplex); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__NNZ_H__*/ diff --git a/2.3-1/src/c/matrixOperations/interfaces/int_matrix.h b/2.3-1/src/c/matrixOperations/interfaces/int_matrix.h index f69ba116..5935f4a3 100644 --- a/2.3-1/src/c/matrixOperations/interfaces/int_matrix.h +++ b/2.3-1/src/c/matrixOperations/interfaces/int_matrix.h @@ -46,4 +46,4 @@ extern "C" { } /* extern "C" */ #endif -#endif /*__INT_CUMSUM_H__*/ +#endif /*__INT_MATRIX_H__*/ diff --git a/2.3-1/src/c/matrixOperations/interfaces/int_nnz.h b/2.3-1/src/c/matrixOperations/interfaces/int_nnz.h new file mode 100644 index 00000000..0ef39536 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/interfaces/int_nnz.h @@ -0,0 +1,35 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_NNZ_H__ +#define __INT_NNZ_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2nnzu160(in1, size) dnnza(in1, size[0], size[1]) +#define d0nnzu160(in) dnnzs(in) + +#define s2nnzu160(in1, size) snnza(in1, size[0], size[1]) +#define s0nnzu160(in) snnzs(in) + +#define z2nnzu160(in1, size) znnza(in1, size[0], size[1]) +#define z0nnzu160(in) znnzs(in) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_NNZ_H__*/ diff --git a/2.3-1/src/c/matrixOperations/nnz/dnnza.c b/2.3-1/src/c/matrixOperations/nnz/dnnza.c new file mode 100644 index 00000000..b4d40bd8 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/nnz/dnnza.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" + +uint16 dnnza(double *in, int irow, int icolumn) +{ + int i; + uint16 final=0; + for(i=0; i< irow*icolumn ; i++) + { + if( in[i] != 0) + { + final++; + + } + + } +return final; +} diff --git a/2.3-1/src/c/matrixOperations/nnz/dnnzs.c b/2.3-1/src/c/matrixOperations/nnz/dnnzs.c new file mode 100644 index 00000000..c878d331 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/nnz/dnnzs.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" + +uint16 dnnzs(double in) +{ + if(in !=0) + return 1; + else + return 0; +} diff --git a/2.3-1/src/c/matrixOperations/nnz/snnza.c b/2.3-1/src/c/matrixOperations/nnz/snnza.c new file mode 100644 index 00000000..df27f0fe --- /dev/null +++ b/2.3-1/src/c/matrixOperations/nnz/snnza.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" + +uint16 snnza(float*in, int irow, int icolumn) +{ + int i; + uint16 final=0; + for(i=0; i< irow*icolumn ; i++) + { + if( in[i] != 0) + { + final++; + + } + + } +return final; +} diff --git a/2.3-1/src/c/matrixOperations/nnz/snnzs.c b/2.3-1/src/c/matrixOperations/nnz/snnzs.c new file mode 100644 index 00000000..674d4fac --- /dev/null +++ b/2.3-1/src/c/matrixOperations/nnz/snnzs.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" + +uint16 snnzs(float in) +{ + if(in !=0) + return 1; + else + return 0; +} diff --git a/2.3-1/src/c/matrixOperations/nnz/znnza.c b/2.3-1/src/c/matrixOperations/nnz/znnza.c new file mode 100644 index 00000000..3b913e8b --- /dev/null +++ b/2.3-1/src/c/matrixOperations/nnz/znnza.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" +uint16 znnza(doubleComplex* in, int irow, int icolumn) +{ + int i; + uint16 final=0; + for(i=0; i< irow*icolumn ; i++) + { + if(( zreals(in[i]) !=0 )||( zimags(in[i])!=0)) + { + final++; + + } + + } +return final; +} diff --git a/2.3-1/src/c/matrixOperations/nnz/znnzs.c b/2.3-1/src/c/matrixOperations/nnz/znnzs.c new file mode 100644 index 00000000..2907afcf --- /dev/null +++ b/2.3-1/src/c/matrixOperations/nnz/znnzs.c @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +uint16 znnzs(doubleComplex in) +{ + if((zreals(in)== 0 ) && (zimags(in)==0)) + return 0; + else + return 1; +} diff --git a/2.3-1/src/c/operations/addition/zadds.c b/2.3-1/src/c/operations/addition/zadds.c index d4a94dc5..768faf38 100644 --- a/2.3-1/src/c/operations/addition/zadds.c +++ b/2.3-1/src/c/operations/addition/zadds.c @@ -11,6 +11,7 @@ */ #include "addition.h" +#include "doubleComplex.h" doubleComplex zadds(doubleComplex z1, doubleComplex z2) { return DoubleComplex(zreals(z1) + zreals(z2), diff --git a/2.3-1/src/c/statisticsFunctions/includes/median.h b/2.3-1/src/c/statisticsFunctions/includes/median.h new file mode 100644 index 00000000..accb5df0 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/includes/median.h @@ -0,0 +1,46 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __MEDIAN_H__ +#define __MEDIAN_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dmediana(double* , int ); +void dmedianrowa(double*, int, int, double*); +void dmediancola(double*, int, int, double*); + +float smediana(float* , int ); +void smedianrowa(float*, int, int, float*); +void smediancola(float*, int, int, float*); + +uint16 u16mediana(uint16* , int ); +void u16medianrowa(uint16*, int, int, uint16*); +void u16mediancola(uint16*, int, int, uint16*); + +doubleComplex zmediana(doubleComplex* , int ); +void zmedianrowa(doubleComplex*, int, int, doubleComplex*); +void zmediancola(doubleComplex*, int, int, doubleComplex*); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__MATRIX_H__*/ diff --git a/2.3-1/src/c/statisticsFunctions/interfaces/int_median.h b/2.3-1/src/c/statisticsFunctions/interfaces/int_median.h new file mode 100644 index 00000000..2a219870 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/interfaces/int_median.h @@ -0,0 +1,57 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_MEDIAN_H__ +#define __INT_MEDIAN_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2mediand0(in1, size) dmediana(in1, size[0]* size[1]) +#define d2g2mediand2(in1, size1, in2, size2, out) (in2[0]== 'r') ? dmedianrowa(in1, size1[0], size1[1], out) :dmediancola(in1, size1[0], size1[1], out) + +#define s2medians0(in1, size) smediana(in1, size[0]* size[1]) +#define s2g2medians2(in1, size1, in2, size2, out) (in2[0]== 'r') ? smedianrowa(in1, size1[0], size1[1], out) :smediancola(in1, size1[0], size1[1], out) + +#define u162medianu160(in1, size) u16mediana(in1, size[0]* size[1]) +#define u162g2medianu162(in1, size1, in2, size2, out) (in2[0]== 'r') ? u16medianrowa(in1, size1[0], size1[1], out) :u16mediancola(in1, size1[0], size1[1], out) + +#define z2medianz0(in1, size) zmediana(in1, size[0]* size[1]) +#define z2g2medianz2(in1, size1, in2, size2, out) (in2[0]== 'r') ? zmedianrowa(in1, size1[0], size1[1], out) :zmediancola(in1, size1[0], size1[1], out) + + +#define s2d0d0matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +#define s2s0s0matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) + +#define u162d0d0matrixu162(in1, size, in2, in3, out ) u16matrixa(in1, size[0], size[1], in2, in3, out) +#define u162s0s0matrixu162(in1, size, in2, in3, out ) u16matrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) + +#define z2d0d0matrixz2(in1, size, in2, in3, out ) zmatrixa(in1, size[0], size[1], in2, in3, out) +#define z2s0s0matrixz2(in1, size, in2, in3, out ) zmatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) + + + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_MATRIX_H__*/ diff --git a/2.3-1/src/c/statisticsFunctions/median/dmediana.c b/2.3-1/src/c/statisticsFunctions/median/dmediana.c new file mode 100644 index 00000000..cb2463c5 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/dmediana.c @@ -0,0 +1,58 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +double dmediana(double *in, int size) +{ + double a; double fin; + + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in[i] > in[j]) + + { + + a = in[i]; + + in[i] = in[j]; + + in[j] = a; + + } + + } + + } + + + if(size%2 ==0) + { + fin= (in[size/2]+ in[(size/2)-1])/2; + } + else + { + fin= in[(size-1)/2]; + } + + return fin; +} diff --git a/2.3-1/src/c/statisticsFunctions/median/dmediancola.c b/2.3-1/src/c/statisticsFunctions/median/dmediancola.c new file mode 100644 index 00000000..b3ff4fb8 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/dmediancola.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +void dmediancola(double *in, int row, int col, double* out) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= dmediana( inter, col); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/median/dmedianrowa.c b/2.3-1/src/c/statisticsFunctions/median/dmedianrowa.c new file mode 100644 index 00000000..4b5879c5 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/dmedianrowa.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +void dmedianrowa(double *in, int row, int col, double* out) +{ + double inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= dmediana( inter, row); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/median/smediana.c b/2.3-1/src/c/statisticsFunctions/median/smediana.c new file mode 100644 index 00000000..9e86b77e --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/smediana.c @@ -0,0 +1,57 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +float smediana(float *in, int size) +{ + float a; float fin; + + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in[i] > in[j]) + + { + + a = in[i]; + + in[i] = in[j]; + + in[j] = a; + + } + + } + + } + + if(size%2 ==0) + { + fin= (in[size/2]+ in[(size/2)-1])/2; + } + else + { + fin= in[(size-1)/2]; + } + + return fin; +} diff --git a/2.3-1/src/c/statisticsFunctions/median/smediancola.c b/2.3-1/src/c/statisticsFunctions/median/smediancola.c new file mode 100644 index 00000000..2fc4eaf1 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/smediancola.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +void smediancola(float *in, int row, int col, float* out) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= smediana( inter, col); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/median/smedianrowa.c b/2.3-1/src/c/statisticsFunctions/median/smedianrowa.c new file mode 100644 index 00000000..aab59382 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/smedianrowa.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +void smedianrowa(float *in, int row, int col, float* out) +{ + float inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= smediana( inter, row); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/median/u16mediana.c b/2.3-1/src/c/statisticsFunctions/median/u16mediana.c new file mode 100644 index 00000000..b45c5302 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/u16mediana.c @@ -0,0 +1,57 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +uint16 u16mediana(uint16 *in, int size) +{ + uint16 a; uint16 fin; + + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in[i] > in[j]) + + { + + a = in[i]; + + in[i] = in[j]; + + in[j] = a; + + } + + } + + } + + if(size%2 ==0) + { + fin= (in[size/2]+ in[(size/2)-1])/2; + } + else + { + fin= in[(size-1)/2]; + } + + return fin; +} diff --git a/2.3-1/src/c/statisticsFunctions/median/u16mediancola.c b/2.3-1/src/c/statisticsFunctions/median/u16mediancola.c new file mode 100644 index 00000000..77952a35 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/u16mediancola.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +void u16mediancola(uint16 *in, int row, int col, uint16* out) +{ + uint16 inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= u16mediana( inter, col); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/median/u16medianrowa.c b/2.3-1/src/c/statisticsFunctions/median/u16medianrowa.c new file mode 100644 index 00000000..8e5b98ef --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/u16medianrowa.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +void u16medianrowa(uint16 *in, int row, int col, uint16* out) +{ + uint16 inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= u16mediana( inter, row); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/median/zmediana.c b/2.3-1/src/c/statisticsFunctions/median/zmediana.c new file mode 100644 index 00000000..32726e77 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/zmediana.c @@ -0,0 +1,64 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" +#include "addition.h" +#include "division.h" +#include "abs.h" + +doubleComplex zmediana(doubleComplex *in, int size) +{ + doubleComplex a; doubleComplex fin; doubleComplex middle; + + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (zabss(in[i]) > zabss(in[j])) + + { + + a = in[i]; + + in[i] = in[j]; + + in[j] = a; + + } + + } + + } + + + + if(size%2 ==0) + { + middle= zadds(in[size/2], in[(size/2)-1]); + fin= zrdivs(middle, DoubleComplex(2,0)); + } + else + { + fin= in[(size-1)/2]; + } + + return fin; +} diff --git a/2.3-1/src/c/statisticsFunctions/median/zmediancola.c b/2.3-1/src/c/statisticsFunctions/median/zmediancola.c new file mode 100644 index 00000000..d709d98b --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/zmediancola.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void zmediancola(doubleComplex *in, int row, int col, doubleComplex * out) +{ + doubleComplex inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= zmediana( inter, col); + + } + + +} diff --git a/2.3-1/src/c/statisticsFunctions/median/zmedianrowa.c b/2.3-1/src/c/statisticsFunctions/median/zmedianrowa.c new file mode 100644 index 00000000..ab2e0d4a --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/median/zmedianrowa.c @@ -0,0 +1,37 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void zmedianrowa(doubleComplex *in, int row, int col, doubleComplex* out) +{ + doubleComplex inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= zmediana( inter, row); + + } + + +} diff --git a/2.3-1/src/python/serverWP.py b/2.3-1/src/python/serverWP.py new file mode 100755 index 00000000..c41c25f1 --- /dev/null +++ b/2.3-1/src/python/serverWP.py @@ -0,0 +1,203 @@ +import wiringpi as wp +import socket +import subprocess as sp +import logging +import traceback +import sys +import RPi.GPIO as GPIO + +logging.basicConfig(filename='log.txt',level=logging.DEBUG) +logger=logging.getLogger(__name__) +pinNum=0 +#wp.wiringPiSetup() +GPIO.setmode(GPIO.BCM) + +commands={ +'cls':'s.close()\n\ta="Connection Closed"\n\tgo=0', +'i2c':'if sys.version_info<(3,0):\n\t\ta=sp.check_output(inputList[0].split())\n\telse:\n\t\ta=sp.run(inputList[0].split(),stdout=sp.PIPE).stdout.decode("utf-8")', +'anR':'a=wp.analogRead(int(inputList[0]))', +'anW':'a=wp.analogWrite(int(inputList[0]),int(inputList[1]))', +'bRv':'a=wp.piBoardRev()', +'BtR':'a=wp.digitalReadByte()', +'BtW':'a=wp.digitalWriteByte(int(inputList[0]))', +'CR1':'a=wp.wiringPiI2CRead(int(inputList[0]))', +'CR2':'a=wp.wiringPiI2CReadReg8(int(inputList[0]),int(inputList[1]))', +'CR3':'a=wp.wiringPiI2CReadReg16(int(inputList[0]),int(inputList[1]))', +'CSe':'a=wp.wiringPiI2CSetup(int(inputList[0]))', +'CSI':'a=wp.wiringPiI2CSetupInterface(inputList[0],int(inputList[1]))', +'CW1':'a=wp.wiringPiI2CWrite(int(inputList[0]),int(inputList[1]))', +'CW2':'a=wp.wiringPiI2CWriteReg8(int(inputList[0]),int(inputList[1]),int(inputList[2]))', +'CW3':'a=wp.wiringPiI2CWriteReg16(int(inputList[0]),int(inputList[1]),int(inputList[2]))', +'deS':'a=wp.delay(int(inputList[0]))', +'deU':'a=wp.delayMicroseconds(int(inputList[0]))', +'diR':'a=wp.digitalRead(int(inputList[0]))', +'diW':'a=wp.digitalWrite(int(inputList[0]),int(inputList[1]))', +'dsS':'a=wp.ds1302Setup(int(inputList[0]),int(inputList[1]),int(inputList[2]),)', +'dsR':'a=wp.ds1302rtcRead(int(inputList[0]))', +'dsW':'a=wp.ds1302rtcWrite(int(inputList[0]),int(inputList[1]))', +'dsr':'a=wp.ds1302ramRead(int(inputList[0]))', +'dsw':'a=wp.ds1302ramWrite(int(inputList[0]),int(inputList[1]))', +'dsc':'a=wp.ds1302clockRead(int(inputList[0]))', +'dsC':'a=wp.ds1302clockWrite(int(inputList[0]))', +'dst':'a=wp.ds1302trickleCharge(int(inputList[0]),int(inputList[1]))', +'gAS':'a=wp.gertboardAnalogSetup(int(inputList[0]))', +'gAR':'a=wp.gertboardAnalogRead(int(inputList[0]))', +'gAt':'a=wp.getAlt(int(inputList[0]))', +'gAW':'a=wp.gertboardAnalogWrite(int(inputList[0]),int(inputList[1]))', +'gSS':'a=wp.gertboardSPISetup()', +'Int':'if pinNum==1:\n\t\tpin=wp.wpiPinToGpio(int(inputList[0]))\n\telif pinNum==2:\n\t\tpin=int(inputList[0])\n\telif pinNum==3:\n\t\tpin=wp.physPinToGpio(int(inputList[0]))\n\tGPIO.setup(pin,GPIO.IN,pull_up_down=GPIO.PUD_DOWN)\n\tif int(inputList[1])==-1:\n\t\ta=GPIO.wait_for_edge(pin,GPIO.RISING)\n\telse:\n\t\ta=GPIO.wait_for_edge(pin,GPIO.RISING,timeout=int(inputList[1]))\n\tif type(a)==int:\n\t\ta=1\n\telse:\n\t\ta=0', +#'a=wp.waitForInterrupt(int(inputList[0]),int(inputList[1]))', +#'ISR':'a=wp.wiringPiISR(int(inputList[0]),int(inputList[1]),inputList[2])', +'lCB':'a=wp.lcdCursorBlink(int(inputList[0]),int(inputList[1]))', +'lCD':'a=wp.lcdCharDef(int(inputList[0]),int(inputList[1]),[int(inputList[2]),int(inputList[3]),int(inputList[4]),int(inputList[5]),int(inputList[6]),int(inputList[7]),int(inputList[8]),int(inputList[9])])', +'lCl':'a=wp.lcdClear(int(inputList[0]))', +'lCu':'a=wp.lcdCursor(int(inputList[0]),int(inputList[1]))', +'lDs':'a=wp.lcdDisplay(int(inputList[0]),int(inputList[1]))', +'lHo':'a=wp.lcdHome(int(inputList[0]))', +'lIn':'a=wp.lcdInit(int(inputList[0]),int(inputList[1]),int(inputList[2]),int(inputList[3]),int(inputList[4]),int(inputList[5]),int(inputList[6]),int(inputList[7]),int(inputList[8]),int(inputList[9]),int(inputList[10]),int(inputList[11]),int(inputList[12]))', +'lok':'a=wp.piLock(int(inputList[0]))', +'lPc':'a=wp.lcdPutchar(int(inputList[0]),int(inputList[1]))', +'lPo':'a=wp.lcdPosition(int(inputList[0]),int(inputList[1]),int(inputList[2]))', +'lPf':'a=wp.lcdPrintf(int(inputList[0]),inputList[1])', +'lPu':'a=wp.lcdPuts(int(inputList[0]),inputList[1])', +'lSC':'a=wp.lcdSendCommand(int(inputList[0]),inputList[1])', +'Lse':'a=wp.lcd128x64setup()', +'Lup':'a=wp.lcd128x64update()', +'LOr':'a=wp.lcd128x64setOrigin(int(inputList[0]),int(inputList[1]))', +'LOn':'a=wp.lcd128x64setOrientation(int(inputList[0]))', +#'LCo':'a=wp.lcd128x64orientCoord(int(inputList[0]),int(inputList[1]))', +#'LSS':'a=wp.lcd128x64ScreenSize(int(inputList[0]),int(inputList[1]))', +'Lpo':'a=wp.lcd128x64point(int(inputList[0]),int(inputList[1]),int(inputList[2]))', +'Lli':'a=wp.lcd128x64line(int(inputList[0]),int(inputList[1]),int(inputList[2]),int(inputList[3]),int(inputList[4]))', +'LlT':'a=wp.lcd128x64lineTo(int(inputList[0]),int(inputList[1]),int(inputList[2]))', +'Lre':'a=wp.lcd128x64rectangle(int(inputList[0]),int(inputList[1]),int(inputList[2]),int(inputList[3]),int(inputList[4]),int(inputList[5]))', +'Lci':'a=wp.lcd128x64circle(int(inputList[0]),int(inputList[1]),int(inputList[2]),int(inputList[0]),int(inputList[3]),int(inputList[4]))', +'Lel':'a=wp.lcd128x64ellipse(int(inputList[0]),int(inputList[1]),int(inputList[2]),int(inputList[3]),int(inputList[4]),int(inputList[5]))', +'Lpc':'a=wp.lcd128x64putchar(int(inputList[0]),int(inputList[1]),int(inputList[2]),int(inputList[3]),int(inputList[4]),int(inputList[5]))', +'LPu':'a=wp.lcd128x64puts(int(inputList[0]),int(inputList[1]),inputList[2],int(inputList[3]),int(inputList[4]))', +'LCl':'a=wp.lcd128x64clear(int(inputList[0]))', +'mic':'a=wp.micros()', +'mil':'a=wp.millis()', +'mp6':'a=wp.mcp23016Setup(int(inputList[0]),int(inputList[1]))', +'mp7':'a=wp.mcp23017Setup(int(inputList[0]),int(inputList[1]))', +'mp8':'a=wp.mcp23008Setup(int(inputList[0]),int(inputList[1]))', +#'mp2':'a=wp.mcp3002Setup(int(inputList[0]),int(inputList[1]))', +#'mp4':'a=wp.mcp3004Setup(int(inputList[0]),int(inputList[1]))', +#'mp3':'a=wp.mcp3422Setup(int(inputList[0]),int(inputList[1]),int(inputList[2]),int(inputList[3]))', +#'mp0':'a=wp.mcp4802Setup(int(inputList[0]),int(inputList[1]))', +'ms7':'a=wp.mcp23s17Setup(int(inputList[0]),int(inputList[1]),int(inputList[2]))', +'ms8':'a=wp.mcp23s08Setup(int(inputList[0]),int(inputList[1]),int(inputList[2]))', +'mxR':'a=wp.maxDetectRead(int(inputList[0]),inputList[1])', +'mx3':'a=wp.max31855Setup(int(inputList[0]),int(inputList[1]))', +'mx5':'a=wp.max5322Setup(int(inputList[0]),int(inputList[1]))', +'NES':'a=wp.setupNesJoystick(int(inputList[0]),int(inputList[1]),int(inputList[2]))', +'NER':'a=wp.readNesJoystick(int(inputList[0]))', +'pDr':'a=wp.setPadDrive(int(inputList[0]),int(inputList[1]))', +'pf7':'a=wp.pcf8574Setup(int(inputList[0]),int(inputList[1]))', +'pf9':'a=wp.pcf8591Setup(int(inputList[0]),int(inputList[1]))', +'pG1':'a=wp.piGlow1(int(inputList[0]),int(inputList[1]),int(inputList[2]))', +'pGL':'a=wp.piGlowLeg(int(inputList[0]),int(inputList[1]))', +'pGR':'a=wp.piGlowRing(int(inputList[0]),int(inputList[1]))', +'pGS':'a=wp.piGlowSetup(int(inputList[0]))', +'PhS':'a=wp.scrollPhatSetup()', +'PhU':'a=wp.scrollPhatUpdate()', +'PhC':'a=wp.scrollPhatClear()', +'Php':'a=wp.scrollPhatPoint(int(inputList[0]),int(inputList[1]),int(inputList[2]))', +'PhL':'a=wp.scrollPhatLine(int(inputList[0]),int(inputList[1]),int(inputList[2]),int(inputList[3]),int(inputList[4]))', +'PhT':'a=wp.scrollPhatLineTo(int(inputList[0]),int(inputList[1]),int(inputList[2]))', +'PhR':'a=wp.scrollPhatRectangle(int(inputList[0]),int(inputList[1]),int(inputList[2]),int(inputList[3]),int(inputList[4]),int(inputList[5]),)', +'Phc':'a=wp.scrollPhatPutchar(int(inputList[0]))', +'PhP':'a=wp.scrollPhatPuts(inputList[0])', +'Phf':'a=wp.scrollPhatPrintf(inputList[0])', +'Phs':'a=wp.scrollPhatPrintSpeed(int(inputList[0]))', +'PhI':'a=wp.scrollPhatIntensity(int(inputList[0]),)', +'plC':'a=wp.pullUpDnControl(int(inputList[0]),int(inputList[1]))', +'pMA':'a=wp.pinModeAlt(int(inputList[0]),int(inputList[1]))', +'pN0':'if pinNum==0:\n\t\ta=wp.wiringPiSetup()\n\t\tpinNum=1\n\telse:\n\t\ta="RPI_pinNumbering has already been called once. Close and restart the connection to change the numbering sequence."', +'pN1':'if pinNum==0:\n\t\ta=wp.wiringPiSetupGpio()\n\t\tpinNum=2\n\telse:\n\t\ta="RPI_pinNumbering has already been called once. Close and restart the connection to change the numbering sequence."', +'pN2':'if pinNum==0:\n\t\ta=wp.wiringPiSetupPhys()\n\t\tpinNum=3\n\telse:\n\t\ta="RPI_pinNumbering has already been called once. Close and restart the connection to change the numbering sequence."', +'pN3':'if pinNum==0:\n\t\ta=wp.wiringPiSetupSys()\n\t\tpinNum=4\n\telse:\n\t\ta="RPI_pinNumbering has already been called once. Close and restart the connection to change the numbering sequence."()', +'pnM':'a=wp.pinMode(int(inputList[0]),int(inputList[1]))', +'pri':'a=wp.PiHiPri(int(inputList[0]))', +'ptG':'a=wp.physPinToGpio(int(inputList[0]))', +'pwC':'a=wp.pwmSetClock(int(inputList[0]))', +'pwG':'a=wp.wpiPinToGpio(int(inputList[0]))', +'pwM':'a=wp.pwmSetMode(int(inputList[0]))', +'pwR':'a=wp.pwmSetRange(int(inputList[0]))', +'pwT':'a=wp.pwmToneWrite(int(inputList[0]),int(inputList[1]))', +'pwW':'a=wp.pwmWrite(int(inputList[0]),int(inputList[1]))', +'sCl':'a=wp.serialClose(int(inputList[0]))', +'sDA':'a=wp.serialDataAvail(int(inputList[0]))', +'sFl':'a=wp.serialFlush(int(inputList[0]))', +'sGc':'a=wp.serialGetchar(int(inputList[0]))', +'shI':'a=wp.shiftIn(int(inputList[0]),int(inputList[1]),int(inputList[2]))', +'shO':'a=wp.shiftOut(int(inputList[0]),int(inputList[1]),int(inputList[2]),int(inputList[3]))', +'sn3':'a=wp.sn3218Setup(int(inputList[0]))', +'sOp':'a=wp.serialOpen(inputList[0],int(inputList[1]))', +'sPc':'a=wp.serialPutchar(int(inputList[0]),inputList[1])', +'sPC':'a=wp.softPwmCreate(int(inputList[0]),int(inputList[1]),int(inputList[2]))', +'SPD':'a=wp.wiringPiSPIDataRW(int(inputList[0]),inputList[1])', +'sPf':'a=wp.serialPrintf(int(inputList[0]),inputList[1])', +'SPF':'a=wp.wiringPiSPIGetFd(int(inputList[0]))', +'SPM':'a=wp.wiringPiSPISetupMode(int(inputList[0]),int(inputList[1]),int(inputList[2]))', +'SPS':'a=wp.wiringPiSPISetup(int(inputList[0]),int(inputList[1]))', +'sPs':'a=wp.serialPuts(int(inputList[0]),inputList[1])', +'sPS':'a=wp.softPwmStop(int(inputList[0]))', +'sPW':'a=wp.softPwmWrite(int(inputList[0]),int(inputList[1]))', +'sSS':'a=wp.softServoSetup(int(inputList[0]),int(inputList[1]),int(inputList[2]),int(inputList[3]),int(inputList[4]),int(inputList[5]),int(inputList[6]),int(inputList[7]))', +'sSW':'a=wp.softServoWrite(int(inputList[0]),int(inputList[1]))', +'sr5':'a=wp.sr595Setup(int(inputList[0]),int(inputList[1]),int(inputList[2]),int(inputList[3]),int(inputList[4]))', +'sTC':'a=wp.softToneCreate(int(inputList[0]))', +'sTS':'a=wp.softToneStop(int(inputList[0]))', +'sTW':'a=wp.softToneWrite(int(inputList[0]),int(inputList[1]))', +'thC':'a=wp.piThreadCreate(inputList[0])', +'unl':'a=wp.piUnlock(int(inputList[0]))', +'wtG':'a=wp.wpiPinToGpio(int(inputList[0]))', +#'rRT':'a=wp.readRHT03(int(inputList[0]),int(inputList[1]),inputList[2])', +'drc':'a=wp.drcSetupSerial(int(inputList[0]),int(inputList[1]),inputList[2],inputList[3])', +'ads':'a=wp.ads1115Setup(int(inputList[0]),int(inputList[1]))', +'wpF':'a=wp.wiringPiFailure(int(inputList[0]),inputList[1])', +'wpN':'a=wp.wiringPiFindNode(int(inputList[0]))', +'wpn':'a=wp.wiringPiNewNode(int(inputList[0]),int(inputList[1]))', +#'pBI':'a=wp.piBoardId()', +'gCS':'a=wp.gpioClockSet(int(inputList[0]),int(inputList[1]))', +#'':'a=wp.', +#'ISR':'if pinNum==1:\n\t\tpin=wp.wpiPinToGpio(29)\n\telif pinNum==2:\n\t\tpin=int(inputList[0])\n\telif pinNum==3:\n\t\t pin=wp.physPinToGpio(int(inputList[0]))\n\tGPIO.setup(pin,GPIO.IN,pull_up_down=inputList[2])\n\tGPIO.add_event_detect(pin,exec(inputList[1]),send2Client)', +} + +s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) +s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) +s.bind(("0.0.0.0",9077)) +""" +s2=socket.socket() +s2.connect((addr[0],9078)) + +def send2Client(pin): + s2.send(pin) +""" +s.listen(5) +go=1 +while go==1: + c, addr=s.accept() + theInput=c.recv(1024) + cmd=theInput[:3] + hash1=3 + Len=len(theInput) + for j in range(hash1+1,Len): + if theInput[j]=='#': + hash2=j + break + numInputs=int(theInput[hash1+1:hash2]) + hash1=hash2 + inputList=[] + for i in range(0,numInputs): + for j in range(hash1+1,Len): + if theInput[j]=='#': + hash2=j + break + inputList.append(theInput[hash1+1:hash2]) + hash1=hash2 + print ('try:\n\t'+commands[cmd]+'\nexcept Exception as err:\n\ta=traceback.format_exc()') + exec('try:\n\t'+commands[cmd]+'\nexcept Exception as err:\n\ta=traceback.format_exc()') + c.send(str(a)) + c.close() diff --git a/2.3-1/tests/unit_tests/test_RPi/lcd.sci b/2.3-1/tests/unit_tests/test_RPi/lcd.sci new file mode 100644 index 00000000..984ecbbb --- /dev/null +++ b/2.3-1/tests/unit_tests/test_RPi/lcd.sci @@ -0,0 +1,47 @@ +// 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 lcd() + raspi("10.42.0.144","panda","pi"); // setup connection to Pi + RPI_pinNumbering("wiringpi"); // initialize pin numbering + // LCD connections: + // 2 rows + // 16 columns + // 8 bits + // wiringPi pin 28 - rs + // wiringPi pin 29 - strobe/E + // wiringPi pins 0-7 - lcd data pins 0 to 7 + // + + fd=RPI_lcdInit(2,16,8,28,29,0,1,2,3,4,5,6,7) // initialize lcd with the above mentioned connections + RPI_lcdDisplay(fd,1) // switch on display + RPI_lcdCursor(fd,1) // show the cursor + RPI_lcdCursorBlink(fd,1) // blink the cursor + RPI_lcdPrintf(fd,"The Elder") // print to lcd + RPI_lcdPosition(fd,0,1) // Goto second row first column + RPI_lcdPrintf(fd,"Scrolls V Skyrim") // print to lcd + RPI_lcdHome(fd) // goto first row first column (0,0) + RPI_lcdClear(fd) // clear the lcd + RPI_lcdPrintf(fd,"Volume: ") // print character corresponding to number 125 + RPI_lcdCharDef(fd,0,0,0,0,0,0,0,0,255) // define a custom character at position 0 + RPI_lcdCharDef(fd,1,0,0,0,0,0,0,255,255) // define a custom character at position 1 + RPI_lcdCharDef(fd,2,0,0,0,0,0,255,255,255) + RPI_lcdCharDef(fd,3,0,0,0,0,255,255,255,255) + RPI_lcdCharDef(fd,4,0,0,0,255,255,255,255,255) + RPI_lcdCharDef(fd,5,0,0,255,255,255,255,255,255) + RPI_lcdCharDef(fd,6,0,255,255,255,255,255,255,255) + RPI_lcdCharDef(fd,7,255,255,255,255,255,255,255,255) + for i=0:7:1 + RPI_lcdPutchar(fd,1) // print the custom characters + end + disp("Demo completed successfully.") + raspi_close(); // close the opened connection +endfunction diff --git a/2.3-1/tests/unit_tests/test_RPi/wait_and_blink.sci b/2.3-1/tests/unit_tests/test_RPi/wait_and_blink.sci new file mode 100644 index 00000000..7f77ad0f --- /dev/null +++ b/2.3-1/tests/unit_tests/test_RPi/wait_and_blink.sci @@ -0,0 +1,27 @@ +// 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 wait_and_blink() + raspi("10.42.0.144","panda","pi"); // setup connection to Pi + RPI_pinNumbering("wiringpi"); // initialize pin numbering + RPI_pinMode(0,"out"); // set pin 0 as OUTPUT + RPI_pinMode(1,"in"); // set pin 1 as INPUT + RPI_waitForInterrupt(1,-1); // wait for Interrupt at pin 1,with no timeout. + for i=1:5 // interrupt recieved + RPI_digitalWrite(0,1); // set pin 0 voltage HIGH + RPI_delay(1000); // delay for 1 second + RPI_digitalWrite(0,0); // set pin 0 voltage LOW + RPI_delay(1000); // delay for 1 second + end + RPI_pinMode(0,"in"); // reset pin 0 to INPUT + disp("Demo completed successfully.") + raspi_close(); // close the opened connection +endfunction diff --git a/2.3-1/thirdparty/lib/raspberrypi/libcblas.a b/2.3-1/thirdparty/lib/raspberrypi/libcblas.a Binary files differindex bbba3e21..719376dd 100644 --- a/2.3-1/thirdparty/lib/raspberrypi/libcblas.a +++ b/2.3-1/thirdparty/lib/raspberrypi/libcblas.a diff --git a/2.3-1/thirdparty/lib/raspberrypi/libgsl.a b/2.3-1/thirdparty/lib/raspberrypi/libgsl.a Binary files differindex 1eb5d60d..c37a6963 100644 --- a/2.3-1/thirdparty/lib/raspberrypi/libgsl.a +++ b/2.3-1/thirdparty/lib/raspberrypi/libgsl.a diff --git a/2.3-1/thirdparty/lib/raspberrypi/librefblas.a b/2.3-1/thirdparty/lib/raspberrypi/librefblas.a Binary files differindex d1921c42..0307f908 100644 --- a/2.3-1/thirdparty/lib/raspberrypi/librefblas.a +++ b/2.3-1/thirdparty/lib/raspberrypi/librefblas.a |