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 /2.3-1/macros/Hardware/RasberryPi/Shift | |
parent | 9a2e3e3174a9ff35ba9b739cec4a0b8c052a8dbe (diff) | |
parent | dbf6486fa17d277729e0d6f77c2a6b93cbdd9424 (diff) | |
download | Scilab2C-215a24b64f6d0ec3fcef06c2634926f730b3dcc5.tar.gz Scilab2C-215a24b64f6d0ec3fcef06c2634926f730b3dcc5.tar.bz2 Scilab2C-215a24b64f6d0ec3fcef06c2634926f730b3dcc5.zip |
Added RPI demo and lcd128x64 fixed
Diffstat (limited to '2.3-1/macros/Hardware/RasberryPi/Shift')
5 files changed, 146 insertions, 0 deletions
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 |