diff --git a/si7005/i2c.c b/si7005/i2c.c index 5bcc345..287a7d5 100644 --- a/si7005/i2c.c +++ b/si7005/i2c.c @@ -140,9 +140,18 @@ static U8 addr7r = 0, addr7w = 0; +extern volatile unsigned long Global_time; + static U16 _c; -#define I2C_WAIT(evt) do{for(_c = 0; _c < 16000; _c++){ \ - if(evt) break;} if(_c == 16000) return ret;}while(0) +static unsigned long wtm; +#define I2C_WAIT(evt, tmo) do{wtm = Global_time; \ + while(Global_time-wtm