{"record":{"id":"876660ec3d1e7e1c","repo":"embassy-rs/embassy","slug":"not-implemented","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/src/adc/adc4.rs","lineNumber":254,"sourceCode":"        Resolution::Bits10 => 2,\n        Resolution::Bits8 => 4,\n        Resolution::Bits6 => 6,\n        #[allow(unreachable_patterns)]\n        _ => 0,\n    }\n}\n\nfn from_ker_ck(frequency: Hertz) -> Presc {\n    let raw_prescaler = rcc::raw_prescaler(frequency.0, MAX_ADC_CLK_FREQ.0);\n    match raw_prescaler {\n        0 => Presc::Div1,\n        1 => Presc::Div2,\n        2..=3 => Presc::Div4,\n        4..=5 => Presc::Div6,\n        6..=7 => Presc::Div8,\n        8..=9 => Presc::Div10,\n        10..=11 => Presc::Div12,\n        _ => unimplemented!(),\n    }\n}\n\nimpl AdcRegs for crate::pac::adc::Adc4 {\n    fn data(&self) -> *mut u16 {\n        crate::pac::adc::Adc4::dr(*self).as_ptr() as *mut u16\n    }\n\n    fn enable(&self) {\n        if !self.cr().read().aden() || !self.isr().read().adrdy() {\n            self.isr().write(|w| w.set_adrdy(true));\n            self.cr().modify(|w| w.set_aden(true));\n            while !self.isr().read().adrdy() {}\n        }\n    }\n\n    fn start(&self) {\n        // Start conversion","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/src/adc/adc4.rs#L236-L272","documentation":"from_ker_ck computes the ADC clock prescaler from the kernel clock frequency, dividing down to reach a valid ADC clock. The final fallthrough arm uses unimplemented!(), so any frequency that does not map to prescaler Div2..Div12 (i.e. outside the handled ranges) panics with 'not implemented'.","triggerScenarios":"Creating an Adc4 via new_adc4 with a kernel clock (ker_ck) frequency whose required division does not match the ranges 1, 2..=3, 4..=5, 6..=7, 8..=9, 10..=11 after division steps.","commonSituations":"An unusually low or nonstandard ADC kernel clock frequency configured in RCC that falls outside the prescaler mapping table.","solutions":["Set the ADC kernel clock (via RCC configuration) to a frequency that maps to a supported prescaler","Clamp or round the frequency before calling new_adc4 so it falls within 1..=11 of the scaling step","Replace the unimplemented!() with a defensive fallback or panic message including the frequency","Verify ADC clock config in RCC (adc clock source/divider) matches the datasheet range"],"exampleFix":"// before\nlet adc = Adc4::new(p.ADC4, Irqs, Adc4Config::default()); // with unsupported ker clock\n// after\nlet config = Adc4Config::default().clock(/* valid frequency within prescaler table */);\nlet adc = Adc4::new(p.ADC4, Irqs, config);","handlingStrategy":"validation","validationCode":"// before constructing Adc4, ensure ker_ck maps to a supported prescaler step\n// step = ker_ck freq / target adc clock; must land in 1..=11\nassert!((1..=11).contains(&step), \"ADC4 kernel clock not prescalable: step={}\", step);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify RCC ADC kernel clock settings for your board","Keep ADC clock frequencies within the range mappable to Div2..Div12"],"tags":["rust","embedded","stm32","adc","clock-config"],"backgroundTag":"invalid-config-value","analyzedSha":"463a07b963419a1bfe61d5d597c44acb810afb8b","analyzedAt":"2026-09-10T13:38:26.660Z","contentChangedAt":"2026-09-10T13:38:26.660Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}