Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/besselfunct/mcp9600
MCP9600 Rust Crate
https://github.com/besselfunct/mcp9600
Last synced: 10 days ago
JSON representation
MCP9600 Rust Crate
- Host: GitHub
- URL: https://github.com/besselfunct/mcp9600
- Owner: besselfunct
- License: mit
- Created: 2023-01-03T01:56:37.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-13T17:44:10.000Z (almost 2 years ago)
- Last Synced: 2024-12-17T01:12:17.766Z (16 days ago)
- Language: Rust
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# mcp9600
Basic I2C driver for the Microchip Technology MCP960X Thermocouple Amplifier Chip
---
## ! This crate is a WIP and has minimal functionality !Currently, the following features are implemented:
- Reading the device ID
- Configuring the Sensor portion of the device
- Configuring the measurement profile of the device
- Performing basic hot junction temperature measurements (results in an f32)TODO:
- Read the status register and pass the result to the user
- Enable configuration of the Alert registers
- DocumentationExample use:
```rust
use mcp9600::*;// Instantiate an i2c peripheral here. Depends on hardware ecosystem
let mut sensor = MCP9600::new(i2c, DeviceAddr::AD0)?; // If the Addr pin is tied to ground
// Configure the thermocouple type, and filtercoefficient
sensor.
set_sensor_configuration(
ThermocoupleType::TypeK,
FilterCoefficient::FilterMedium,
)?;// Configure the measurement profile of the device
sensor.
set_device_configuration(
ColdJunctionResolution::High,
ADCResolution::Bit18,
BurstModeSamples::Sample1,
ShutdownMode::NormalMode
)?;// Perform a measurement
loop {
let data = sensor.read_hot_junction();
println!("Temperature is: {:?}C", data.unwrap());
// Delay by some amount
// The max measurement frequency is primarily determined by the ADC resolution
// More details can be found in the datasheet for the MCP9600: (https://www.microchip.com/en-us/product/MCP9600)
}