Skip to content

Commit c927a05

Browse files
committed
Add ADC support to DMA API
This doesn't do anything in itself, as the ADC API is currently not making use of this.
1 parent 972f53a commit c927a05

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/adc.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,13 @@ where
193193
pub struct Ready;
194194

195195

196+
/// Used for DMA transfers
197+
///
198+
/// This is an internal implementation detail. It is only public because it
199+
/// leaks out of a public API in the form of a `where` clause.
200+
pub struct DmaToken(());
201+
202+
196203
macro_rules! int_adc {
197204
($($Chan:ident: ($chan:expr, $en:ident)),+ $(,)*) => {
198205
$(

src/dma.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use core::{
2727
use as_slice::AsSlice;
2828

2929
use crate::{
30+
adc,
3031
i2c,
3132
pac::{
3233
self,
@@ -471,6 +472,10 @@ macro_rules! impl_target {
471472

472473
// See STM32L0x2 Reference Manual, table 51 (page 267).
473474
impl_target!(
475+
// ADC
476+
adc::DmaToken, Channel1, 0;
477+
adc::DmaToken, Channel2, 0;
478+
474479
// USART1
475480
serial::Tx<USART1>, Channel2, 3;
476481
serial::Tx<USART1>, Channel4, 3;

0 commit comments

Comments
 (0)