Skip to content

ADC - Unsafe reset parameter #181

@usbalbin

Description

@usbalbin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions