Skip to content

Commit

Permalink
Fix new unsafe warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
little-arhat committed Jan 24, 2021
1 parent 23f7162 commit a92e1b1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use core::marker::PhantomData;
use core::ptr;
use core::sync::atomic::{self, Ordering};

use crate::pac::{Interrupt, RCC, USART1, USART2, USART3};
use hal::serial::{self, Write};
use nb;
use crate::pac::{Interrupt, RCC, USART1, USART2, USART3};
use void::Void;

use crate::dma::{dma1, CircBuffer, Static, Transfer, R, W};
Expand Down Expand Up @@ -332,8 +332,9 @@ macro_rules! serial {
{
{
let buffer = buffer[0].as_mut();
chan.ch().mar.write(|w|
w.ma().bits(buffer.as_ptr() as usize as u32)
chan.ch().mar.write(|w| unsafe {
w.ma().bits(buffer.as_ptr() as usize as u32)
}
);
chan.ch().ndtr.write(|w|
w.ndt().bits((buffer.len() * 2) as u16)
Expand Down Expand Up @@ -378,9 +379,9 @@ macro_rules! serial {
{
{
let buffer = buffer.as_mut();
chan.ch().mar.write(|w|
chan.ch().mar.write(|w| unsafe {
w.ma().bits(buffer.as_ptr() as usize as u32)
);
});
chan.ch().ndtr.write(|w|
w.ndt().bits(buffer.len() as u16)
);
Expand Down Expand Up @@ -431,9 +432,9 @@ macro_rules! serial {
w.pa().bits(&(*$USARTX::ptr()).tdr as *const _ as usize as u32)
});

chan.ch().mar.write(|w|
chan.ch().mar.write(|w| unsafe {
w.ma().bits(buffer.as_ptr() as usize as u32)
);
});

chan.ch().ndtr.write(|w|
w.ndt().bits(buffer.len() as u16)
Expand Down

0 comments on commit a92e1b1

Please sign in to comment.