@@ -42,7 +42,7 @@ const VTEMPCAL30: *const u16 = 0x1FFF_F7B8 as *const u16;
42
42
const VTEMPCAL110 : * const u16 = 0x1FFF_F7C2 as * const u16 ;
43
43
const VDD_CALIB : u16 = 3300 ;
44
44
45
- use core:: ptr;
45
+ use core:: { ptr, default } ;
46
46
47
47
use embedded_hal:: {
48
48
adc:: { Channel , OneShot } ,
@@ -93,9 +93,9 @@ pub enum AdcSampleTime {
93
93
T_239 ,
94
94
}
95
95
96
- impl AdcSampleTime {
96
+ impl default :: Default for AdcSampleTime {
97
97
/// Get the default sample time (currently 239.5 cycles)
98
- pub fn default ( ) -> Self {
98
+ fn default ( ) -> Self {
99
99
AdcSampleTime :: T_239
100
100
}
101
101
}
@@ -138,9 +138,9 @@ pub enum AdcAlign {
138
138
LeftAsRM ,
139
139
}
140
140
141
- impl AdcAlign {
141
+ impl default :: Default for AdcAlign {
142
142
/// Get the default alignment (currently right aligned)
143
- pub fn default ( ) -> Self {
143
+ fn default ( ) -> Self {
144
144
AdcAlign :: Right
145
145
}
146
146
}
@@ -168,9 +168,9 @@ pub enum AdcPrecision {
168
168
B_6 ,
169
169
}
170
170
171
- impl AdcPrecision {
171
+ impl default :: Default for AdcPrecision {
172
172
/// Get the default precision (currently 12 bit precision)
173
- pub fn default ( ) -> Self {
173
+ fn default ( ) -> Self {
174
174
AdcPrecision :: B_12
175
175
}
176
176
}
@@ -247,7 +247,7 @@ adc_pins!(
247
247
impl VTemp {
248
248
/// Init a new VTemp
249
249
pub fn new ( ) -> Self {
250
- VTemp :: default ( )
250
+ Self { }
251
251
}
252
252
253
253
/// Enable the internal temperature sense, this has a wake up time
@@ -316,7 +316,7 @@ impl VTemp {
316
316
impl VRef {
317
317
/// Init a new VRef
318
318
pub fn new ( ) -> Self {
319
- VRef :: default ( )
319
+ Self { }
320
320
}
321
321
322
322
/// Enable the internal voltage reference, remember to disable when not in use.
@@ -408,7 +408,7 @@ adc_pins!(
408
408
impl VBat {
409
409
/// Init a new VBat
410
410
pub fn new ( ) -> Self {
411
- VBat :: default ( )
411
+ Self { }
412
412
}
413
413
414
414
/// Enable the internal VBat sense, remember to disable when not in use
@@ -514,10 +514,10 @@ impl Adc {
514
514
/// Returns the largest possible sample value for the current settings
515
515
pub fn max_sample ( & self ) -> u16 {
516
516
match self . align {
517
- AdcAlign :: Left => u16:: max_value ( ) ,
517
+ AdcAlign :: Left => u16:: MAX ,
518
518
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 ,
521
521
} ,
522
522
AdcAlign :: Right => match self . precision {
523
523
AdcPrecision :: B_12 => ( 1 << 12 ) - 1 ,
0 commit comments