summaryrefslogtreecommitdiff
path: root/2.3-1/src
diff options
context:
space:
mode:
Diffstat (limited to '2.3-1/src')
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c20
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c21
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c32
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h2
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h2
-rw-r--r--2.3-1/src/c/matrixOperations/includes/norm.h4
-rw-r--r--2.3-1/src/c/string/convstr/gconvstrs.c7
-rw-r--r--2.3-1/src/c/string/includes/convstr.h26
-rw-r--r--2.3-1/src/c/string/interfaces/int_convstr.h25
9 files changed, 84 insertions, 55 deletions
diff --git a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c
index 8ce0b3ce..d9ff093f 100644
--- a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c
+++ b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c
@@ -10,29 +10,15 @@
Email: toolbox@scilab.in
*/
-/* Function to read the state of the gpio pin
-
- Calling Sequence
- u8RPI_DigitalIn(pin)
-
- Parameters
- pin : pin of RPi to be read
-
- Returns
- state: Current state of the specified gpio pin
-
- Description
- There are few pins available on RPi as Gpio or digital i/o. These pins can be used as digital output or input. Using this function, current state (low/high) of any gpio pin can be read. 'pin' name must be provided from list provided. Please refer '' for complete list of pins. 'state' can be 0 or 1 depending upon state of the pin (Low/High). RPI_DigitalSetup with appropriate arguments must be called before using this function.
- Examples
- u8RPI_DigitalIn(RPI_GPIO_P1_03,1) //Returns the state of pin 3 of header P1
-*/
+/* Function to read the state of the gpio pin */
#include "types.h"
#include "RPIPeripheralDigital.h"
+/*pin is reduced by one as array index starts from 0 and pin no starts from 1*/
uint8 u8RPIDigitalIns(uint8 pin)
{
uint8 state = 0;
- state = bcm2835_gpio_lev(pin);
+ state = bcm2835_gpio_lev(phy_pin[pin-1]);
return (state);
}
diff --git a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c
index d97f4588..97c6a034 100644
--- a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c
+++ b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c
@@ -10,30 +10,17 @@
Email: toolbox@scilab.in
*/
-/* Function to change the output state of the gpio pin
-
- Calling Sequence
- u8RPI_DigitalOuts(pin,state)
-
- Parameters
- pin : pin of RPi to be used
- state : desired output state for pin (0 -> LOW, 1 -> HIGH)
-
- Description
- There are few pins available on RPi as Gpio or digital i/o. 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. 'state' can be 0 or 1 depending upon desired output (Low/High). RPI_DigitalSetup with appropriate arguments must be called before using this function.
- Examples
- u8RPI_DigitalOuts(RPI_GPIO_P1_03,1) //Sets pin 3 of header P1 as 'high' output
-*/
+/* Function to change the output state of the gpio pin */
#include "types.h"
#include "RPIPeripheralDigital.h"
-
+/*pin is reduced by one as arrayiindex starts from 0 and pin no starts from 1*/
uint8 u8RPIDigitalOuts(uint8 pin, uint8 state)
{
if (state == 0) //low output
- bcm2835_gpio_clr(pin);
+ bcm2835_gpio_clr(phy_pin[pin-1]);
if (state == 1) //high output
- bcm2835_gpio_set(pin);
+ bcm2835_gpio_set(phy_pin[pin-1]);
}
diff --git a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c
index 657df3a1..79668b16 100644
--- a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c
+++ b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c
@@ -10,35 +10,31 @@
Email: toolbox@scilab.in
*/
-/* Function to setup digital pins.
-
- Calling Sequence
- u8RPI_DigitalSetup(pin,direction)
-
- Parameters
- pin : pin of RPi to be used
- direction : direction to be set for pin (0 -> INPUT, 1 -> 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(RPI_GPIO_P1_03,0) //Sets pin 3 of header P1 as input
-
- See also
- RPI_DigitalIn RPI_DigitalOut
+/* Function to setup digital pins
+ direction = 1 -> output
*/
#include "types.h"
#include "RPIPeripheralDigital.h"
+
+/*This array maps pin numbers on RPi board, with actual physical pin numbers
+on processor, required by BCM2835 library*/
+int phy_pin[] = {0, 0, 2, 0, 3, 0, 4, 14, 0, 15, /*Pin 1 to 10*/
+ 17, 18, 27, 0, 22, 23, 0, 24, 10, 0, /*Pin 11 to 20*/
+ 9, 25, 11, 8, 0, 7 }; /*Pin 21 to 26*/
+
+/*pin is reduced by one as arrayiindex starts from 0 and pin no starts from 1*/
uint8 u8RPIDigitalSetups(uint8 pin, uint8 direction)
{
if(direction == 1) //Pin to be used as output
{
- bcm2835_gpio_fsel(pin, BCM2835_GPIO_FSEL_OUTP);
+ bcm2835_gpio_fsel(phy_pin[pin-1], BCM2835_GPIO_FSEL_OUTP);
}
else
{
- bcm2835_gpio_fsel(pin, BCM2835_GPIO_FSEL_INPT);
+ bcm2835_gpio_fsel(phy_pin[pin-1], BCM2835_GPIO_FSEL_INPT);
}
+
+ return 0;
}
diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h
index 87fe7dc0..e56366c3 100644
--- a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h
+++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h
@@ -23,6 +23,8 @@ extern "C" {
#include "types.h"
#include "bcm2835.h"
+extern int phy_pin[];
+
uint8 u8RPIDigitalSetups(uint8 pin, uint8 direction);
uint8 u8RPIDigitalOuts(uint8 pin, uint8 state);
uint8 u8RPIDigitalIns(uint8 pin);
diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h
index 056f3cb8..40a8e1a4 100644
--- a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h
+++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h
@@ -22,7 +22,7 @@ extern "C" {
#define RPI_DigitalSetup(in1,in2) u8RPIDigitalSetups((uint8) in1, (uint8) in2);
-#define RPI_DigitalIn(in1,in2) u8RPIDigitalIns((uint8) in1);
+#define RPI_DigitalIn(in1) u8RPIDigitalIns((uint8) in1);
#define RPI_DigitalOut(in1,in2) u8RPIDigitalOuts((uint8) in1, (uint8) in2);
diff --git a/2.3-1/src/c/matrixOperations/includes/norm.h b/2.3-1/src/c/matrixOperations/includes/norm.h
index 6ac4c06a..dc9d351f 100644
--- a/2.3-1/src/c/matrixOperations/includes/norm.h
+++ b/2.3-1/src/c/matrixOperations/includes/norm.h
@@ -21,9 +21,9 @@ double dnormv (double *in, int size, int norm);
double dnorma (double *in, int row, int col, int norm);
-float dnormv (float *in, int size, int norm);
+float snormv (float *in, int size, int norm);
-float dnorma (float *in, int row, int col, int norm);
+float snorma (float *in, int row, int col, int norm);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/2.3-1/src/c/string/convstr/gconvstrs.c b/2.3-1/src/c/string/convstr/gconvstrs.c
new file mode 100644
index 00000000..d4174965
--- /dev/null
+++ b/2.3-1/src/c/string/convstr/gconvstrs.c
@@ -0,0 +1,7 @@
+#include <string.h>
+#include "convstr.h"
+
+int gconvstrs(int* in)
+{
+ return (toupper(in));
+} \ No newline at end of file
diff --git a/2.3-1/src/c/string/includes/convstr.h b/2.3-1/src/c/string/includes/convstr.h
new file mode 100644
index 00000000..3a8e6e7b
--- /dev/null
+++ b/2.3-1/src/c/string/includes/convstr.h
@@ -0,0 +1,26 @@
+ /* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __CONVSTR_H__
+#define __CONVSTR_H__
+
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+int gconvstrs(int* in);
+
+ #ifdef __cplusplus
+ } /* extern "C" */
+ #endif
+
+#endif /*__CONVSTR_H__*/
diff --git a/2.3-1/src/c/string/interfaces/int_convstr.h b/2.3-1/src/c/string/interfaces/int_convstr.h
new file mode 100644
index 00000000..f565b858
--- /dev/null
+++ b/2.3-1/src/c/string/interfaces/int_convstr.h
@@ -0,0 +1,25 @@
+ /* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_CONVSTR_H__
+#define __INT_CONVSTR_H__
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+#define g0constrg0(in, size) gconstrs(in)
+
+ #ifdef __cplusplus
+ } /* extern "C" */
+ #endif
+
+#endif /*__INT_CONVSTR_H__*/