Skip to content

Add an spi::config::BitOrder enum #222

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

Merged
merged 6 commits into from
Apr 15, 2023
Merged

Conversation

horvbalint
Copy link
Contributor

This PR introduces a new enum spi::config::BitOrder which can be used to specify the order of the bits transfered/received. I tried to test all the variants of the enum, but I am new to embedded development, so I would appreciate if someone else would also test them :)

Thanks @Vollbrecht and @Dominaezzz for the help in the Matrix channel!

Copy link
Collaborator

@Vollbrecht Vollbrecht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it on an esp32c3 and seems to work as accepted.
MSB First:
Screenshot from 2023-03-27 22-07-26

LSB First:

Screenshot from 2023-03-27 22-06-09

@@ -165,6 +189,7 @@ pub mod config {
/// See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/spi_master.html#timing-considerations
pub write_only: bool,
pub duplex: Duplex,
pub bit_order: BitOrder,
pub cs_active_high: bool,
pub input_delay_ns: i32,
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: for consistency maybe add an pub fn bitorder to the Config builder pattern.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I missed that 😄 Added it now

@ivmarkov
Copy link
Collaborator

Thanks!

@ivmarkov ivmarkov merged commit b388e67 into esp-rs:master Apr 15, 2023
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

Successfully merging this pull request may close these issues.

3 participants