From a03407d08cb283485a3ff66487afac13f67807ee Mon Sep 17 00:00:00 2001 From: anton smeenk Date: Sat, 28 Oct 2023 08:58:08 +0200 Subject: [PATCH] Searching for solution for vals::Omask not found. Is found locally, but not on build server --- embassy-stm32/src/i2c/mod.rs | 30 +++++++++------------------ embassy-stm32/src/i2c/v2.rs | 1 + examples/stm32g0/src/bin/i2c_slave.rs | 1 - 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/embassy-stm32/src/i2c/mod.rs b/embassy-stm32/src/i2c/mod.rs index 6e0773d4..29ec1dae 100644 --- a/embassy-stm32/src/i2c/mod.rs +++ b/embassy-stm32/src/i2c/mod.rs @@ -1,6 +1,6 @@ #![macro_use] -use stm32_metapac::i2c::vals; +use stm32_metapac::i2c::vals::Oamsk; use crate::interrupt; @@ -45,35 +45,25 @@ pub enum Address2Mask { } impl Address2Mask { #[inline(always)] - pub const fn to_vals_impl(self) -> vals::Oamsk { + pub const fn to_vals_impl(self) -> Oamsk { match self { - Address2Mask::NOMASK => vals::Oamsk::NOMASK, - Address2Mask::MASK1 => vals::Oamsk::MASK1, - Address2Mask::MASK2 => vals::Oamsk::MASK2, - Address2Mask::MASK3 => vals::Oamsk::MASK3, - Address2Mask::MASK4 => vals::Oamsk::MASK4, - Address2Mask::MASK5 => vals::Oamsk::MASK5, - Address2Mask::MASK6 => vals::Oamsk::MASK6, - Address2Mask::MASK7 => vals::Oamsk::MASK7, + Address2Mask::NOMASK => Oamsk::NOMASK, + Address2Mask::MASK1 => Oamsk::MASK1, + Address2Mask::MASK2 => Oamsk::MASK2, + Address2Mask::MASK3 => Oamsk::MASK3, + Address2Mask::MASK4 => Oamsk::MASK4, + Address2Mask::MASK5 => Oamsk::MASK5, + Address2Mask::MASK6 => Oamsk::MASK6, + Address2Mask::MASK7 => Oamsk::MASK7, } } } -#[repr(u8)] #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] pub enum Dir { WRITE, READ, } -impl Dir { - #[inline(always)] - pub const fn to_vals_impl(self) -> vals::Dir { - match self { - Dir::READ => vals::Dir::READ, - Dir::WRITE => vals::Dir::WRITE, - } - } -} pub(crate) mod sealed { use super::*; diff --git a/embassy-stm32/src/i2c/v2.rs b/embassy-stm32/src/i2c/v2.rs index 63473a96..b4b4269b 100644 --- a/embassy-stm32/src/i2c/v2.rs +++ b/embassy-stm32/src/i2c/v2.rs @@ -1527,6 +1527,7 @@ mod eh1 { Self::Crc => embedded_hal_1::i2c::ErrorKind::Other, Self::Overrun => embedded_hal_1::i2c::ErrorKind::Overrun, Self::ZeroLengthTransfer => embedded_hal_1::i2c::ErrorKind::Other, + Self::BufferSize => embedded_hal_1::i2c::ErrorKind::Other, } } } diff --git a/examples/stm32g0/src/bin/i2c_slave.rs b/examples/stm32g0/src/bin/i2c_slave.rs index 3bc391a2..62c397e9 100644 --- a/examples/stm32g0/src/bin/i2c_slave.rs +++ b/examples/stm32g0/src/bin/i2c_slave.rs @@ -115,7 +115,6 @@ async fn main(spawner: Spawner) { let mut buf_20 = [0; 20]; // buffer is shorter than master will send: wait for STOP condition let mut buf_20a = [0; 20]; let mut buf_2 = [0; 2]; - let mut buf_1 = [0; 1]; let mut errors = 0; let mut address = 0; let mut dir = Dir::READ;