Skip to content

add SPI struct for master/slave bit #434

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

Closed
DmitriLyalikov opened this issue Jan 1, 2023 · 1 comment
Closed

add SPI struct for master/slave bit #434

DmitriLyalikov opened this issue Jan 1, 2023 · 1 comment

Comments

@DmitriLyalikov
Copy link

I am working on a downstream implementation for a spi slave, and would like to ask, is there a reason that the Spi Mode struct does not include a master or slave type as well? I would like to add this, and I am working actually on the driver for the rp2040 hal. What is the philosophy for not doing this at the generic hal level?

/// SPI mode
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct Mode {
/// Clock polarity
pub polarity: Polarity,
/// Clock phase
pub phase: Phase,
}

@Dirbaio
Copy link
Member

Dirbaio commented Jan 1, 2023

The current SPI traits are intentionally for SPI master mode only. The reason is for slave mode the API should be different, so it should be a different trait, not a "mode" bit in the existing trait. See previous discussion at #396

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants