summaryrefslogtreecommitdiff
path: root/macros/Hardware/RasberryPi/Timing
diff options
context:
space:
mode:
Diffstat (limited to 'macros/Hardware/RasberryPi/Timing')
-rwxr-xr-xmacros/Hardware/RasberryPi/Timing/RPI_delay.sci40
-rwxr-xr-xmacros/Hardware/RasberryPi/Timing/RPI_delayMicro.sci40
-rwxr-xr-xmacros/Hardware/RasberryPi/Timing/RPI_micros.sci37
-rwxr-xr-xmacros/Hardware/RasberryPi/Timing/RPI_millis.sci37
-rwxr-xr-xmacros/Hardware/RasberryPi/Timing/buildmacros.sce14
-rwxr-xr-xmacros/Hardware/RasberryPi/Timing/names4
6 files changed, 172 insertions, 0 deletions
diff --git a/macros/Hardware/RasberryPi/Timing/RPI_delay.sci b/macros/Hardware/RasberryPi/Timing/RPI_delay.sci
new file mode 100755
index 0000000..bd868e8
--- /dev/null
+++ b/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/macros/Hardware/RasberryPi/Timing/RPI_delayMicro.sci b/macros/Hardware/RasberryPi/Timing/RPI_delayMicro.sci
new file mode 100755
index 0000000..a1b5d59
--- /dev/null
+++ b/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/macros/Hardware/RasberryPi/Timing/RPI_micros.sci b/macros/Hardware/RasberryPi/Timing/RPI_micros.sci
new file mode 100755
index 0000000..058a827
--- /dev/null
+++ b/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/macros/Hardware/RasberryPi/Timing/RPI_millis.sci b/macros/Hardware/RasberryPi/Timing/RPI_millis.sci
new file mode 100755
index 0000000..baecddc
--- /dev/null
+++ b/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/macros/Hardware/RasberryPi/Timing/buildmacros.sce b/macros/Hardware/RasberryPi/Timing/buildmacros.sce
new file mode 100755
index 0000000..7d533f7
--- /dev/null
+++ b/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/macros/Hardware/RasberryPi/Timing/names b/macros/Hardware/RasberryPi/Timing/names
new file mode 100755
index 0000000..0b47b34
--- /dev/null
+++ b/macros/Hardware/RasberryPi/Timing/names
@@ -0,0 +1,4 @@
+RPI_delay
+RPI_delayMicro
+RPI_micros
+RPI_millis