| 263 | |
| 264 | |
| 265 | uint32_t MS5611::readADC() |
| 266 | { |
| 267 | command(MS5611_CMD_READ_ADC); |
| 268 | if (_result == 0) |
| 269 | { |
| 270 | uint8_t length = 3; |
| 271 | int bytes = _wire->requestFrom(_address, length); |
| 272 | if (bytes >= length) |
| 273 | { |
| 274 | uint32_t value = _wire->read() * 65536UL; |
| 275 | value += _wire->read() * 256UL; |
| 276 | value += _wire->read(); |
| 277 | return value; |
| 278 | } |
| 279 | return 0UL; |
| 280 | } |
| 281 | return 0UL; |
| 282 | } |
| 283 | |
| 284 | |
| 285 | int MS5611::command(const uint8_t command) |