summaryrefslogtreecommitdiff
path: root/macros/Hardware/RasberryPi
diff options
context:
space:
mode:
Diffstat (limited to 'macros/Hardware/RasberryPi')
-rw-r--r--macros/Hardware/RasberryPi/GetRPISupportFunctions.binbin1604 -> 2784 bytes
-rw-r--r--macros/Hardware/RasberryPi/GetRPISupportFunctions.sci16
-rw-r--r--macros/Hardware/RasberryPi/RPI_GetMicros.binbin0 -> 3568 bytes
-rw-r--r--macros/Hardware/RasberryPi/RPI_GetMicros.sci31
-rw-r--r--macros/Hardware/RasberryPi/RPI_GetMillis.binbin0 -> 3556 bytes
-rw-r--r--macros/Hardware/RasberryPi/RPI_GetMillis.sci31
-rw-r--r--macros/Hardware/RasberryPi/RPI_PinISR.binbin0 -> 6640 bytes
-rw-r--r--macros/Hardware/RasberryPi/RPI_PinISR.sci47
-rw-r--r--macros/Hardware/RasberryPi/RPI_SerialClose.binbin0 -> 2724 bytes
-rw-r--r--macros/Hardware/RasberryPi/RPI_SerialClose.sci25
-rw-r--r--macros/Hardware/RasberryPi/RPI_SerialFlush.binbin0 -> 3120 bytes
-rw-r--r--macros/Hardware/RasberryPi/RPI_SerialFlush.sci26
-rw-r--r--macros/Hardware/RasberryPi/RPI_SerialGetChar.binbin0 -> 3400 bytes
-rw-r--r--macros/Hardware/RasberryPi/RPI_SerialGetChar.sci28
-rw-r--r--macros/Hardware/RasberryPi/RPI_SerialSendChar.binbin0 -> 3344 bytes
-rw-r--r--macros/Hardware/RasberryPi/RPI_SerialSendChar.sci29
-rw-r--r--macros/Hardware/RasberryPi/RPI_SerialSendData.binbin0 -> 3344 bytes
-rw-r--r--macros/Hardware/RasberryPi/RPI_SerialSendData.sci30
-rw-r--r--macros/Hardware/RasberryPi/RPI_SerialSetup.binbin0 -> 3356 bytes
-rw-r--r--macros/Hardware/RasberryPi/RPI_SerialSetup.sci28
-rw-r--r--macros/Hardware/RasberryPi/libbin816 -> 1056 bytes
-rw-r--r--macros/Hardware/RasberryPi/names10
-rw-r--r--macros/Hardware/RasberryPi/u16RPISerialDataAvail.binbin0 -> 3520 bytes
-rw-r--r--macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci29
24 files changed, 329 insertions, 1 deletions
diff --git a/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin b/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin
index 545334a..960068e 100644
--- a/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin
+++ b/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci b/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci
index 61bb6c0..fe4edb1 100644
--- a/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci
+++ b/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci
@@ -16,6 +16,20 @@ RPiSupportFunctions = [
"RPI_DigitalOut"
"RPI_DigitalSetup"
"RPI_DelayMilli"
- "RPI_DelayMicro"];
+ "RPI_DelayMicro"
+ "RPI_GetMillis"
+ "RPI_GetMicros"
+ "RPI_SerialSetup"
+ "RPI_SerialClose"
+ "RPI_SerialSendChar"
+ "RPI_SerialFlush"
+ "RPI_SerialGetChar"
+ "RPI_ThreadCreate"
+ "RPI_PinISR"
+ ];
+
+//Note: "RPI_SerialSendData" is removed since distinction between input data
+//types is required
+
endfunction
diff --git a/macros/Hardware/RasberryPi/RPI_GetMicros.bin b/macros/Hardware/RasberryPi/RPI_GetMicros.bin
new file mode 100644
index 0000000..3e6c08f
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_GetMicros.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/RPI_GetMicros.sci b/macros/Hardware/RasberryPi/RPI_GetMicros.sci
new file mode 100644
index 0000000..7f825ef
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_GetMicros.sci
@@ -0,0 +1,31 @@
+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/macros/Hardware/RasberryPi/RPI_GetMillis.bin b/macros/Hardware/RasberryPi/RPI_GetMillis.bin
new file mode 100644
index 0000000..b914365
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_GetMillis.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/RPI_GetMillis.sci b/macros/Hardware/RasberryPi/RPI_GetMillis.sci
new file mode 100644
index 0000000..b83f5fe
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_GetMillis.sci
@@ -0,0 +1,31 @@
+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/macros/Hardware/RasberryPi/RPI_PinISR.bin b/macros/Hardware/RasberryPi/RPI_PinISR.bin
new file mode 100644
index 0000000..a6c0bd9
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_PinISR.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/RPI_PinISR.sci b/macros/Hardware/RasberryPi/RPI_PinISR.sci
new file mode 100644
index 0000000..2de7d9e
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_PinISR.sci
@@ -0,0 +1,47 @@
+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]
+
+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/macros/Hardware/RasberryPi/RPI_SerialClose.bin b/macros/Hardware/RasberryPi/RPI_SerialClose.bin
new file mode 100644
index 0000000..dce972d
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_SerialClose.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/RPI_SerialClose.sci b/macros/Hardware/RasberryPi/RPI_SerialClose.sci
new file mode 100644
index 0000000..0d393f3
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_SerialClose.sci
@@ -0,0 +1,25 @@
+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/macros/Hardware/RasberryPi/RPI_SerialFlush.bin b/macros/Hardware/RasberryPi/RPI_SerialFlush.bin
new file mode 100644
index 0000000..2a3704d
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_SerialFlush.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/RPI_SerialFlush.sci b/macros/Hardware/RasberryPi/RPI_SerialFlush.sci
new file mode 100644
index 0000000..ffef70b
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_SerialFlush.sci
@@ -0,0 +1,26 @@
+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/macros/Hardware/RasberryPi/RPI_SerialGetChar.bin b/macros/Hardware/RasberryPi/RPI_SerialGetChar.bin
new file mode 100644
index 0000000..9e6dd09
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_SerialGetChar.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci b/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci
new file mode 100644
index 0000000..ce17ea8
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci
@@ -0,0 +1,28 @@
+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);
+// 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/macros/Hardware/RasberryPi/RPI_SerialSendChar.bin b/macros/Hardware/RasberryPi/RPI_SerialSendChar.bin
new file mode 100644
index 0000000..7614ebc
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_SerialSendChar.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci b/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci
new file mode 100644
index 0000000..82051d6
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci
@@ -0,0 +1,29 @@
+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/macros/Hardware/RasberryPi/RPI_SerialSendData.bin b/macros/Hardware/RasberryPi/RPI_SerialSendData.bin
new file mode 100644
index 0000000..a3524a6
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_SerialSendData.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/RPI_SerialSendData.sci b/macros/Hardware/RasberryPi/RPI_SerialSendData.sci
new file mode 100644
index 0000000..6bfe80d
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_SerialSendData.sci
@@ -0,0 +1,30 @@
+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/macros/Hardware/RasberryPi/RPI_SerialSetup.bin b/macros/Hardware/RasberryPi/RPI_SerialSetup.bin
new file mode 100644
index 0000000..0128c27
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_SerialSetup.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/RPI_SerialSetup.sci b/macros/Hardware/RasberryPi/RPI_SerialSetup.sci
new file mode 100644
index 0000000..25a70a3
--- /dev/null
+++ b/macros/Hardware/RasberryPi/RPI_SerialSetup.sci
@@ -0,0 +1,28 @@
+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/macros/Hardware/RasberryPi/lib b/macros/Hardware/RasberryPi/lib
index 1031744..40a6b04 100644
--- a/macros/Hardware/RasberryPi/lib
+++ b/macros/Hardware/RasberryPi/lib
Binary files differ
diff --git a/macros/Hardware/RasberryPi/names b/macros/Hardware/RasberryPi/names
index 138ac2a..a97a189 100644
--- a/macros/Hardware/RasberryPi/names
+++ b/macros/Hardware/RasberryPi/names
@@ -5,3 +5,13 @@ RPI_DelayMilli
RPI_DigitalIn
RPI_DigitalOut
RPI_DigitalSetup
+RPI_GetMicros
+RPI_GetMillis
+RPI_PinISR
+RPI_SerialClose
+RPI_SerialFlush
+RPI_SerialGetChar
+RPI_SerialSendChar
+RPI_SerialSendData
+RPI_SerialSetup
+u16RPISerialDataAvail
diff --git a/macros/Hardware/RasberryPi/u16RPISerialDataAvail.bin b/macros/Hardware/RasberryPi/u16RPISerialDataAvail.bin
new file mode 100644
index 0000000..3789bd6
--- /dev/null
+++ b/macros/Hardware/RasberryPi/u16RPISerialDataAvail.bin
Binary files differ
diff --git a/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci b/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci
new file mode 100644
index 0000000..5a29156
--- /dev/null
+++ b/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci
@@ -0,0 +1,29 @@
+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