Skip to content

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

Merged
ivmarkov merged 6 commits into
esp-rs:masterfrom
horvbalint:master
Apr 15, 2023
Merged

Add an spi::config::BitOrder enum#222
ivmarkov merged 6 commits into
esp-rs:masterfrom
horvbalint:master

Conversation

@horvbalint

Copy link
Copy Markdown
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!

@Vollbrecht Vollbrecht left a comment

Copy link
Copy Markdown
Collaborator

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

Comment thread src/spi.rs
pub bit_order: BitOrder,
pub cs_active_high: bool,
pub input_delay_ns: i32,
}

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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