|
@ -120,7 +120,9 @@ class AM2320Sensor : public I2CSensor { |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
void _read() { |
|
|
void _read() { |
|
|
|
|
|
|
|
|
i2c_wakeup(); |
|
|
i2c_wakeup(); |
|
|
|
|
|
|
|
|
// waiting time of at least 800 μs, the maximum 3000 μs |
|
|
// waiting time of at least 800 μs, the maximum 3000 μs |
|
|
delayMicroseconds(800); // just to be on safe side |
|
|
delayMicroseconds(800); // just to be on safe side |
|
|
|
|
|
|
|
@ -128,7 +130,7 @@ class AM2320Sensor : public I2CSensor { |
|
|
// 4 = number of bytes to read |
|
|
// 4 = number of bytes to read |
|
|
if (i2c_write_uint8(_address, AM2320_I2C_READ_REGISTER_DATA, 0x00, 4) != I2C_TRANS_SUCCESS) { |
|
|
if (i2c_write_uint8(_address, AM2320_I2C_READ_REGISTER_DATA, 0x00, 4) != I2C_TRANS_SUCCESS) { |
|
|
_error = SENSOR_ERROR_TIMEOUT; |
|
|
_error = SENSOR_ERROR_TIMEOUT; |
|
|
return false; |
|
|
|
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
unsigned char _buffer[8]; |
|
|
unsigned char _buffer[8]; |
|
|