diff options
| author | Iooon <[email protected]> | 2025-10-01 11:23:57 +0200 |
|---|---|---|
| committer | crispaudio <[email protected]> | 2025-10-10 07:01:23 +0200 |
| commit | 8d13271100595c31001e0dd1078067a96e42816d (patch) | |
| tree | 6d3f35be6a6c3f3ebcd5a76a445a13ecc5474830 | |
| parent | 7797cc0effa069b78be29ff19b81068b17f98ac2 (diff) | |
mspm0-i2c-target: fix spelling mistakes and revert From<ClockDiv> implementation
| -rw-r--r-- | embassy-mspm0/src/i2c.rs | 28 | ||||
| -rw-r--r-- | embassy-mspm0/src/i2c_target.rs | 4 |
2 files changed, 15 insertions, 17 deletions
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 { | |||
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | impl ClockDiv { | 58 | impl ClockDiv { |
| 59 | pub(crate) fn into(self) -> vals::Ratio { | ||
| 60 | match self { | ||
| 61 | Self::DivBy1 => vals::Ratio::DIV_BY_1, | ||
| 62 | Self::DivBy2 => vals::Ratio::DIV_BY_2, | ||
| 63 | Self::DivBy3 => vals::Ratio::DIV_BY_3, | ||
| 64 | Self::DivBy4 => vals::Ratio::DIV_BY_4, | ||
| 65 | Self::DivBy5 => vals::Ratio::DIV_BY_5, | ||
| 66 | Self::DivBy6 => vals::Ratio::DIV_BY_6, | ||
| 67 | Self::DivBy7 => vals::Ratio::DIV_BY_7, | ||
| 68 | Self::DivBy8 => vals::Ratio::DIV_BY_8, | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 59 | fn divider(self) -> u32 { | 72 | fn divider(self) -> u32 { |
| 60 | match self { | 73 | match self { |
| 61 | Self::DivBy1 => 1, | 74 | Self::DivBy1 => 1, |
| @@ -70,21 +83,6 @@ impl ClockDiv { | |||
| 70 | } | 83 | } |
| 71 | } | 84 | } |
| 72 | 85 | ||
| 73 | impl From<ClockDiv> for vals::Ratio { | ||
| 74 | fn from(value: ClockDiv) -> Self { | ||
| 75 | match value { | ||
| 76 | ClockDiv::DivBy1 => Self::DIV_BY_1, | ||
| 77 | ClockDiv::DivBy2 => Self::DIV_BY_2, | ||
| 78 | ClockDiv::DivBy3 => Self::DIV_BY_3, | ||
| 79 | ClockDiv::DivBy4 => Self::DIV_BY_4, | ||
| 80 | ClockDiv::DivBy5 => Self::DIV_BY_5, | ||
| 81 | ClockDiv::DivBy6 => Self::DIV_BY_6, | ||
| 82 | ClockDiv::DivBy7 => Self::DIV_BY_7, | ||
| 83 | ClockDiv::DivBy8 => Self::DIV_BY_8, | ||
| 84 | } | ||
| 85 | } | ||
| 86 | } | ||
| 87 | |||
| 88 | /// The I2C mode. | 86 | /// The I2C mode. |
| 89 | #[derive(Clone, Copy, PartialEq, Eq, Debug)] | 87 | #[derive(Clone, Copy, PartialEq, Eq, Debug)] |
| 90 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 88 | #[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 { | |||
| 62 | /// Transaction completed successfully. The controller either NACKed the last byte | 62 | /// Transaction completed successfully. The controller either NACKed the last byte |
| 63 | /// or sent a STOP condition. | 63 | /// or sent a STOP condition. |
| 64 | Done, | 64 | Done, |
| 65 | /// Transaction Incomplete, controller trying to read more bytes than were provided | 65 | /// Transaction incomplete, controller trying to read more bytes than were provided |
| 66 | NeedMoreBytes, | 66 | NeedMoreBytes, |
| 67 | /// Transaction Complere, but controller stopped reading bytes before we ran out | 67 | /// Transaction complete, but controller stopped reading bytes before we ran out |
| 68 | LeftoverBytes(u16), | 68 | LeftoverBytes(u16), |
| 69 | } | 69 | } |
| 70 | 70 | ||
