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

ADC - Unsafe reset parameter #181

Open
usbalbin opened this issue Jan 30, 2025 · 0 comments
Open

ADC - Unsafe reset parameter #181

usbalbin opened this issue Jan 30, 2025 · 0 comments

Comments

@usbalbin
Copy link
Member

usbalbin commented Jan 30, 2025

In light of #180 is reset: bool in https://github.com/stm32-rs/stm32g4xx-hal/blob/main/src/adc.rs#L2135 really safe to expose considering the user may pass false?. Also is this really a good way to do things since ADC1 and ADC2 share the same RCC enable and reset bit PAC HAL. Same thing with ADC3-ADC5.

In other words if the user does

let adc1 = dp.ADC1.claim(..., reset=false); // Might not have waited long enough after rcc enable to register access

or

let adc1 = dp.ADC1.claim(..., reset=true);
let adc2 = dp.ADC2.claim(..., reset=true); // <--- ADC1 will be reset here

both seems, in the very least, like huge footguns to me.

Slightly similar situation with FDCAN1-3 sharing the same enable and reset bits. However the hal does not seem to reset them at all on init. Or wait for that matter

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

1 participant