https://github.com/lukwol/mcp9808
Platform agnostic Rust driver for the Microchip MCP9808 temperature sensor.
https://github.com/lukwol/mcp9808
embedded embedded-hal embedded-hal-driver i2c no-std rust
Last synced: 11 months ago
JSON representation
Platform agnostic Rust driver for the Microchip MCP9808 temperature sensor.
- Host: GitHub
- URL: https://github.com/lukwol/mcp9808
- Owner: lukwol
- License: apache-2.0
- Created: 2019-03-26T20:40:50.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-05-22T08:27:14.000Z (about 6 years ago)
- Last Synced: 2025-05-14T18:09:00.169Z (about 1 year ago)
- Topics: embedded, embedded-hal, embedded-hal-driver, i2c, no-std, rust
- Language: Rust
- Homepage:
- Size: 86.9 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# mcp9808
Rust generic driver for MCP9808 temperature sensor.
## Features
* User-Programmable Temperature Alert Output
* Operating Voltage Range: 2.7V to 5.5V
* OperatingCurrent: 200μA (typical)
* ShutdownCurrent: 0.1μA (typical)
* 2-wire Interface: I2C™/SMBus Compatible
* Available Packages: 2x3DFN-8, MSOP-8
### Accuracy:
* ±0.25 (typical) from -40°C to +125°C
* ±0.5°C (maximum) from -20°C to 100°C
* ±1°C (maximum) from -40°C to +125°C
### User-Selectable Measurement Resolution:
* +0.5°C
* +0.25°C
* +0.125°C
* +0.0625°C
### User-Programmable Temperature Limits:
* Temperature Window Limit
* Critical Temperature Limit
## Example
```rust
use embedded_hal::blocking::i2c;
use mcp9808::{
temperature::{Celsius, TemperatureMeasurement},
SlaveAddress, MCP9808,
};
let mut mcp9808 = MCP9808::new(i2c, SlaveAddress::Default);
let measurement: TemperatureMeasurement = mcp9808.read_ambient_temperature().unwrap();
assert_eq!(Celsius(-24.063), measurement.temperature);
```
## License
Licensed under either of
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.