From 0e7b8710928cbc6c376edbcb43a3d8b0189e1726 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Tue, 28 Mar 2023 14:25:33 +0200 Subject: [PATCH] wip: update embedded-hal. --- Cargo.lock | 117 +++++++++++++++++++++++++++------------------------- Cargo.toml | 44 +++++++++++++++----- src/main.rs | 88 +++++++++------------------------------ 3 files changed, 113 insertions(+), 136 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 750b72c..011c390 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ dependencies = [ [[package]] name = "atomic-polyfill" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d299f547288d6db8d5c3a2916f7b2f66134b15b8c1ac1c4357dd3b8752af7bb2" +checksum = "c314e70d181aa6053b26e3f7fbf86d1dfff84f816a6175b967666b3506ef7289" dependencies = [ "critical-section", ] @@ -67,9 +67,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bytemuck" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393" +checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" [[package]] name = "byteorder" @@ -205,9 +205,9 @@ dependencies = [ [[package]] name = "embassy-cortex-m" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy?rev=0555970#055597063f2d3f1156a9f8076c601dd300d85542" +source = "git+https://github.com/embassy-rs/embassy?rev=dc304a4777e95ebd3ef53a798dc08aa8338b029a#dc304a4777e95ebd3ef53a798dc08aa8338b029a" dependencies = [ - "atomic-polyfill 1.0.1", + "atomic-polyfill 1.0.2", "cfg-if", "cortex-m", "critical-section", @@ -220,7 +220,7 @@ dependencies = [ [[package]] name = "embassy-embedded-hal" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy?rev=0555970#055597063f2d3f1156a9f8076c601dd300d85542" +source = "git+https://github.com/embassy-rs/embassy?rev=dc304a4777e95ebd3ef53a798dc08aa8338b029a#dc304a4777e95ebd3ef53a798dc08aa8338b029a" dependencies = [ "defmt", "embassy-sync", @@ -229,15 +229,15 @@ dependencies = [ "embedded-hal-async", "embedded-storage", "embedded-storage-async", - "nb 1.0.0", + "nb 1.1.0", ] [[package]] name = "embassy-executor" version = "0.1.1" -source = "git+https://github.com/embassy-rs/embassy?rev=0555970#055597063f2d3f1156a9f8076c601dd300d85542" +source = "git+https://github.com/embassy-rs/embassy?rev=dc304a4777e95ebd3ef53a798dc08aa8338b029a#dc304a4777e95ebd3ef53a798dc08aa8338b029a" dependencies = [ - "atomic-polyfill 1.0.1", + "atomic-polyfill 1.0.2", "cfg-if", "critical-section", "defmt", @@ -250,7 +250,7 @@ dependencies = [ [[package]] name = "embassy-hal-common" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy?rev=0555970#055597063f2d3f1156a9f8076c601dd300d85542" +source = "git+https://github.com/embassy-rs/embassy?rev=dc304a4777e95ebd3ef53a798dc08aa8338b029a#dc304a4777e95ebd3ef53a798dc08aa8338b029a" dependencies = [ "num-traits", ] @@ -258,7 +258,7 @@ dependencies = [ [[package]] name = "embassy-macros" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy?rev=0555970#055597063f2d3f1156a9f8076c601dd300d85542" +source = "git+https://github.com/embassy-rs/embassy?rev=dc304a4777e95ebd3ef53a798dc08aa8338b029a#dc304a4777e95ebd3ef53a798dc08aa8338b029a" dependencies = [ "darling", "proc-macro2", @@ -269,7 +269,7 @@ dependencies = [ [[package]] name = "embassy-nrf" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy?rev=0555970#055597063f2d3f1156a9f8076c601dd300d85542" +source = "git+https://github.com/embassy-rs/embassy?rev=dc304a4777e95ebd3ef53a798dc08aa8338b029a#dc304a4777e95ebd3ef53a798dc08aa8338b029a" dependencies = [ "cfg-if", "cortex-m", @@ -298,7 +298,7 @@ dependencies = [ [[package]] name = "embassy-sync" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy?rev=0555970#055597063f2d3f1156a9f8076c601dd300d85542" +source = "git+https://github.com/embassy-rs/embassy?rev=dc304a4777e95ebd3ef53a798dc08aa8338b029a#dc304a4777e95ebd3ef53a798dc08aa8338b029a" dependencies = [ "cfg-if", "critical-section", @@ -311,9 +311,9 @@ dependencies = [ [[package]] name = "embassy-time" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy?rev=0555970#055597063f2d3f1156a9f8076c601dd300d85542" +source = "git+https://github.com/embassy-rs/embassy?rev=dc304a4777e95ebd3ef53a798dc08aa8338b029a#dc304a4777e95ebd3ef53a798dc08aa8338b029a" dependencies = [ - "atomic-polyfill 1.0.1", + "atomic-polyfill 1.0.2", "cfg-if", "critical-section", "defmt", @@ -327,7 +327,7 @@ dependencies = [ [[package]] name = "embassy-usb-driver" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy?rev=0555970#055597063f2d3f1156a9f8076c601dd300d85542" +source = "git+https://github.com/embassy-rs/embassy?rev=dc304a4777e95ebd3ef53a798dc08aa8338b029a#dc304a4777e95ebd3ef53a798dc08aa8338b029a" dependencies = [ "defmt", ] @@ -345,14 +345,12 @@ dependencies = [ [[package]] name = "embedded-hal" version = "1.0.0-alpha.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "129b101ddfee640565f7c07b301a31d95aa21e5acef21a491c307139f5fa4c91" +source = "git+https://github.com/Dirbaio/embedded-hal?branch=spi-bus-sharing#0f632e4bbe2d440aa0edab746e21bf70e36440bb" [[package]] name = "embedded-hal-async" version = "0.2.0-alpha.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608a322808d65da06715e03109c0cb69f79a5459af756fba393ab83e875d4969" +source = "git+https://github.com/Dirbaio/embedded-hal?branch=spi-bus-sharing#0f632e4bbe2d440aa0edab746e21bf70e36440bb" dependencies = [ "embedded-hal 1.0.0-alpha.9", ] @@ -360,9 +358,9 @@ dependencies = [ [[package]] name = "embedded-hal-bus" version = "0.1.0-alpha.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cca80f84292bfd59899b8f1ed2d557ab2f02ea7dc7d0c0f373f47352b715d4c" +source = "git+https://github.com/Dirbaio/embedded-hal?branch=spi-bus-sharing#0f632e4bbe2d440aa0edab746e21bf70e36440bb" dependencies = [ + "critical-section", "embedded-hal 1.0.0-alpha.9", ] @@ -392,9 +390,9 @@ dependencies = [ [[package]] name = "fixed" -version = "1.23.0" +version = "1.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55f3be4cf4fc227d3a63bb77512a2b7d364200b2a715f389155785c4d3345495" +checksum = "79386fdcec5e0fde91b1a6a5bcd89677d1f9304f7f986b154a1b9109038854d9" dependencies = [ "az", "bytemuck", @@ -410,9 +408,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "futures" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" +checksum = "531ac96c6ff5fd7c62263c5e3c67a603af4fcaee2e1a0ae5565ba3a11e69e549" dependencies = [ "futures-channel", "futures-core", @@ -424,9 +422,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" +checksum = "164713a5a0dcc3e7b4b1ed7d3b433cabc18025386f9339346e8daf15963cf7ac" dependencies = [ "futures-core", "futures-sink", @@ -434,33 +432,33 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" +checksum = "86d7a0c1aa76363dac491de0ee99faf6941128376f1cf96f07db7603b7de69dd" [[package]] name = "futures-io" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" +checksum = "89d422fa3cbe3b40dca574ab087abb5bc98258ea57eea3fd6f1fa7162c778b91" [[package]] name = "futures-sink" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" +checksum = "ec93083a4aecafb2a80a885c9de1f0ccae9dbd32c2bb54b0c3a65690e0b8d2f2" [[package]] name = "futures-task" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" +checksum = "fd65540d33b37b16542a0438c12e6aeead10d4ac5d05bd3f805b8f35ab592879" [[package]] name = "futures-util" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" +checksum = "3ef6b17e481503ec85211fed8f39d1970f128935ca1f814cd32ac4a6842e84ab" dependencies = [ "futures-core", "futures-sink", @@ -522,14 +520,14 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" dependencies = [ - "nb 1.0.0", + "nb 1.1.0", ] [[package]] name = "nb" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] name = "nrf5340-app-pac" @@ -622,18 +620,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.51" +version = "1.0.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +checksum = "e472a104799c74b514a57226160104aa483546de37e839ec50e3c2e41dd87534" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] @@ -659,7 +657,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.16", + "semver 1.0.17", ] [[package]] @@ -679,9 +677,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" +checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" [[package]] name = "semver-parser" @@ -691,9 +689,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "spin" -version = "0.9.5" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dccf47db1b41fa1573ed27ccf5e08e3ca771cb994f776668c5ebda893b248fc" +checksum = "c0959fd6f767df20b231736396e4f602171e00d95205676286e79d4a4eb67bef" dependencies = [ "lock_api", ] @@ -710,7 +708,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4c37c250d21f53fa7165e76e5401d7e6539c211a8d2cf449e3962956a5cc2ce" dependencies = [ - "atomic-polyfill 1.0.1", + "atomic-polyfill 1.0.2", ] [[package]] @@ -721,9 +719,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.108" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56e159d99e6c2b93995d171050271edb50ecc5288fbc7cc17de8fdce4e58c14" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -738,9 +736,9 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "vcell" @@ -772,4 +770,9 @@ dependencies = [ [[patch.unused]] name = "embassy-futures" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy?rev=0555970#055597063f2d3f1156a9f8076c601dd300d85542" +source = "git+https://github.com/embassy-rs/embassy?rev=dc304a4777e95ebd3ef53a798dc08aa8338b029a#dc304a4777e95ebd3ef53a798dc08aa8338b029a" + +[[patch.unused]] +name = "embedded-hal-nb" +version = "1.0.0-alpha.1" +source = "git+https://github.com/Dirbaio/embedded-hal?branch=spi-bus-sharing#0f632e4bbe2d440aa0edab746e21bf70e36440bb" diff --git a/Cargo.toml b/Cargo.toml index 19bad32..1efbccb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,15 +4,31 @@ version = "0.1.0" edition = "2021" [dependencies] -embassy-executor = { version = "0.1.0", features = ["nightly", "defmt", "integrated-timers"]} -embassy-time = { version = "0.1.0", features = ["nightly", "defmt", "defmt-timestamp-uptime"]} +embassy-executor = { version = "0.1.0", features = [ + "nightly", + "defmt", + "integrated-timers", +] } +embassy-time = { version = "0.1.0", features = [ + "nightly", + "defmt", + "defmt-timestamp-uptime", +] } embassy-sync = { version = "0.1.0" } -embassy-nrf = { version = "0.1.0", features = [ "nightly", "defmt", "nrf5340-app-s", "gpiote", "time-driver-rtc1", "unstable-traits", "unstable-pac" ]} +embassy-nrf = { version = "0.1.0", features = [ + "nightly", + "defmt", + "nrf5340-app-s", + "gpiote", + "time-driver-rtc1", + "unstable-traits", + "unstable-pac", +] } cortex-m = { version = "0.7.2", features = ["critical-section-single-core"] } cortex-m-rt = { version = "0.7.3" } defmt = "0.3" defmt-rtt = "0.4" -panic-probe = { version = "0.3", features= ["print-defmt"] } +panic-probe = { version = "0.3", features = ["print-defmt"] } embedded-hal = "1.0.0-alpha.9" futures = { version = "0.3.5", default-features = false } heapless = "0.7.1" @@ -23,13 +39,13 @@ align-data = "0.1.0" bbqueue = "0.5.1" [patch.crates-io] -embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy", rev="0555970"} -embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev="0555970"} -embassy-time = { git = "https://github.com/embassy-rs/embassy", rev="0555970"} -embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev="0555970"} -embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev="0555970"} -embassy-nrf = { git = "https://github.com/embassy-rs/embassy", rev="0555970"} -embassy-macros = { git = "https://github.com/embassy-rs/embassy", rev="0555970"} +embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy", rev = "dc304a4777e95ebd3ef53a798dc08aa8338b029a" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "dc304a4777e95ebd3ef53a798dc08aa8338b029a" } +embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "dc304a4777e95ebd3ef53a798dc08aa8338b029a" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "dc304a4777e95ebd3ef53a798dc08aa8338b029a" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "dc304a4777e95ebd3ef53a798dc08aa8338b029a" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy", rev = "dc304a4777e95ebd3ef53a798dc08aa8338b029a" } +embassy-macros = { git = "https://github.com/embassy-rs/embassy", rev = "dc304a4777e95ebd3ef53a798dc08aa8338b029a" } # embassy-embedded-hal = { path = "/home/dirbaio/embassy/embassy/embassy-embedded-hal" } # embassy-executor = { path = "/home/dirbaio/embassy/embassy/embassy-executor" } @@ -39,6 +55,12 @@ embassy-macros = { git = "https://github.com/embassy-rs/embassy", rev="0555970"} # embassy-nrf = { path = "/home/dirbaio/embassy/embassy/embassy-nrf" } # embassy-macros = { path = "/home/dirbaio/embassy/embassy/embassy-macros" } + +embedded-hal = { git = "https://github.com/Dirbaio/embedded-hal", branch = "spi-bus-sharing" } +embedded-hal-async = { git = "https://github.com/Dirbaio/embedded-hal", branch = "spi-bus-sharing" } +embedded-hal-bus = { git = "https://github.com/Dirbaio/embedded-hal", branch = "spi-bus-sharing" } +embedded-hal-nb = { git = "https://github.com/Dirbaio/embedded-hal", branch = "spi-bus-sharing" } + [profile.dev] debug = 2 debug-assertions = true diff --git a/src/main.rs b/src/main.rs index 74f530a..a477255 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,6 +23,7 @@ use embassy_nrf::qspi::Qspi; use embassy_nrf::spim::Spim; use embassy_nrf::{bind_interrupts, spim}; use embassy_time::{Duration, Timer}; +use embedded_hal::spi::Operation; use embedded_hal_async::spi::{ExclusiveDevice, SpiBus as _, SpiBusRead as _, SpiBusWrite as _, SpiDevice}; use {embassy_nrf as _, panic_probe as _}; @@ -806,103 +807,54 @@ struct SpiBus { spi: T, } -impl Bus for SpiBus -where - T::Bus: embedded_hal_async::spi::SpiBus, -{ +impl Bus for SpiBus { async fn read(&mut self, addr: u32, buf: &mut [u32]) { self.spi - .transaction(move |bus| { - let bus = unsafe { &mut *bus }; - async move { - bus.write(&[0x0B, (addr >> 16) as u8, (addr >> 8) as u8, addr as u8, 0x00]) - .await?; - bus.read(slice8_mut(buf)).await?; - Ok(()) - } - }) + .transaction(&mut [ + Operation::Write(&[0x0B, (addr >> 16) as u8, (addr >> 8) as u8, addr as u8, 0x00]), + Operation::Read(slice8_mut(buf)), + ]) .await .unwrap() } async fn write(&mut self, addr: u32, buf: &[u32]) { self.spi - .transaction(move |bus| { - let bus = unsafe { &mut *bus }; - async move { - bus.write(&[0x02, (addr >> 16) as u8 | 0x80, (addr >> 8) as u8, addr as u8]) - .await?; - bus.write(slice8(buf)).await?; - Ok(()) - } - }) + .transaction(&mut [ + Operation::Write(&[0x02, (addr >> 16) as u8 | 0x80, (addr >> 8) as u8, addr as u8]), + Operation::Write(slice8(buf)), + ]) .await .unwrap() } async fn read_sr0(&mut self) -> u8 { - let val = self - .spi - .transaction(move |bus| { - let bus = unsafe { &mut *bus }; - async move { - let mut buf = [0; 2]; - bus.transfer(&mut buf, &[0x05]).await?; - Ok(buf[1]) - } - }) - .await - .unwrap(); + let mut buf = [0; 2]; + self.spi.transfer(&mut buf, &[0x05]).await.unwrap(); + let val = buf[1]; defmt::trace!("read sr0 = {:02x}", val); val } async fn read_sr1(&mut self) -> u8 { - let val = self - .spi - .transaction(move |bus| { - let bus = unsafe { &mut *bus }; - async move { - let mut buf = [0; 2]; - bus.transfer(&mut buf, &[0x1f]).await?; - Ok(buf[1]) - } - }) - .await - .unwrap(); + let mut buf = [0; 2]; + self.spi.transfer(&mut buf, &[0x1f]).await.unwrap(); + let val = buf[1]; defmt::trace!("read sr1 = {:02x}", val); val } async fn read_sr2(&mut self) -> u8 { - let val = self - .spi - .transaction(move |bus| { - let bus = unsafe { &mut *bus }; - async move { - let mut buf = [0; 2]; - bus.transfer(&mut buf, &[0x2f]).await?; - Ok(buf[1]) - } - }) - .await - .unwrap(); + let mut buf = [0; 2]; + self.spi.transfer(&mut buf, &[0x2f]).await.unwrap(); + let val = buf[1]; defmt::trace!("read sr2 = {:02x}", val); val } async fn write_sr2(&mut self, val: u8) { defmt::trace!("write sr2 = {:02x}", val); - self.spi - .transaction(move |bus| { - let bus = unsafe { &mut *bus }; - async move { - bus.write(&[0x3f, val]).await?; - Ok(()) - } - }) - .await - .unwrap() + self.spi.write(&[0x3f, val]).await.unwrap(); } }