MCPcopy Index your code
hub / github.com/VersBinarii/bme280-rs

github.com/VersBinarii/bme280-rs @0.2.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.2.1 ↗ · + Follow
28 symbols 50 edges 2 files 5 documented · 18%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

bme280

A rust device driver for the Bosch BME280 temperature, humidity, and atmospheric pressure sensor and the Bosch BMP280 temperature and atmospheric pressure sensor.

Usage

View Complete Documentation Here

use linux_embedded_hal as hal;

use linux_embedded_hal::{Delay, I2cdev};
use bme280::BME280;

// using Linux I2C Bus #1 in this example
let i2c_bus = I2cdev::new("/dev/i2c-1").unwrap();

// initialize the BME280 using the primary I2C address 0x76
let mut bme280 = BME280::new_primary(i2c_bus, Delay);

// or, initialize the BME280 using the secondary I2C address 0x77
// let mut bme280 = BME280::new_secondary(i2c_bus, Delay);

// or, initialize the BME280 using a custom I2C address
// let bme280_i2c_addr = 0x88;
// let mut bme280 = BME280::new(i2c_bus, bme280_i2c_addr, Delay);

// initialize the sensor
bme280.init().unwrap();

// measure temperature, pressure, and humidity
let measurements = bme280.measure().unwrap();

println!("Relative Humidity = {}%", measurements.humidity);
println!("Temperature = {} deg C", measurements.temperature);
println!("Pressure = {} pascals", measurements.pressure);

Serde Support

To enable optional serde serialization support for the measurements struct, simply enable the serde feature, like so in Cargo.toml:

[dependencies]
bme280 = { version = "0.2", features = ["serde"] }

License

Licensed under either of:

  • Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (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.

Core symbols most depended-on inside this repo

write_register
called by 6
src/lib.rs
read_register
called by 5
src/lib.rs
soft_reset
called by 3
src/lib.rs
mode
called by 2
src/lib.rs
init
called by 1
src/lib.rs
verify_chip_id
called by 1
src/lib.rs
calibrate
called by 1
src/lib.rs
configure
called by 1
src/lib.rs

Shape

Method 21
Class 3
Enum 2
Function 2

Languages

Rust100%

Modules by API surface

src/lib.rs27 symbols
example/src/main.rs1 symbols

For agents

$ claude mcp add bme280-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page