Skip to content

Commit 683c781

Browse files
authored
Merge pull request #192 from stm32-rs/more_adc_features
WIP: Support for ADC calibration using internal Vref, Temperature support and Vbat support
2 parents 36dde28 + 26db150 commit 683c781

21 files changed

+206
-79
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ edition = "2018"
2323
[dependencies]
2424
cortex-m = "0.6.3"
2525
nb = "0.1.1"
26-
stm32l4 = "0.12.1"
26+
stm32l4 = "0.13.0"
2727
as-slice = "0.1"
2828
generic-array = "0.13"
2929

examples/adc.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ fn main() -> ! {
2222
let clocks = rcc.cfgr.freeze(&mut flash.acr, &mut pwr);
2323

2424
let mut delay = Delay::new(cp.SYST, clocks);
25-
let mut adc = ADC::new(dp.ADC, &mut rcc.ahb2, &mut rcc.ccipr, &mut delay);
25+
let mut adc = ADC::new(
26+
dp.ADC1,
27+
dp.ADC_COMMON,
28+
&mut rcc.ahb2,
29+
&mut rcc.ccipr,
30+
&mut delay,
31+
);
2632

2733
let mut gpioc = dp.GPIOC.split(&mut rcc.ahb2);
2834
let mut a1 = gpioc.pc0.into_analog(&mut gpioc.moder, &mut gpioc.pupdr);

examples/blinky.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ fn main() -> ! {
5353
let mut timer = Delay::new(cp.SYST, clocks);
5454
loop {
5555
// block!(timer.wait()).unwrap();
56-
timer.delay_ms(1000 as u32);
56+
timer.delay_ms(1000_u32);
5757
led.set_high().ok();
5858
// block!(timer.wait()).unwrap();
59-
timer.delay_ms(1000 as u32);
59+
timer.delay_ms(1000_u32);
6060
led.set_low().ok();
6161
}
6262
}

examples/i2c_write.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ fn main() -> ! {
7272
let vlt: u16 = (buffer[0] as u16) << 8 | buffer[1] as u16;
7373
writeln!(hstdout, "Volt: {}", vlt as f32 * 0.000078125).ok();
7474

75-
loop {}
75+
loop {
76+
continue;
77+
}
7678
}
7779

7880
#[exception]

examples/irq_button.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,14 @@ fn main() -> ! {
5757
BUTTON.borrow(cs).replace(Some(board_btn));
5858
});
5959

60-
loop {}
60+
loop {
61+
continue;
62+
}
6163
}
6264

63-
loop {}
65+
loop {
66+
continue;
67+
}
6468
}
6569

6670
#[interrupt]

examples/pll_config.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ fn main() -> ! {
7474
// if all goes well you should reach this breakpoint
7575
asm::bkpt();
7676

77-
loop {}
77+
loop {
78+
continue;
79+
}
7880
}
7981

8082
#[exception]

examples/qspi.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ fn main() -> ! {
7070
// if all goes well you should reach this breakpoint
7171
asm::bkpt();
7272

73-
loop {}
73+
loop {
74+
continue;
75+
}
7476
}
7577

7678
#[exception]

examples/rtc.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ fn main() -> ! {
6767
writeln!(hstdout, "Time: {:?}", rtc_time).unwrap();
6868
writeln!(hstdout, "Date: {:?}", rtc_date).unwrap();
6969
writeln!(hstdout, "Good bye!").unwrap();
70-
loop {}
70+
loop {
71+
continue;
72+
}
7173
}
7274

7375
#[exception]

examples/rtc_alarm.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ fn main() -> ! {
7373
});
7474

7575
loop {
76-
77-
// nb::block!(wkp.wait()).unwrap();
78-
// writeln!(hstdout, "Good bye!").unwrap();
76+
continue;
7977
}
8078
}
8179

examples/serial.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ fn main() -> ! {
7777
// if all goes well you should reach this breakpoint
7878
asm::bkpt();
7979

80-
loop {}
80+
loop {
81+
continue;
82+
}
8183
}
8284

8385
#[exception]

0 commit comments

Comments
 (0)