@@ -498,9 +498,9 @@ where
498498
499499 self . reg
500500 . cr ( )
501- . modify ( |_, w| w. adcaldif ( ) . single_ended ( ) . adcal ( ) . calibration ( ) ) ;
501+ . modify ( |_, w| w. adcaldif ( ) . single_ended ( ) . adcal ( ) . start_calibration ( ) ) ;
502502
503- while self . reg . cr ( ) . read ( ) . adcal ( ) . is_calibration ( ) { }
503+ while self . reg . cr ( ) . read ( ) . adcal ( ) . is_calibrating ( ) { }
504504
505505 // ADEN bit cannot be set during ADCAL=1 and 4 ADC clock cycle after the ADCAL bit is
506506 // cleared by hardware
@@ -689,8 +689,8 @@ where
689689 #[ rustfmt:: skip]
690690 pub fn channel_sequence ( & self , sequence : config:: Sequence ) -> Option < channel:: Id > {
691691 // Set the channel in the right sequence field
692- let index = channel % 4 ;
693- match channel {
692+ let index = sequence as u8 % 4 ;
693+ match sequence as u8 {
694694 0 ..=3 => self . reg . sqr1 ( ) . read ( ) . sq ( index) . bits ( ) . try_into ( ) . ok ( ) ,
695695 4 ..=7 => self . reg . sqr2 ( ) . read ( ) . sq ( index) . bits ( ) . try_into ( ) . ok ( ) ,
696696 8 ..=11 => self . reg . sqr3 ( ) . read ( ) . sq ( index) . bits ( ) . try_into ( ) . ok ( ) ,
@@ -999,12 +999,12 @@ where
999999 // Set the channel in the right sequence field
10001000 // SAFETY: the channel.into() implementation ensures that those are valid values
10011001 unsafe {
1002- let index = channel % 4 ;
1003- match channel {
1004- 0 ..=3 => self . reg . sqr1 ( ) . modify ( |_, w| w. sq ( index) . set ( channel. into ( ) ) ) ,
1005- 4 ..=7 => self . reg . sqr2 ( ) . modify ( |_, w| w. sq ( index) . set ( channel. into ( ) ) ) ,
1006- 8 ..=11 => self . reg . sqr3 ( ) . modify ( |_, w| w. sq ( index) . set ( channel. into ( ) ) ) ,
1007- 12 .. => self . reg . sqr4 ( ) . modify ( |_, w| w. sq ( index) . set ( channel. into ( ) ) ) ,
1002+ let index = sequence as u8 % 4 ;
1003+ match sequence as u8 {
1004+ 0 ..=3 => self . reg . sqr1 ( ) . modify ( |_, w| w. sq ( index) . bits ( channel. into ( ) ) ) ,
1005+ 4 ..=7 => self . reg . sqr2 ( ) . modify ( |_, w| w. sq ( index) . bits ( channel. into ( ) ) ) ,
1006+ 8 ..=11 => self . reg . sqr3 ( ) . modify ( |_, w| w. sq ( index) . bits ( channel. into ( ) ) ) ,
1007+ 12 .. => self . reg . sqr4 ( ) . modify ( |_, w| w. sq ( index) . bits ( channel. into ( ) ) ) ,
10081008 } ;
10091009 }
10101010 }
@@ -1022,7 +1022,7 @@ where
10221022 where
10231023 Pin : Channel < ADC , ID = channel:: Id > ,
10241024 {
1025- let channel = Pin :: channel ( ) ;
1025+ let channel = Pin :: channel ( ) as u8 ;
10261026
10271027 let index = channel % 10 ;
10281028 // Set the sample time for the channel
0 commit comments