Skip to content

Commit

Permalink
spi-dma: fix warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Baptiste Theou <[email protected]>
  • Loading branch information
jbtheou committed Jan 22, 2024
1 parent fd7f03a commit ac03630
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions examples/spi-dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#![no_std]

use crate::hal::{
block,
delay::DelayFromCountDownTimer,
gpio::gpioa::PA5,
gpio::gpioa::PA6,
Expand All @@ -22,7 +21,6 @@ use crate::hal::{
};

use cortex_m_rt::entry;
use log::info;
use stm32g4xx_hal as hal;
use stm32g4xx_hal::dma::config::DmaConfig;
use stm32g4xx_hal::dma::stream::DMAExt;
Expand All @@ -49,18 +47,19 @@ fn main() -> ! {
let miso: PA6<Alternate<AF5>> = gpioa.pa6.into_alternate();
let mosi: PA7<Alternate<AF5>> = gpioa.pa7.into_alternate();

let mut spi = dp
let spi = dp
.SPI1
.spi((sclk, miso, mosi), spi::MODE_0, 400.kHz(), &mut rcc);
let mut streams = dp.DMA1.split(&rcc);
let streams = dp.DMA1.split(&rcc);
let config = DmaConfig::default()
.transfer_complete_interrupt(false)
.circular_buffer(true)
.memory_increment(true);

let mut buf: [u8; BUFFER_SIZE] = [0; BUFFER_SIZE];
for index in 0..BUFFER_SIZE {
buf[index] = index as u8;
/* Set a some datas */
for (index, item) in buf.iter_mut().enumerate().take(BUFFER_SIZE) {
*item = index as u8;
}
let dma_buf = cortex_m::singleton!(: [u8; BUFFER_SIZE] = buf).unwrap();
let mut transfer_dma =
Expand Down

0 comments on commit ac03630

Please sign in to comment.