diff --git a/Cargo.toml b/Cargo.toml index 74f9732..002301c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ license = "MIT OR Apache-2.0" keywords = ["bme280", "bmp280", "temperature", "pressure", "humidity"] categories = ["embedded", "no-std", "hardware-support", "embedded-hal"] edition = "2018" +autoexamples = false [lib] name = "bme280" @@ -15,20 +16,21 @@ name = "bme280" [dependencies] embedded-hal = "=1.0.0-alpha.8" serde = { version = "1.0", optional = true, features = ["derive"] } -defmt = { version = "0.3.2", optional = true } +defmt = { version = "0.3", optional = true } derive_more = { version = "0.99.17", optional = true} embedded-hal-async = { version = "0.1.0-alpha.1", optional = true } maybe-async-cfg = "0.2.3" [dev-dependencies] cortex-m-rtic = "1.0.0" -cortex-m = "0.7.3" +cortex-m = { version = "0.7.3", features = ["critical-section-single-core"] } cortex-m-rt = "0.7.0" -defmt-rtt = "0.3.0" +defmt = "0.3" +defmt-rtt = "0.4" panic-semihosting = "0.6" [dev-dependencies.stm32f4xx-hal] -version = "0.13.2" +version = "0.14" features = ["stm32f411"] [features] diff --git a/examples/rtic.rs b/examples/rtic.rs index 848d89b..6d84c4e 100644 --- a/examples/rtic.rs +++ b/examples/rtic.rs @@ -1,6 +1,13 @@ +//! Example on using the BME 280 via i2c on a stm32f411. +//! +//! To run, make sure you install the correct rustup target: +//! $ rustup target add thumbv7em-none-eabihf +//! $ cargo build --target thumbv7em-none-eabihf --examples + #![no_main] #![no_std] +use defmt_rtt as _; use panic_semihosting as _; #[rtic::app(device = stm32f4xx_hal::pac)] @@ -14,8 +21,8 @@ mod app { timer::delay::Delay, }; - type Scl = Pin, 'B', 6>; - type Sda = Pin, 'B', 7>; + type Scl = Pin<'B', 6, Alternate<4, OpenDrain>>; + type Sda = Pin<'B', 7, Alternate<4, OpenDrain>>; #[shared] struct Shared {}