summaryrefslogtreecommitdiff
path: root/2.3-1/tests/unit_tests
diff options
context:
space:
mode:
authorBrijeshcr2017-07-20 19:39:55 +0530
committerBrijeshcr2017-07-20 19:39:55 +0530
commit215a24b64f6d0ec3fcef06c2634926f730b3dcc5 (patch)
tree48072b76fe009ec8423ba9e179fef964db666a3a /2.3-1/tests/unit_tests
parent9a2e3e3174a9ff35ba9b739cec4a0b8c052a8dbe (diff)
parentdbf6486fa17d277729e0d6f77c2a6b93cbdd9424 (diff)
downloadScilab2C-215a24b64f6d0ec3fcef06c2634926f730b3dcc5.tar.gz
Scilab2C-215a24b64f6d0ec3fcef06c2634926f730b3dcc5.tar.bz2
Scilab2C-215a24b64f6d0ec3fcef06c2634926f730b3dcc5.zip
Added RPI demo and lcd128x64 fixed
Diffstat (limited to '2.3-1/tests/unit_tests')
-rw-r--r--2.3-1/tests/unit_tests/test_RPi/lcd.sci47
-rw-r--r--2.3-1/tests/unit_tests/test_RPi/wait_and_blink.sci27
2 files changed, 74 insertions, 0 deletions
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