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

samd51 adc: init defines generic clock so adc0 and adc1 can be used at the same time #113

Merged
merged 1 commit into from
Nov 28, 2019

Conversation

jacobrosenthal
Copy link
Member

samd51 adc was hardcoding a single clock and crashing when both adc0 and adc1 were initialized at same time.

Moves clock selection to the adc init function instead. But this isnt very typestatey or safe and just moves the problem upstream. Perhaps we need a clock tree function call to replace configure_gclk_divider_and_source to hand out generic clocks so users or subsystems cant reuse.

@jacobrosenthal
Copy link
Member Author

Offtopic but in same code, isnt panic formatting still a little troublesome to be guaranteed to be stripped. Should we have .expects over unwrap?

@sajattack
Copy link
Member

I'm never sure when to use expect or unwrap or whatever. I've been told unwrap is a bit of a sin but maybe that's wrong.

@sajattack
Copy link
Member

It's a little hairy to just assume the user passes in a 48mhz clock, I'm not sure what's better though.

@sajattack
Copy link
Member

Maybe something like timerparams that outputs a particular samplerate the user requests.

@jacobrosenthal
Copy link
Member Author

jacobrosenthal commented Nov 28, 2019 via email

@sajattack
Copy link
Member

Sure, that works, but configurable samplerate would be good too.

@jacobrosenthal
Copy link
Member Author

Opened a separate issue for the bigger discussion, I think this can be merged (when it passes travis)

@sajattack sajattack merged commit 132a999 into atsamd-rs:master Nov 28, 2019
kaizensparc pushed a commit to kaizensparc/atsamd that referenced this pull request Dec 24, 2021
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.

None yet

2 participants