summaryrefslogtreecommitdiff
path: root/2.3-1/src/c/hardware/rasberrypi/Interrupt
diff options
context:
space:
mode:
authorSiddhu89902017-07-04 20:20:46 +0530
committerSiddhu89902017-07-04 20:20:46 +0530
commite9de337a34e123749927039f7011fb30fc96f7c9 (patch)
tree4056424cb082605c759d213cff058c2491b6d43d /2.3-1/src/c/hardware/rasberrypi/Interrupt
parent9981dc71e9478fee921175d300d69fd5ba655dc5 (diff)
parente7a1a9bd776aa3ebdd13aea4d4ef838e65acb34c (diff)
downloadScilab2C-e9de337a34e123749927039f7011fb30fc96f7c9.tar.gz
Scilab2C-e9de337a34e123749927039f7011fb30fc96f7c9.tar.bz2
Scilab2C-e9de337a34e123749927039f7011fb30fc96f7c9.zip
Removed wiringPi.h include bug, added amell, bug removed for dct and idct
Diffstat (limited to '2.3-1/src/c/hardware/rasberrypi/Interrupt')
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/Interrupt/u8RPI_waitForInterrupts.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/2.3-1/src/c/hardware/rasberrypi/Interrupt/u8RPI_waitForInterrupts.c b/2.3-1/src/c/hardware/rasberrypi/Interrupt/u8RPI_waitForInterrupts.c
index 32a4a1f7..ab15b8de 100644
--- a/2.3-1/src/c/hardware/rasberrypi/Interrupt/u8RPI_waitForInterrupts.c
+++ b/2.3-1/src/c/hardware/rasberrypi/Interrupt/u8RPI_waitForInterrupts.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+/* 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
@@ -11,9 +11,34 @@
*/
#include "RPIPeripheralInterrupt.h"
+#include "RPI_wfi.h"
+#include <sys/time.h>
+#include <math.h>
+#include <stdlib.h>
int8 u8RPI_waitForInterrupts(uint8 pin,int16 time){
- int8 out;
- out=waitForInterrupt(pin,time);
- return (out);
+ __RPI_wfi=0;
+ if (wiringPiISR(pin,3,&RPI_wfi)<0){
+ return -1;
+ }
+ if (time==-1){
+ while (__RPI_wfi==0){;}
+ return 1;
+ }
+ else{
+ struct timeval time1,time2;
+ int nDigits;
+ double t1,t2;
+ gettimeofday(&time1, NULL);
+ nDigits=floor(log10(abs(time1.tv_usec)))+1;
+ t1=time1.tv_sec+time1.tv_usec/nDigits;
+ t2=t1;
+ while (__RPI_wfi==0 && t2-t1<time){
+ gettimeofday(&time2,NULL);
+ nDigits=floor(log10(abs(time2.tv_usec)))+1;
+ t2=time2.tv_sec+time2.tv_usec/nDigits;
+ }
+ if (__RPI_wfi==0){return 0;}
+ else{return 1;}
+ }
}