From 8d13271100595c31001e0dd1078067a96e42816d Mon Sep 17 00:00:00 2001 From: Iooon Date: Wed, 1 Oct 2025 11:23:57 +0200 Subject: mspm0-i2c-target: fix spelling mistakes and revert From implementation --- embassy-mspm0/src/i2c.rs | 28 +++++++++++++--------------- embassy-mspm0/src/i2c_target.rs | 4 ++-- 2 files changed, 15 insertions(+), 17 deletions(-) (limited to 'embassy-mspm0') diff --git a/embassy-mspm0/src/i2c.rs b/embassy-mspm0/src/i2c.rs index ce5215871..0aefd19de 100644 --- a/embassy-mspm0/src/i2c.rs +++ b/embassy-mspm0/src/i2c.rs @@ -56,6 +56,19 @@ pub enum ClockDiv { } impl ClockDiv { + pub(crate) fn into(self) -> vals::Ratio { + match self { + Self::DivBy1 => vals::Ratio::DIV_BY_1, + Self::DivBy2 => vals::Ratio::DIV_BY_2, + Self::DivBy3 => vals::Ratio::DIV_BY_3, + Self::DivBy4 => vals::Ratio::DIV_BY_4, + Self::DivBy5 => vals::Ratio::DIV_BY_5, + Self::DivBy6 => vals::Ratio::DIV_BY_6, + Self::DivBy7 => vals::Ratio::DIV_BY_7, + Self::DivBy8 => vals::Ratio::DIV_BY_8, + } + } + fn divider(self) -> u32 { match self { Self::DivBy1 => 1, @@ -70,21 +83,6 @@ impl ClockDiv { } } -impl From for vals::Ratio { - fn from(value: ClockDiv) -> Self { - match value { - ClockDiv::DivBy1 => Self::DIV_BY_1, - ClockDiv::DivBy2 => Self::DIV_BY_2, - ClockDiv::DivBy3 => Self::DIV_BY_3, - ClockDiv::DivBy4 => Self::DIV_BY_4, - ClockDiv::DivBy5 => Self::DIV_BY_5, - ClockDiv::DivBy6 => Self::DIV_BY_6, - ClockDiv::DivBy7 => Self::DIV_BY_7, - ClockDiv::DivBy8 => Self::DIV_BY_8, - } - } -} - /// The I2C mode. #[derive(Clone, Copy, PartialEq, Eq, Debug)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] diff --git a/embassy-mspm0/src/i2c_target.rs b/embassy-mspm0/src/i2c_target.rs index c6ef2f5d4..7183280bd 100644 --- a/embassy-mspm0/src/i2c_target.rs +++ b/embassy-mspm0/src/i2c_target.rs @@ -62,9 +62,9 @@ pub enum ReadStatus { /// Transaction completed successfully. The controller either NACKed the last byte /// or sent a STOP condition. Done, - /// Transaction Incomplete, controller trying to read more bytes than were provided + /// Transaction incomplete, controller trying to read more bytes than were provided NeedMoreBytes, - /// Transaction Complere, but controller stopped reading bytes before we ran out + /// Transaction complete, but controller stopped reading bytes before we ran out LeftoverBytes(u16), } -- cgit