@@ -42,7 +42,7 @@ const VTEMPCAL30: *const u16 = 0x1FFF_F7B8 as *const u16;
4242const VTEMPCAL110 : * const u16 = 0x1FFF_F7C2 as * const u16 ;
4343const VDD_CALIB : u16 = 3300 ;
4444
45- use core:: ptr;
45+ use core:: { ptr, default } ;
4646
4747use embedded_hal:: {
4848 adc:: { Channel , OneShot } ,
@@ -93,9 +93,9 @@ pub enum AdcSampleTime {
9393 T_239 ,
9494}
9595
96- impl AdcSampleTime {
96+ impl default :: Default for AdcSampleTime {
9797 /// Get the default sample time (currently 239.5 cycles)
98- pub fn default ( ) -> Self {
98+ fn default ( ) -> Self {
9999 AdcSampleTime :: T_239
100100 }
101101}
@@ -138,9 +138,9 @@ pub enum AdcAlign {
138138 LeftAsRM ,
139139}
140140
141- impl AdcAlign {
141+ impl default :: Default for AdcAlign {
142142 /// Get the default alignment (currently right aligned)
143- pub fn default ( ) -> Self {
143+ fn default ( ) -> Self {
144144 AdcAlign :: Right
145145 }
146146}
@@ -168,9 +168,9 @@ pub enum AdcPrecision {
168168 B_6 ,
169169}
170170
171- impl AdcPrecision {
171+ impl default :: Default for AdcPrecision {
172172 /// Get the default precision (currently 12 bit precision)
173- pub fn default ( ) -> Self {
173+ fn default ( ) -> Self {
174174 AdcPrecision :: B_12
175175 }
176176}
@@ -247,7 +247,7 @@ adc_pins!(
247247impl VTemp {
248248 /// Init a new VTemp
249249 pub fn new ( ) -> Self {
250- VTemp :: default ( )
250+ Self { }
251251 }
252252
253253 /// Enable the internal temperature sense, this has a wake up time
@@ -316,7 +316,7 @@ impl VTemp {
316316impl VRef {
317317 /// Init a new VRef
318318 pub fn new ( ) -> Self {
319- VRef :: default ( )
319+ Self { }
320320 }
321321
322322 /// Enable the internal voltage reference, remember to disable when not in use.
@@ -408,7 +408,7 @@ adc_pins!(
408408impl VBat {
409409 /// Init a new VBat
410410 pub fn new ( ) -> Self {
411- VBat :: default ( )
411+ Self { }
412412 }
413413
414414 /// Enable the internal VBat sense, remember to disable when not in use
@@ -514,10 +514,10 @@ impl Adc {
514514 /// Returns the largest possible sample value for the current settings
515515 pub fn max_sample ( & self ) -> u16 {
516516 match self . align {
517- AdcAlign :: Left => u16:: max_value ( ) ,
517+ AdcAlign :: Left => u16:: MAX ,
518518 AdcAlign :: LeftAsRM => match self . precision {
519- AdcPrecision :: B_6 => u16:: from ( u8:: max_value ( ) ) ,
520- _ => u16:: max_value ( ) ,
519+ AdcPrecision :: B_6 => u16:: from ( u8:: MAX ) ,
520+ _ => u16:: MAX ,
521521 } ,
522522 AdcAlign :: Right => match self . precision {
523523 AdcPrecision :: B_12 => ( 1 << 12 ) - 1 ,
0 commit comments