We can kick start the internal timer outside of the main loop
This commit is contained in:
parent
16b6c78332
commit
34e9e85819
1 changed files with 10 additions and 11 deletions
|
@ -270,13 +270,16 @@ impl<'d, const N: usize> Saadc<'d, N> {
|
||||||
|
|
||||||
// Establish mode and sample rate
|
// Establish mode and sample rate
|
||||||
match mode {
|
match mode {
|
||||||
Mode::Timers(sample_rate) => r.samplerate.write(|w| {
|
Mode::Timers(sample_rate) => {
|
||||||
unsafe {
|
r.samplerate.write(|w| {
|
||||||
w.cc().bits(sample_rate);
|
unsafe {
|
||||||
w.mode().timers();
|
w.cc().bits(sample_rate);
|
||||||
}
|
w.mode().timers();
|
||||||
w
|
}
|
||||||
}),
|
w
|
||||||
|
});
|
||||||
|
r.tasks_sample.write(|w| unsafe { w.bits(1) }); // Need to kick-start the internal timer
|
||||||
|
}
|
||||||
Mode::Task => r.samplerate.write(|w| {
|
Mode::Task => r.samplerate.write(|w| {
|
||||||
unsafe {
|
unsafe {
|
||||||
w.cc().bits(0);
|
w.cc().bits(0);
|
||||||
|
@ -334,10 +337,6 @@ impl<'d, const N: usize> Saadc<'d, N> {
|
||||||
r.events_started.reset();
|
r.events_started.reset();
|
||||||
r.intenset.write(|w| w.started().set());
|
r.intenset.write(|w| w.started().set());
|
||||||
|
|
||||||
if let Mode::Timers(_) = mode {
|
|
||||||
r.tasks_sample.write(|w| unsafe { w.bits(1) });
|
|
||||||
}
|
|
||||||
|
|
||||||
let next_buffer = 1 - current_buffer;
|
let next_buffer = 1 - current_buffer;
|
||||||
r.result
|
r.result
|
||||||
.ptr
|
.ptr
|
||||||
|
|
Loading…
Reference in a new issue