From 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 Mon Sep 17 00:00:00 2001 From: yash1112 Date: Fri, 7 Jul 2017 21:20:49 +0530 Subject: sci2c arduino updated --- .../src/c/hardware/rasberrypi/ISR/i16RPIPinISRs.c | 25 +++++++++++ .../c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c | 24 +++++++++++ .../c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c | 26 ++++++++++++ .../hardware/rasberrypi/gpio/u8RPIDigitalSetups.c | 39 +++++++++++++++++ .../rasberrypi/includes/RPIPeripheralDigital.h | 36 ++++++++++++++++ .../rasberrypi/includes/RPIPeripheralPWM.h | 31 ++++++++++++++ .../rasberrypi/includes/RPIPeripheralPinISR.h | 26 ++++++++++++ .../rasberrypi/includes/RPIPeripheralSerial.h | 49 ++++++++++++++++++++++ .../rasberrypi/includes/RPIPeripheralThreading.h | 28 +++++++++++++ .../rasberrypi/includes/RPIPeripheralTiming.h | 34 +++++++++++++++ .../interfaces/int_RPIPeripheralDigital.h | 33 +++++++++++++++ .../rasberrypi/interfaces/int_RPIPeripheralPWM.h | 30 +++++++++++++ .../interfaces/int_RPIPeripheralPinISR.h | 25 +++++++++++ .../interfaces/int_RPIPeripheralSerial.h | 47 +++++++++++++++++++++ .../interfaces/int_RPIPeripheralThreading.h | 25 +++++++++++ .../interfaces/int_RPIPeripheralTiming.h | 34 +++++++++++++++ .../rasberrypi/pwm/u8RPIHardPWMSetClocks.c | 27 ++++++++++++ .../hardware/rasberrypi/pwm/u8RPIHardPWMSetModes.c | 28 +++++++++++++ .../rasberrypi/pwm/u8RPIHardPWMSetRanges.c | 25 +++++++++++ .../c/hardware/rasberrypi/pwm/u8RPIHardPWMWrites.c | 26 ++++++++++++ .../rasberrypi/serial/dRPISerialSendDataa.c | 27 ++++++++++++ .../rasberrypi/serial/dRPISerialSendDatas.c | 35 ++++++++++++++++ .../rasberrypi/serial/gRPISerialSendDatas.c | 27 ++++++++++++ .../rasberrypi/serial/i16RPISerialDataAvails.c | 25 +++++++++++ .../rasberrypi/serial/i16RPISerialGetChars.c | 27 ++++++++++++ .../rasberrypi/serial/i16RPISerialSendDataa.c | 27 ++++++++++++ .../rasberrypi/serial/i16RPISerialSendDatas.c | 24 +++++++++++ .../rasberrypi/serial/i8RPISerialSendDataa.c | 26 ++++++++++++ .../rasberrypi/serial/i8RPISerialSendDatas.c | 22 ++++++++++ .../rasberrypi/serial/sRPISerialSendDataa.c | 27 ++++++++++++ .../rasberrypi/serial/sRPISerialSendDatas.c | 34 +++++++++++++++ .../rasberrypi/serial/u16RPISerialSendDataa.c | 28 +++++++++++++ .../rasberrypi/serial/u16RPISerialSendDatas.c | 23 ++++++++++ .../rasberrypi/serial/u16RPISerialSetups.c | 25 +++++++++++ .../hardware/rasberrypi/serial/u8RPISerialCloses.c | 21 ++++++++++ .../hardware/rasberrypi/serial/u8RPISerialFlushs.c | 21 ++++++++++ .../rasberrypi/serial/u8RPISerialSendChars.c | 21 ++++++++++ .../rasberrypi/serial/u8RPISerialSendDataa.c | 27 ++++++++++++ .../rasberrypi/serial/u8RPISerialSendDatas.c | 22 ++++++++++ .../rasberrypi/threading/u16RPIThreadCreates.c | 24 +++++++++++ .../hardware/rasberrypi/timing/u16RPIDelayMicros.c | 22 ++++++++++ .../hardware/rasberrypi/timing/u16RPIDelayMillis.c | 25 +++++++++++ .../c/hardware/rasberrypi/timing/u32RPIGetMicros.c | 21 ++++++++++ .../c/hardware/rasberrypi/timing/u32RPIGetMillis.c | 21 ++++++++++ 44 files changed, 1220 insertions(+) create mode 100644 2.3-1/src/c/hardware/rasberrypi/ISR/i16RPIPinISRs.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h create mode 100644 2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralPWM.h create mode 100644 2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralPinISR.h create mode 100644 2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.h create mode 100644 2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralThreading.h create mode 100644 2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralTiming.h create mode 100644 2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h create mode 100644 2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPWM.h create mode 100644 2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPinISR.h create mode 100644 2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h create mode 100644 2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralThreading.h create mode 100644 2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralTiming.h create mode 100644 2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetClocks.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetModes.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetRanges.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMWrites.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/dRPISerialSendDataa.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/dRPISerialSendDatas.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/gRPISerialSendDatas.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialDataAvails.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialGetChars.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialSendDataa.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialSendDatas.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/i8RPISerialSendDataa.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/i8RPISerialSendDatas.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/sRPISerialSendDataa.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/sRPISerialSendDatas.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/u16RPISerialSendDataa.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/u16RPISerialSendDatas.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/u16RPISerialSetups.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialCloses.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialFlushs.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendChars.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendDataa.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendDatas.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/threading/u16RPIThreadCreates.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/timing/u16RPIDelayMicros.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/timing/u16RPIDelayMillis.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/timing/u32RPIGetMicros.c create mode 100644 2.3-1/src/c/hardware/rasberrypi/timing/u32RPIGetMillis.c (limited to '2.3-1/src/c/hardware/rasberrypi') diff --git a/2.3-1/src/c/hardware/rasberrypi/ISR/i16RPIPinISRs.c b/2.3-1/src/c/hardware/rasberrypi/ISR/i16RPIPinISRs.c new file mode 100644 index 00000000..6e398a17 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/ISR/i16RPIPinISRs.c @@ -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 +*/ + +/* Function to declare interrupt on pins and corresponding ISRs */ + +#include "types.h" +#include "RPIPeripheralPinISR.h" +#include "RPIPeripheralDigital.h" + +int16 i16RPIPinISRs(uint8 pin, uint8 edgetype, void (*ISRFunction)(void)) +{ + int status; + status = wiringPiISR((int)phy_pin[pin-1], (int) edgetype, ISRFunction); + return status; +} + diff --git a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c new file mode 100644 index 00000000..7b84350f --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c @@ -0,0 +1,24 @@ +/* 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 +*/ + +/* 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 = digitalRead(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 new file mode 100644 index 00000000..f828f77e --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c @@ -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 +*/ + +/* Function to change the output 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*/ +void u8RPIDigitalOuts(uint8 pin, uint8 state) +{ + if (state == 0) /*low output*/ + digitalWrite(phy_pin[pin-1], LOW); + if (state == 1) /*high output*/ + digitalWrite(phy_pin[pin-1], HIGH); +} diff --git a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c new file mode 100644 index 00000000..f5fefe08 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c @@ -0,0 +1,39 @@ +/* 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 +*/ + +/* Function to setup digital pins + direction = 1 -> output + direction = 0 -> input +*/ + +#include "types.h" +#include "RPIPeripheralDigital.h" + + +/*This array maps pin numbers on RPi board, with pin numbers corrsponding +to WiringPi library*/ +int phy_pin[] = {17, 17, 8, 17, 9, 17, 7, 15, 17, 16, /*Pin 1 to 10*/ + 0, 1, 2, 17, 3, 4, 17, 5, 12, 17, /*Pin 11 to 20*/ + 13, 6, 14, 10, 17, 11, 30, 31, 21, 17, /*Pin 21 to 30*/ + 22, 26, 23, 17, 24, 27, 25, 28, 17, 29 }; /*Pin 31 to 40*/ + +/*pin is reduced by one as arrayiindex starts from 0 and pin no starts from 1*/ +void u8RPIDigitalSetups(uint8 pin, uint8 direction) +{ + if(direction == 1) /*Pin to be used as output*/ + pinMode(phy_pin[pin-1], OUTPUT); + else if(direction == 2) + pinMode(phy_pin[pin-1], PWM_OUTPUT); + else + pinMode(phy_pin[pin-1], INPUT); + +} diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h new file mode 100644 index 00000000..2f40ffb2 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h @@ -0,0 +1,36 @@ +/* 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 +*/ + +/* This file declares functions and constants related to GPIO pins*/ + +#ifndef __RPIPERIPHERALGPIO_H__ +#define __RPIPERIPHERALGPIO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "types.h" +#include "wiringPi.h" + +extern int phy_pin[]; + +void u8RPIDigitalSetups(uint8 pin, uint8 direction); +void u8RPIDigitalOuts(uint8 pin, uint8 state); +uint8 u8RPIDigitalIns(uint8 pin); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALGPIO_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralPWM.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralPWM.h new file mode 100644 index 00000000..d463d9c9 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralPWM.h @@ -0,0 +1,31 @@ + /* 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 __RPIPERIPHERALPWM_H__ +#define __RPIPERIPHERALPWM_H__ + +#include "types.h" +#include "wiringPi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void u8RPIHardPWMWrites(uint8 pin, uint16 value); +void u8RPIHardPWMSetRanges(uint16 value); +void u8RPIHardPWMSetModes(uint8 mode); +void u8RPIHardPWMSetClocks(uint16 clk_divisor); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALPWM_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralPinISR.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralPinISR.h new file mode 100644 index 00000000..fc5a8d04 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralPinISR.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 __RPIPERIPHERALPINISR_H__ +#define __RPIPERIPHERALPINISR_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +int16 i16RPIPinISRs(uint8 pin, uint8 edgetype, void (*ISRFunction)(void)); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALPINISR_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.h new file mode 100644 index 00000000..14df95b4 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.h @@ -0,0 +1,49 @@ + /* 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 __RPIPERIPHERALSERIAL_H__ +#define __RPIPERIPHERALSERIAL_H__ + +#include "types.h" +#include "wiringSerial.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int u8RPISerialSetups(char* port, int baudrate); +void u8RPISerialCloses(int fd); + +void u8RPISerialSendChars(int fd, uint8 data); +void u8RPISerialSendDatas(int fd, uint8 data); +void i8RPISerialSendDatas(int fd, int8 data); +void u16RPISerialSendDatas(int fd, uint16 data); +void i16RPISerialSendDatas(int fd, int16 data); +void sRPISerialSendDatas(int fd, float data); +void dRPISerialSendDatas(int fd, double data); +void u8RPISerialSendDataa(int fd, uint8* data, int size); +void i8RPISerialSendDataa(int fd, int8* data, int size); +void u16RPISerialSendDataa(int fd, uint16* data, int size); +void i16RPISerialSendDataa(int fd, int16* data, int size); +void sRPISerialSendDataa(int fd, float* data, int size); +void dRPISerialSendDataa(int fd, double* data, int size); +void gRPISerialSendDatas(int fd, uint8* data, int size); + +int16 i16RPISerialDataAvails(int fd); +int16 i16RPISerialGetChars(int fd); + +void u8RPISerialFlushs(int fd); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALSERIAL_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralThreading.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralThreading.h new file mode 100644 index 00000000..a7b2adb4 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralThreading.h @@ -0,0 +1,28 @@ + /* 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 __RPIPERIPHERALTHREADING_H__ +#define __RPIPERIPHERALTHREADING_H__ + +#include "types.h" +#include "wiringPi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint16 RPIThreadCreate(void *(*threadFunction)(void*)); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALTHREADING_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralTiming.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralTiming.h new file mode 100644 index 00000000..854073f3 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralTiming.h @@ -0,0 +1,34 @@ +/* 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 +*/ + +/* This file declares functions and constants related to rasberrypi*/ + +#ifndef __RPIPERIPHERALTIMING_H__ +#define __RPIPERIPHERALTIMING_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "wiringPi.h" + +void u16RPIDelayMillis(uint16 time); +void u16RPIDelayMicros(uint16 time); +uint32 u32RPIGetMillis(); +uint32 u32RPIGetMicros(); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALTIMING_H__*/ 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 new file mode 100644 index 00000000..40a8e1a4 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h @@ -0,0 +1,33 @@ +/* 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_RPIPERIPHERALGPIO_H__ +#define __INT_RPIPERIPHERALGPIO_H__ + +#include "types.h" +#include "RPIPeripheralDigital.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define RPI_DigitalSetup(in1,in2) u8RPIDigitalSetups((uint8) in1, (uint8) in2); + +#define RPI_DigitalIn(in1) u8RPIDigitalIns((uint8) in1); + +#define RPI_DigitalOut(in1,in2) u8RPIDigitalOuts((uint8) in1, (uint8) in2); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__RPIPERIPHERALGPIO_H__ */ diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPWM.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPWM.h new file mode 100644 index 00000000..8c8f4c62 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPWM.h @@ -0,0 +1,30 @@ + /* 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_RPIPERIPHERALPWM_H__ +#define __INT_RPIPERIPHERALPWM_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define RPI_HardPWMWrite(pin,value) u8RPIHardPWMWrites((uint8)pin,(uint16)value) +#define RPI_HardPWMSetRange(value) u8RPIHardPWMSetRanges((uint16)value) +#define RPI_HardPWMSetMode(mode) u8RPIHardPWMSetModes((uint8)mode) +#define RPI_HardPWMSetClock(clk_divisor) u8RPIHardPWMSetClocks((uint16)clk_divisor) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_RPIPERIPHERALPWM_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPinISR.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPinISR.h new file mode 100644 index 00000000..b2c1ed16 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPinISR.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_RPIPERIPHERALPINISR_H__ +#define __INT_RPIPERIPHERALPINISR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define RPI_PinISR(pin,edge,funname) i16RPIPinISRs((uint8)pin,(uint8)edge,funname) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_RPIPERIPHERALPINISR_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h new file mode 100644 index 00000000..5d53b98b --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h @@ -0,0 +1,47 @@ + /* 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_RPIPERIPHERALSERIAL_H__ +#define __INT_RPIPERIPHERALSERIAL_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define RPI_SerialSetup(port,size,baudrate) u16RPISerialSetups(port,baudrate) +#define RPI_SerialClose(fd) u8RPISerialCloses(fd) + +#define u80u80RPI_SerialSendData(fd,data) u8RPISerialSendDatas(fd,data) +#define u80i80RPI_SerialSendData(fd,data) i8RPISerialSendDatas(fd,data) +#define u80u160RPI_SerialSendData(fd,data) u16RPISerialSendDatas(fd,data) +#define u80i160RPI_SerialSendData(fd,data) i16RPISerialSendDatas(fd,data) +#define u80s0RPI_SerialSendData(fd,data) sRPISerialSendDatas(fd,data) +#define u80d0RPI_SerialSendData(fd,data) dRPISerialSendDatas(fd,data) + +#define u80u82RPI_SerialSendData(fd,data,size) u8RPISerialSendDataa(fd,data,size[0]*size[1]); +#define u80i82RPI_SerialSendData(fd,data,size) i8RPISerialSendDataa(fd,data,size[0]*size[1]); +#define u80u162RPI_SerialSendData(fd,data,size) u16RPISerialSendDataa(fd,data,size[0]*size[1]); +#define u80i162RPI_SerialSendData(fd,data,size) i16RPISerialSendDataa(fd,data,size[0]*size[1]); +#define u80s2RPI_SerialSendData(fd,data,size) sRPISerialSendDataa(fd,data,size[0]*size[1]); +#define u80d2RPI_SerialSendData(fd,data,size) dRPISerialSendDataa(fd,data,size[0]*size[1]); +#define u80g2RPI_SerialSendData(fd,data,size) gRPISerialSendDatas(fd,data,size[0]*size[1]); + +#define RPI_SerialDataAvail(fd) i16RPISerialDataAvails(fd) +#define RPI_SerialGetChar(fd) i16RPISerialGetChars(fd) +#define RPI_SerialFlush(fd) u8RPISerialFlushs(fd) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_RPIPERIPHERALSERIAL_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralThreading.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralThreading.h new file mode 100644 index 00000000..68ed6e0e --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralThreading.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_RPIPERIPHERALTHREADING_H__ +#define __INT_RPIPERIPHERALTHREADING_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define RPI_ThreadCreate(fn) RPIThreadCreate(fn); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_RPIPERIPHERALTHREADING_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralTiming.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralTiming.h new file mode 100644 index 00000000..1a704655 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralTiming.h @@ -0,0 +1,34 @@ +/* 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_RPIPERIPHERALTIMING_H__ +#define __INT_RPIPERIPHERALTIMING_H__ + +#include "types.h" +#include "RPIPeripheralTiming.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define RPI_DelayMicro(in1) u16RPIDelayMicros((uint16) in1) +#define RPI_DelayMilli(in1) u16RPIDelayMillis((uint16) in1) +#define RPI_GetMicro() u32RPIGetMicros() +#define RPI_GetMillis() u32RPIGetMillis() + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__RPIPERIPHERALTIMING_H__ */ diff --git a/2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetClocks.c b/2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetClocks.c new file mode 100644 index 00000000..d06b135c --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetClocks.c @@ -0,0 +1,27 @@ +/* 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 +*/ + +/*Function to set clock for pwm channel. Default clock is 19.2 MHz. 'clk_divisor' + along with range decides frequency for PWM + PWM frequency = 19.2 MHz / clk_divisor/ range + Range for clk_divisor = 1-2048 + */ + +#include "types.h" +#include "RPIPeripheralPWM.h" + +void u8RPIHardPWMSetClocks(uint16 clk_divisor) +{ + pwmSetClock(clk_divisor); + + +} diff --git a/2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetModes.c b/2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetModes.c new file mode 100644 index 00000000..0cca7a70 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetModes.c @@ -0,0 +1,28 @@ +/* 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 +*/ + +/*Function to set mode for PWM channel. Two modes are available + 0 --> balanced mode + 1 --> mark/space mode + */ + +#include "types.h" +#include "RPIPeripheralPWM.h" + +void u8RPIHardPWMSetModes(uint8 mode) +{ + if (mode == 1) /*mark/space mode*/ + pwmSetMode(PWM_MODE_MS); + else + pwmSetMode(PWM_MODE_BAL); + +} diff --git a/2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetRanges.c b/2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetRanges.c new file mode 100644 index 00000000..b2489f59 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetRanges.c @@ -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 +*/ + +/*Function to assigne pwm duty to specified pin. PWM duty is decided by 'value' + and 'range' specified using corresponding function. + PWM duty = value/range + */ + +#include "types.h" +#include "RPIPeripheralPWM.h" + +void u8RPIHardPWMSetRanges(uint16 value) +{ + pwmSetRange(value); + +} diff --git a/2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMWrites.c b/2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMWrites.c new file mode 100644 index 00000000..ae02bf0d --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMWrites.c @@ -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 +*/ + +/*Function to set range for pwm channel. PWM duty is decided by 'range' + and 'value' specified using corresponding function. + PWM duty = value/range + */ + +#include "types.h" +#include "RPIPeripheralPWM.h" +#include "RPIPeripheralDigital.h" + +void u8RPIHardPWMWrites(uint8 pin, uint16 value) +{ + pwmWrite((int)phy_pin[pin-1], value); + +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/dRPISerialSendDataa.c b/2.3-1/src/c/hardware/rasberrypi/serial/dRPISerialSendDataa.c new file mode 100644 index 00000000..f9902550 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/dRPISerialSendDataa.c @@ -0,0 +1,27 @@ +/* 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 +*/ + +/* Function to send double data array/matrix on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +void dRPISerialSendDataa(int fd, double* data, int size) +{ + int count = 0; + + for (count = 0; count < size; count++) + { + dRPISerialSendDatas(fd, data[count]); + } + +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/dRPISerialSendDatas.c b/2.3-1/src/c/hardware/rasberrypi/serial/dRPISerialSendDatas.c new file mode 100644 index 00000000..39112fc2 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/dRPISerialSendDatas.c @@ -0,0 +1,35 @@ +/* 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 +*/ + +/* Function to send double data on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +void dRPISerialSendDatas(int fd, double data) +{ + uint8 count; + + union double_bytes{ + double double_data; + unsigned char bytes[sizeof(double)]; + } in_data; + + in_data.double_data = data; + + for(count=0; count>8)); + +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/i8RPISerialSendDataa.c b/2.3-1/src/c/hardware/rasberrypi/serial/i8RPISerialSendDataa.c new file mode 100644 index 00000000..c4dd199c --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/i8RPISerialSendDataa.c @@ -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 +*/ + +/* Function to send signed 8-bit byte array/matrix on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +void i8RPISerialSendDataa(int fd, int8* data, int size) +{ + int count = 0; + + for (count = 0; count < size; ++count) + { + i8RPISerialSendDatas(fd, data[count]); + } +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/i8RPISerialSendDatas.c b/2.3-1/src/c/hardware/rasberrypi/serial/i8RPISerialSendDatas.c new file mode 100644 index 00000000..e637871f --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/i8RPISerialSendDatas.c @@ -0,0 +1,22 @@ +/* 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 +*/ + +/* Function to send signed 8-bit byte on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +void i8RPISerialSendDatas(int fd, int8 data) +{ + serialPutchar(fd, (uint8) data); + +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/sRPISerialSendDataa.c b/2.3-1/src/c/hardware/rasberrypi/serial/sRPISerialSendDataa.c new file mode 100644 index 00000000..14c0bc70 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/sRPISerialSendDataa.c @@ -0,0 +1,27 @@ +/* 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 +*/ + +/* Function to send float data array/matrix on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +void sRPISerialSendDataa(int fd, float* data, int size) +{ + int count = 0; + + for (count = 0; count < size; ++count) + { + sRPISerialSendDatas(fd, data[count]); + } + +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/sRPISerialSendDatas.c b/2.3-1/src/c/hardware/rasberrypi/serial/sRPISerialSendDatas.c new file mode 100644 index 00000000..ff78dd1f --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/sRPISerialSendDatas.c @@ -0,0 +1,34 @@ +/* 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 +*/ + +/* Function to send float data on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +void sRPISerialSendDatas(int fd, float data) +{ + uint8 count; + + union float_bytes{ + float float_data; + unsigned char bytes[sizeof(float)]; + } in_data; + in_data.float_data = data; + + for(count=0; count>8)); +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/u16RPISerialSetups.c b/2.3-1/src/c/hardware/rasberrypi/serial/u16RPISerialSetups.c new file mode 100644 index 00000000..cde4cba2 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/u16RPISerialSetups.c @@ -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 +*/ + +/* Function to setup port with desired baud rate. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +int u16RPISerialSetups(char* port, int baudrate) +{ + int fd; + + fd = serialOpen (port, baudrate); + + return fd; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialCloses.c b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialCloses.c new file mode 100644 index 00000000..5162d15e --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialCloses.c @@ -0,0 +1,21 @@ +/* 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 +*/ + +/* Function to close serial port opened. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +void u8RPISerialCloses(int fd) +{ + serialClose (fd); +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialFlushs.c b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialFlushs.c new file mode 100644 index 00000000..c80a92c5 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialFlushs.c @@ -0,0 +1,21 @@ +/* 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 +*/ + +/* Function to discards data serial buffer (received as well as waiting to be sent */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +void u8RPISerialFlushs(int fd) +{ + serialFlush(fd); +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendChars.c b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendChars.c new file mode 100644 index 00000000..e3813514 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendChars.c @@ -0,0 +1,21 @@ +/* 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 +*/ + +/* Function to send 8-bit char on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +void u8RPISerialSendChars(int fd, uint8 data) +{ + serialPutchar(fd, data); +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendDataa.c b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendDataa.c new file mode 100644 index 00000000..9d097141 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendDataa.c @@ -0,0 +1,27 @@ +/* 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 +*/ + +/* Function to send unsigned 8-bit byte array/matrix on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +void u8RPISerialSendDataa(int fd, uint8* data, int size) +{ + int count = 0; + + for (count = 0; count < size; ++count) + { + u8RPISerialSendDatas(fd, data[count]); + } + +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendDatas.c b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendDatas.c new file mode 100644 index 00000000..9edb439f --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendDatas.c @@ -0,0 +1,22 @@ +/* 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 +*/ + +/* Function to send unsigned 8-bit byte on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +void u8RPISerialSendDatas(int fd, uint8 data) +{ + serialPutchar(fd, data); + +} diff --git a/2.3-1/src/c/hardware/rasberrypi/threading/u16RPIThreadCreates.c b/2.3-1/src/c/hardware/rasberrypi/threading/u16RPIThreadCreates.c new file mode 100644 index 00000000..c05c959c --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/threading/u16RPIThreadCreates.c @@ -0,0 +1,24 @@ +/* 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 +*/ + +/* Function to create thread for given function */ + +#include "types.h" +#include "RPIPeripheralThreading.h" + +uint16 RPIThreadCreate(void *(*threadFunction)(void*)) +{ + int status; + status = piThreadCreate (threadFunction); + return status; +} + diff --git a/2.3-1/src/c/hardware/rasberrypi/timing/u16RPIDelayMicros.c b/2.3-1/src/c/hardware/rasberrypi/timing/u16RPIDelayMicros.c new file mode 100644 index 00000000..9aeeab7d --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/timing/u16RPIDelayMicros.c @@ -0,0 +1,22 @@ +/* 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 +*/ + +/* Function to insert some delay in code execution. */ + +#include "types.h" +#include "RPIPeripheralTiming.h" + +void u16RPIDelayMicros(uint16 time) +{ + delayMicroseconds(time); +} + diff --git a/2.3-1/src/c/hardware/rasberrypi/timing/u16RPIDelayMillis.c b/2.3-1/src/c/hardware/rasberrypi/timing/u16RPIDelayMillis.c new file mode 100644 index 00000000..26790861 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/timing/u16RPIDelayMillis.c @@ -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 +*/ + +/* Function to insert some delay in code execution. */ + + + +#include "types.h" +#include "RPIPeripheralTiming.h" + +void u16RPIDelayMillis(uint16 time) +{ + delay(time); + +} + diff --git a/2.3-1/src/c/hardware/rasberrypi/timing/u32RPIGetMicros.c b/2.3-1/src/c/hardware/rasberrypi/timing/u32RPIGetMicros.c new file mode 100644 index 00000000..eb086a9f --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/timing/u32RPIGetMicros.c @@ -0,0 +1,21 @@ +/* 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 +*/ + +/* Function to get time in microsecond since first setup function called */ + +#include "types.h" +#include "RPIPeripheralTiming.h" + +uint32 u32RPIGetMicros() +{ + return(micros()); +} \ No newline at end of file diff --git a/2.3-1/src/c/hardware/rasberrypi/timing/u32RPIGetMillis.c b/2.3-1/src/c/hardware/rasberrypi/timing/u32RPIGetMillis.c new file mode 100644 index 00000000..c1189753 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/timing/u32RPIGetMillis.c @@ -0,0 +1,21 @@ +/* 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 +*/ + +/* Function to get time in millisecond since first setup function called */ + +#include "types.h" +#include "RPIPeripheralTiming.h" + +uint32 u32RPIGetMillis() +{ + return(millis()); +} \ No newline at end of file -- cgit