summaryrefslogtreecommitdiff
path: root/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci
diff options
context:
space:
mode:
authoryash11122017-07-07 21:20:49 +0530
committeryash11122017-07-07 21:20:49 +0530
commit9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 (patch)
treef50d6e06d8fe6bc1a9053ef10d4b4d857800ab51 /2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci
downloadScilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.tar.gz
Scilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.tar.bz2
Scilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.zip
sci2c arduino updated
Diffstat (limited to '2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci')
-rw-r--r--2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci36
1 files changed, 36 insertions, 0 deletions
diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci
new file mode 100644
index 00000000..01d6e07d
--- /dev/null
+++ b/2.3-1/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci
@@ -0,0 +1,36 @@
+function RPI_DigitalSetup(pin, direction)
+// Function to setup digital pins.
+//
+// Calling Sequence
+// RPI_DigitalSetup(pin,direction)
+//
+// Parameters
+// pin : pin of RPi to be used
+// direction : direction to be set for pin
+// 0 -> INPUT, 1 -> OUTPUT, 2->PWM Output
+//
+// Description
+// There are few pins available on RPi as Gpio or digital io. These pins can be used as digital output or input. Pin name must be provided from list provided. Please refer '' for complete list of pins. Direction can be 0 or 1 depending upon desired function (Input/output)
+// Examples
+// RPI_DigitalSetup(3,0) //Sets pin 3 of header P1 as input
+//
+// See also
+// RPI_DigitalIn RPI_DigitalOut
+//
+//
+// Authors
+// Siddhesh Wani
+// -----------------------------------------------------------------
+//Pins of header P1 which can be used as GPIO
+supported_pins = [3,5,7,8,10,11,12,13,15,16,18,19,21,22,23,24,26,27,28,29,...
+ 31,31,33,35,36,37,38,40];
+
+PinIsGPIO = members(pin, supported_pins); //Check if input pin supports GPIO
+
+//If given pin does not support GPIO functionality, raise the error
+if(PinIsGPIO == 0)
+ error(9999, 'SCI2CERROR: Given pin number doesnot support GPIO functionality.');
+end
+state = 1;
+
+endfunction