From 00cae6299e63d44f715969351f60da0255f4e1b4 Mon Sep 17 00:00:00 2001 From: flo Date: Mon, 16 May 2016 13:32:58 +0200 Subject: [PATCH] ajout d'une fonction + volatile --- include/Sound4Calc.h | 2 ++ src/Sound4Calc.c | 50 +++++++++++++++++++++++--------------------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/include/Sound4Calc.h b/include/Sound4Calc.h index 3f6d658..25160b2 100644 --- a/include/Sound4Calc.h +++ b/include/Sound4Calc.h @@ -12,4 +12,6 @@ void SetPin(void); void ResetPin(void); char getMPU(void); //get_MPU to compatibility +unsigned char *itoa(int n, unsigned char* str, int base); + #endif \ No newline at end of file diff --git a/src/Sound4Calc.c b/src/Sound4Calc.c index a222ebc..870a4ab 100644 --- a/src/Sound4Calc.c +++ b/src/Sound4Calc.c @@ -11,7 +11,7 @@ #define PI 3.14159265358 -char *itoa(int n, unsigned char* str, int base) +unsigned char *itoa(int n, unsigned char* str, int base) { int i=1, j=0, x; if(n<0) str[j++] = '-', n = -n; @@ -29,8 +29,10 @@ int main(void) int sleep = 2000; int i; + #ifdef DEBUG char before = 0, during = 0, after = 0; - + #endif + setup(); //ResetPin(); while(1) @@ -58,12 +60,12 @@ int main(void) { #ifdef DEBUG - before=*SH7305_PJDR; + before=*(volatile unsigned char*)SH7305_PJDR; ResetPin(); - during=*SH7305_PJDR; + during=*(volatile unsigned char*)SH7305_PJDR; for(i=0;i