Skip to content

Commit 7454fca

Browse files
committed
Fix compilation errors find using CI.
1 parent edef982 commit 7454fca

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

src/dma.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ pub enum Half {
2727
}
2828

2929
pub struct CircBuffer<BUFFER, PAYLOAD>
30-
where
31-
BUFFER: 'static,
30+
where
31+
BUFFER: 'static,
3232
{
3333
buffer: &'static mut [BUFFER; 2],
3434
payload: PAYLOAD,
3535
readable_half: Half,
3636
}
3737

3838
impl<BUFFER, PAYLOAD> CircBuffer<BUFFER, PAYLOAD>
39-
where
40-
&'static mut [BUFFER; 2]: StaticWriteBuffer,
41-
BUFFER: 'static,
39+
where
40+
&'static mut [BUFFER; 2]: StaticWriteBuffer,
41+
BUFFER: 'static,
4242
{
4343
pub(crate) fn new(buf: &'static mut [BUFFER; 2], payload: PAYLOAD) -> Self {
4444
CircBuffer {
@@ -61,17 +61,17 @@ pub trait TransferPayload {
6161
}
6262

6363
pub struct Transfer<MODE, BUFFER, PAYLOAD>
64-
where
65-
PAYLOAD: TransferPayload,
64+
where
65+
PAYLOAD: TransferPayload,
6666
{
6767
_mode: PhantomData<MODE>,
6868
buffer: BUFFER,
6969
payload: PAYLOAD,
7070
}
7171

7272
impl<BUFFER, PAYLOAD> Transfer<R, BUFFER, PAYLOAD>
73-
where
74-
PAYLOAD: TransferPayload,
73+
where
74+
PAYLOAD: TransferPayload,
7575
{
7676
pub(crate) fn r(buffer: BUFFER, payload: PAYLOAD) -> Self {
7777
Transfer {
@@ -83,8 +83,8 @@ impl<BUFFER, PAYLOAD> Transfer<R, BUFFER, PAYLOAD>
8383
}
8484

8585
impl<BUFFER, PAYLOAD> Transfer<W, BUFFER, PAYLOAD>
86-
where
87-
PAYLOAD: TransferPayload,
86+
where
87+
PAYLOAD: TransferPayload,
8888
{
8989
pub(crate) fn w(buffer: BUFFER, payload: PAYLOAD) -> Self {
9090
Transfer {
@@ -96,8 +96,8 @@ impl<BUFFER, PAYLOAD> Transfer<W, BUFFER, PAYLOAD>
9696
}
9797

9898
impl<MODE, BUFFER, PAYLOAD> Drop for Transfer<MODE, BUFFER, PAYLOAD>
99-
where
100-
PAYLOAD: TransferPayload,
99+
where
100+
PAYLOAD: TransferPayload,
101101
{
102102
fn drop(&mut self) {
103103
self.payload.stop();
@@ -126,8 +126,8 @@ macro_rules! dma {
126126
pub mod $dmaX {
127127
use core::{sync::atomic::{self, Ordering}, ptr, mem};
128128

129-
use stm32f0xx_hal::pac::{$DMAX, dma1};
130-
use stm32f0xx_hal::rcc::Rcc;
129+
use crate::pac::{$DMAX, dma1};
130+
use crate::rcc::Rcc;
131131

132132
use crate::dma::{CircBuffer, DmaExt, Error, Event, Half, Transfer, W, RxDma, TxDma, TransferPayload};
133133

@@ -145,15 +145,15 @@ macro_rules! dma {
145145
///
146146
/// `inc` indicates whether the address will be incremented after every byte transfer
147147
pub fn set_peripheral_address(&mut self, address: u32, inc: bool) {
148-
self.ch().par.write(|w| w.pa().bits(address) );
148+
self.ch().par.write(|w| unsafe { w.pa().bits(address) } );
149149
self.ch().cr.modify(|_, w| w.pinc().bit(inc) );
150150
}
151151

152152
/// `address` where from/to data will be read/write
153153
///
154154
/// `inc` indicates whether the address will be incremented after every byte transfer
155155
pub fn set_memory_address(&mut self, address: u32, inc: bool) {
156-
self.ch().mar.write(|w| w.ma().bits(address) );
156+
self.ch().mar.write(|w| unsafe { w.ma().bits(address) } );
157157
self.ch().cr.modify(|_, w| w.minc().bit(inc) );
158158
}
159159

@@ -393,7 +393,7 @@ macro_rules! dma {
393393
type Channels = Channels;
394394

395395
fn split(self, rcc: &mut Rcc) -> Channels {
396-
rcc.ahbenr.modify(|_, w| w.$dmaen().set_bit());
396+
rcc.regs.ahbenr.modify(|_, w| w.$dmaen().set_bit());
397397

398398
// reset the DMA control registers (stops all on-going transfers)
399399
$(
@@ -409,7 +409,7 @@ macro_rules! dma {
409409
}
410410

411411
dma! {
412-
DMA1: (dma1, dmaen, {
412+
DMA1: (dma1, dma1en, {
413413
C1: (
414414
ch1,
415415
htif1, tcif1,
@@ -479,28 +479,28 @@ pub trait Transmit {
479479

480480
/// Trait for circular DMA readings from peripheral to memory.
481481
pub trait CircReadDma<B, RS>: Receive
482-
where
483-
&'static mut [B; 2]: StaticWriteBuffer<Word = RS>,
484-
B: 'static,
485-
Self: core::marker::Sized,
482+
where
483+
&'static mut [B; 2]: StaticWriteBuffer<Word = RS>,
484+
B: 'static,
485+
Self: core::marker::Sized,
486486
{
487487
fn circ_read(self, buffer: &'static mut [B; 2]) -> CircBuffer<B, Self>;
488488
}
489489

490490
/// Trait for DMA readings from peripheral to memory.
491491
pub trait ReadDma<B, RS>: Receive
492-
where
493-
B: StaticWriteBuffer<Word = RS>,
494-
Self: core::marker::Sized + TransferPayload,
492+
where
493+
B: StaticWriteBuffer<Word = RS>,
494+
Self: core::marker::Sized + TransferPayload,
495495
{
496496
fn read(self, buffer: B) -> Transfer<W, B, Self>;
497497
}
498498

499499
/// Trait for DMA writing from memory to peripheral.
500500
pub trait WriteDma<B, TS>: Transmit
501-
where
502-
B: StaticReadBuffer<Word = TS>,
503-
Self: core::marker::Sized + TransferPayload,
501+
where
502+
B: StaticReadBuffer<Word = TS>,
503+
Self: core::marker::Sized + TransferPayload,
504504
{
505505
fn write(self, buffer: B) -> Transfer<R, B, Self>;
506506
}

0 commit comments

Comments
 (0)