small change

This commit is contained in:
Kizarm 2025-01-05 11:49:29 +01:00
parent 84be40e742
commit a5bfd0e961

View file

@ -69,12 +69,18 @@ static inline void AdcCalibrate (void) noexcept {
RCC.APB2PRSTR.B.ADC1RST = SET;
RCC.APB2PRSTR.B.ADC1RST = RESET;
// set channels
ADC1.RSQR3__CHANNEL.B.SQ1__CHSEL = 0u; // CH0
ADC1.RSQR3__CHANNEL.B.SQ2 = 1u; // CH1
ADC1.RSQR3__CHANNEL.modify([](ADC1_Type::RSQR3__CHANNEL_DEF & r) -> auto {
r.B.SQ1__CHSEL = 0u; // CH0
r.B.SQ2 = 1u; // CH1
return r.R;
});
ADC1.RSQR1.B.L = ADC_MAXCHANNELS - 1U; // 2 regular conversion
ADC1.SAMPTR2_CHARGE2.modify([](ADC1_Type::SAMPTR2_CHARGE2_DEF & r) -> auto {
static constexpr unsigned ts = 0u;
ADC1.SAMPTR2_CHARGE2.B.SMP2_TKCG2 = ts;
ADC1.SAMPTR2_CHARGE2.B.SMP3_TKCG3 = ts;
r.B.SMP0_TKCG0 = ts;
r.B.SMP1_TKCG1 = ts;
return r.R;
});
ADC1.CTLR1.B.SCAN = SET;
ADC1.CTLR2.B.ADON = SET;