Skip to content

Conversation

@jneem
Copy link
Contributor

@jneem jneem commented Sep 15, 2023

The ADC read functions all return a generic From<u16> but I couldn't find a rationale for it: the read is always done first as a u16, so why not just return that and allow the user to convert it if they want?

This change allows for removing some type annotations.

@bjoernQ
Copy link
Contributor

bjoernQ commented Sep 18, 2023

I think From<u16> pretty much originates in the example in https://docs.rs/embedded-hal/0.2.7/embedded_hal/adc/trait.OneShot.html

I don't see an obvious disadvantage in changing it to u16

Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

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

Yeah, I think this is just a copy-paste relic from the past, makes sense to make this change IMO. LGTM, thanks!

@jessebraham jessebraham merged commit ced8088 into esp-rs:main Sep 22, 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