Skip to content

Commit 474ed2d

Browse files
committed
Bump Wio Terminal version to 7.4
1 parent 61b6fdb commit 474ed2d

File tree

2 files changed

+42
-31
lines changed

2 files changed

+42
-31
lines changed

boards/wio_terminal/src/sensors.rs

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use atsamd_hal::adc::Adc;
1+
use atsamd_hal::adc::AdcBuilder;
2+
use atsamd_hal::adc::{Accumulation, Adc, Prescaler, Resolution};
23
use atsamd_hal::clock::GenericClockController;
34
use atsamd_hal::pac::gclk::pchctrl::Genselect::Gclk11;
45
use atsamd_hal::pac::{Adc1, Mclk};
@@ -56,18 +57,28 @@ pub struct LightSensor {
5657
pub pd1: LightSensorAdcReset,
5758
}
5859

59-
// impl LightSensor {
60-
// /// Initialize Pd1 as an ADC input, and return a Tuple containing the ADC
61-
// /// peripheral and the configured pin.
62-
// pub fn init(
63-
// self,
64-
// adc: Adc1,
65-
// clocks: &mut GenericClockController,
66-
// mclk: &mut Mclk,
67-
// ) -> (Adc<Adc1>, LightSensorAdc) {
68-
// todo!()
69-
// // let adc1 = Adc::adc1(adc, mclk, clocks, Gclk11);
70-
//
71-
// // (adc1, self.pd1.into())
72-
// }
73-
// }
60+
impl LightSensor {
61+
/// Initialize Pd1 as an ADC input, and return a Tuple containing the ADC
62+
/// peripheral and the configured pin.
63+
pub fn init(
64+
self,
65+
adc: Adc1,
66+
clocks: &mut GenericClockController,
67+
mclk: &mut Mclk,
68+
) -> (Adc<atsamd_hal::adc::Adc1>, LightSensorAdc) {
69+
70+
todo!()
71+
// let adc1 = Adc::adc1(adc, mclk, clocks, Gclk11);
72+
73+
// let mut adc = AdcBuilder::new(Accumulation::single(atsamd_hal::adc::AdcResolution::_12))
74+
// .with_clock_cycles_per_sample(5)
75+
// // Overruns if clock divider < 32 in debug mode
76+
// .with_clock_divider(Prescaler::Div32)
77+
// .with_vref(atsamd_hal::adc::Reference::Arefa)
78+
// .enable(adc, apb_adc0, &pclk_adc0)
79+
// .unwrap();
80+
// let mut adc_pin = pins.a0.into_alternate();
81+
82+
// (adc1, self.pd1.into())
83+
}
84+
}

boards/wio_terminal/src/sound.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ pub struct Microphone {
4343
pub mic: MicOutputReset,
4444
}
4545

46-
// impl Microphone {
47-
// /// Initialize Pd1 as an ADC input, and return a Tuple containing the ADC
48-
// /// peripheral and the configured pin.
49-
// pub fn init(
50-
// self,
51-
// adc: Adc1,
52-
// clocks: &mut GenericClockController,
53-
// mclk: &mut Mclk,
54-
// ) -> (Adc<Adc1>, MicOutput) {
55-
// todo!()
56-
// // let adc1 = Adc::adc1(adc, mclk, clocks, Gclk11);
57-
//
58-
// // (adc1, self.mic.into())
59-
// }
60-
// }
46+
impl Microphone {
47+
/// Initialize Pd1 as an ADC input, and return a Tuple containing the ADC
48+
/// peripheral and the configured pin.
49+
pub fn init(
50+
self,
51+
adc: Adc1,
52+
clocks: &mut GenericClockController,
53+
mclk: &mut Mclk,
54+
) -> (Adc<atsamd_hal::adc::Adc1>, MicOutput) {
55+
todo!()
56+
57+
// let adc1 = Adc::adc1(adc, mclk, clocks, Gclk11);
58+
// (adc1, self.mic.into())
59+
}
60+
}

0 commit comments

Comments
 (0)