dprotsiv / dps310-rs

Infineon DPS310 I2C driver in rust
MIT License
2 stars 5 forks source link

Properly initialize coefficients #2

Closed chemicstry closed 2 years ago

chemicstry commented 2 years ago

Coefficients are not available immediately after power up and must only be read when COEF_RDY bit is set in MEAS_CFG register. Otherwise, if sensor is initialized too soon, the measurements are incorrect. Hence I exposed the read_calibration_coefficients() to the user and added an accompanying coef_ready().

Also fixed wrong mask for the init_complete() (although it happened to work due to additional mask in read_status()) and properly implemented lib-specific error handling by adding Error::InvalidMeasurementMode.

This needs a minor version bump, since user now has to call read_calibration_coefficients().