Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 163 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ include = [

[dependencies]
embedded-hal = "1.0.0"
num-derive = "0.4.2"
num-traits = {version = "0.2.19", default-features = false}
serde = {version = "1.0", default-features = false, features = ["derive"], optional = true}
defmt ={version = "1.0", optional = true}

[dev-dependencies]
embedded-hal-mock = { version = "0.11.1", features = ["eh1"] }

[features]
serde = ["dep:serde"]
defmt = ["dep:defmt"]
debug = []
2 changes: 1 addition & 1 deletion examples/peripheral-crate-implementation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cortex-m = "0.7.7"
cortex-m-rt = "0.7.3"
# cortex-m-semihosting = "0.5.0"
panic-halt = "0.2.0"
bmi323= { git = "https://github.com/wyatt-mattas/bmi323-rs/", branch = "main"}
bmi323= { path = "../../"}
embedded-hal = "1.0.0"
# heapless = "0.8.0"
# rtt-target = "0.4.0"
Expand Down
9 changes: 5 additions & 4 deletions examples/peripheral-crate-implementation/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use cortex_m_rt::entry;
use stm32h5::stm32h563;

use bmi323::{
Bmi323, AccelConfig, GyroConfig, OutputDataRate, AccelerometerRange, GyroscopeRange,
Bandwidth, AverageNum, AccelerometerPowerMode, GyroscopePowerMode,
AccelConfig, AccelerometerPowerMode, AccelerometerRange, AverageNum, Bandwidth, Bmi323, GyroConfig, GyroscopePowerMode, GyroscopeRange, OutputDataRate
};

use embedded_hal::delay::DelayNs;
use embedded_hal::i2c::{ErrorKind, ErrorType, Error as OtherError, SevenBitAddress};
use embedded_hal::i2c::Operation;
use stm32h5::stm32h563::i2c1::icr::STOPCF;

#[derive(Debug)]
pub enum I2cError {
Expand Down Expand Up @@ -84,6 +84,7 @@ impl DelayNs for Delay {

}


#[entry]
fn main() -> ! {
let peripherals = unsafe { stm32h563::Peripherals::steal() };
Expand Down Expand Up @@ -177,7 +178,7 @@ impl I2C1 {
// Wait until STOP flag is set
while i2c.isr().read().stopf().bit_is_clear() {}
// Clear the STOP flag
i2c.icr().write(|w| w.stopcf().set_bit());
i2c.icr().write(|w| w.stopcf().variant(STOPCF::Clear));

Ok(())
}
Expand Down Expand Up @@ -205,7 +206,7 @@ impl I2C1 {
// Wait until STOP flag is set
while i2c.isr().read().stopf().bit_is_clear() {}
// Clear the STOP flag
i2c.icr().write(|w| w.stopcf().set_bit());
i2c.icr().write(|w| w.stopcf().variant(STOPCF::Clear));

// Check for NACK
if i2c.isr().read().nackf().bit_is_set() {
Expand Down
Loading