Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove LPSPI prototyping leftovers #164

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions src/common/lpspi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1288,9 +1288,6 @@ impl<P, const N: u8> eh02::blocking::spi::Write<u32> for Lpspi<P, N> {

/// Describes SPI words that can participate in transactions.
trait Word: Copy + Into<u32> + TryFrom<u32> {
const MAX: Self;
const ZERO: Self;

/// Repeatedly call `provider` to produce yourself,
/// then turn yourself into a LPSPI word.
fn pack_word(bit_order: BitOrder, provider: impl FnMut() -> Option<Self>) -> u32;
Expand All @@ -1301,8 +1298,6 @@ trait Word: Copy + Into<u32> + TryFrom<u32> {
}

impl Word for u8 {
const MAX: u8 = u8::MAX;
const ZERO: u8 = 0;
fn pack_word(bit_order: BitOrder, mut provider: impl FnMut() -> Option<Self>) -> u32 {
let mut word = 0;
match bit_order {
Expand Down Expand Up @@ -1333,8 +1328,6 @@ impl Word for u8 {
}

impl Word for u16 {
const MAX: u16 = u16::MAX;
const ZERO: u16 = 0;
fn pack_word(bit_order: BitOrder, mut provider: impl FnMut() -> Option<Self>) -> u32 {
let mut word = 0;
match bit_order {
Expand Down Expand Up @@ -1365,8 +1358,6 @@ impl Word for u16 {
}

impl Word for u32 {
const MAX: u32 = u32::MAX;
const ZERO: u32 = 0;
fn pack_word(_: BitOrder, mut provider: impl FnMut() -> Option<Self>) -> u32 {
provider().unwrap_or(0)
}
Expand Down Expand Up @@ -1441,15 +1432,6 @@ where
}
}

/// Transmits dummy values.
struct TransmitDummies;

impl TransmitData for TransmitDummies {
fn next_word(&mut self, _: BitOrder) -> u32 {
u32::MAX
}
}

/// Receive data into a buffer.
struct ReceiveBuffer<'a, W> {
/// The write position.
Expand Down Expand Up @@ -1504,13 +1486,6 @@ where
}
}

/// Receive dummy data.
struct ReceiveDummies;

impl ReceiveData for ReceiveDummies {
fn next_word(&mut self, _: u32) {}
}

/// Computes how may Ws fit inside a LPSPI word.
const fn per_word<W: Word>() -> usize {
core::mem::size_of::<u32>() / core::mem::size_of::<W>()
Expand Down
Loading