fixed read loop to be slightly less CPU speed dependent
This commit is contained in:
parent
d84a97103f
commit
621790f156
|
@ -250,7 +250,7 @@ sht11_off(void)
|
||||||
static unsigned int
|
static unsigned int
|
||||||
scmd(unsigned cmd)
|
scmd(unsigned cmd)
|
||||||
{
|
{
|
||||||
unsigned long n;
|
unsigned int n;
|
||||||
|
|
||||||
if(cmd != MEASURE_HUMI && cmd != MEASURE_TEMP) {
|
if(cmd != MEASURE_HUMI && cmd != MEASURE_TEMP) {
|
||||||
PRINTF("Illegal command: %d\n", cmd);
|
PRINTF("Illegal command: %d\n", cmd);
|
||||||
|
@ -263,7 +263,7 @@ scmd(unsigned cmd)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(n = 0; n < 250000; n++) {
|
for(n = 0; n < 20000; n++) {
|
||||||
if(!SDA_IS_1) {
|
if(!SDA_IS_1) {
|
||||||
unsigned t0, t1, rcrc;
|
unsigned t0, t1, rcrc;
|
||||||
t0 = sread(1);
|
t0 = sread(1);
|
||||||
|
@ -285,8 +285,9 @@ scmd(unsigned cmd)
|
||||||
#endif
|
#endif
|
||||||
return (t0 << 8) | t1;
|
return (t0 << 8) | t1;
|
||||||
}
|
}
|
||||||
|
/* short wait before next loop */
|
||||||
|
clock_wait(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
sreset();
|
sreset();
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in a new issue