small change
This commit is contained in:
parent
84be40e742
commit
a5bfd0e961
1 changed files with 11 additions and 5 deletions
|
@ -69,12 +69,18 @@ static inline void AdcCalibrate (void) noexcept {
|
||||||
RCC.APB2PRSTR.B.ADC1RST = SET;
|
RCC.APB2PRSTR.B.ADC1RST = SET;
|
||||||
RCC.APB2PRSTR.B.ADC1RST = RESET;
|
RCC.APB2PRSTR.B.ADC1RST = RESET;
|
||||||
// set channels
|
// set channels
|
||||||
ADC1.RSQR3__CHANNEL.B.SQ1__CHSEL = 0u; // CH0
|
ADC1.RSQR3__CHANNEL.modify([](ADC1_Type::RSQR3__CHANNEL_DEF & r) -> auto {
|
||||||
ADC1.RSQR3__CHANNEL.B.SQ2 = 1u; // CH1
|
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.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;
|
static constexpr unsigned ts = 0u;
|
||||||
ADC1.SAMPTR2_CHARGE2.B.SMP2_TKCG2 = ts;
|
r.B.SMP0_TKCG0 = ts;
|
||||||
ADC1.SAMPTR2_CHARGE2.B.SMP3_TKCG3 = ts;
|
r.B.SMP1_TKCG1 = ts;
|
||||||
|
return r.R;
|
||||||
|
});
|
||||||
ADC1.CTLR1.B.SCAN = SET;
|
ADC1.CTLR1.B.SCAN = SET;
|
||||||
|
|
||||||
ADC1.CTLR2.B.ADON = SET;
|
ADC1.CTLR2.B.ADON = SET;
|
||||||
|
|
Loading…
Reference in a new issue