From 44f24c5ace96d360c7cd3ae1b42578462a6a3609 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Mon, 4 Aug 2025 21:13:50 +0200 Subject: [PATCH] basic struct --- Cargo.lock | 7 +++++++ Cargo.toml | 1 + src/lib.rs | 11 +++++++++++ 3 files changed, 19 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 36c63fb..b87293f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,9 +8,16 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + [[package]] name = "mb85rc" version = "0.1.0" dependencies = [ "embedded-hal", + "embedded-io", ] diff --git a/Cargo.toml b/Cargo.toml index eb2c25d..cefed17 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,3 +5,4 @@ edition = "2024" [dependencies] embedded-hal = "1.0.0" +embedded-io = "0.6.1" diff --git a/src/lib.rs b/src/lib.rs index c516465..fd0cea6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,16 @@ +use embedded_hal::i2c::I2c; + const DEVICE_ADDRESS: u8 = 0b10100000; const DEVICE_ADDRESS_CODE: u8 = 0b00000000; const DEVICE_W: u8 = 0b00000000; const DEVICE_R: u8 = 0b00000001; +struct MB85RC { + i2c: T, +} + +impl MB85RC { + pub fn new(i2c: T) -> Self { + MB85RC { i2c } + } +}