Run cargo-fmt on the h7 examples.

This commit is contained in:
Bob McWhirter 2021-08-03 14:31:41 -04:00
parent 88c11a653c
commit 3e6aceaaa7
3 changed files with 28 additions and 37 deletions

View File

@ -13,20 +13,18 @@ use embassy_stm32::gpio::NoPin;
use example_common::*;
use cortex_m_rt::entry;
use embassy_stm32::Config;
use embassy_stm32::rcc;
use embassy_stm32::dac::{Channel, Dac, Value};
use embassy_stm32::rcc;
use embassy_stm32::time::U32Ext;
use embassy_stm32::Config;
#[entry]
fn main() -> ! {
info!("Hello World, dude!");
let p = embassy_stm32::init(Config::default().rcc(
rcc::Config::default()
.sys_ck(400.mhz())
.pll1_q(100.mhz())
));
let p = embassy_stm32::init(
Config::default().rcc(rcc::Config::default().sys_ck(400.mhz()).pll1_q(100.mhz())),
);
unsafe {
Dbgmcu::enable_all();
@ -42,8 +40,8 @@ fn main() -> ! {
}
}
use micromath::F32Ext;
use embassy_stm32::dbgmcu::Dbgmcu;
use micromath::F32Ext;
fn to_sine_wave(v: u8) -> u8 {
if v >= 128 {

View File

@ -12,20 +12,20 @@ mod example_common;
use core::fmt::Write;
use embassy::executor::Executor;
use embassy::time::Clock;
use embassy_stm32::Config;
use embassy::util::Forever;
use embassy_stm32::dma::NoDma;
use embassy_stm32::spi;
use embassy_stm32::rcc;
use example_common::*;
use embassy_stm32::spi;
use embassy_stm32::Config;
use embedded_hal::blocking::spi::Transfer;
use example_common::*;
use cortex_m_rt::entry;
use heapless::String;
use embassy_stm32::time::U32Ext;
use embassy_stm32::peripherals::SPI3;
use embassy_stm32::dbgmcu::Dbgmcu;
use core::str::from_utf8;
use cortex_m_rt::entry;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::peripherals::SPI3;
use embassy_stm32::time::U32Ext;
use heapless::String;
#[embassy::task]
async fn main_task(mut spi: spi::Spi<'static, SPI3, NoDma, NoDma>) {
@ -60,11 +60,9 @@ fn main() -> ! {
Dbgmcu::enable_all();
}
let p = embassy_stm32::init(Config::default().rcc(
rcc::Config::default()
.sys_ck(400.mhz())
.pll1_q(100.mhz())
));
let p = embassy_stm32::init(
Config::default().rcc(rcc::Config::default().sys_ck(400.mhz()).pll1_q(100.mhz())),
);
let spi = spi::Spi::new(
p.SPI3,

View File

@ -11,32 +11,30 @@ mod example_common;
use core::fmt::Write;
use embassy::executor::Executor;
use embassy::time::Clock;
use embassy_stm32::time::U32Ext;
use embassy::util::Forever;
use example_common::*;
use embassy_stm32::time::U32Ext;
use embassy_traits::spi::FullDuplex;
use example_common::*;
use core::str::from_utf8;
use cortex_m_rt::entry;
use heapless::String;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::peripherals::{DMA1_CH3, DMA1_CH4, SPI3};
use embassy_stm32::rcc;
use embassy_stm32::spi;
use embassy_stm32::Config;
use core::str::from_utf8;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::rcc;
use embassy_stm32::peripherals::{DMA1_CH4, DMA1_CH3, SPI3};
use heapless::String;
#[embassy::task]
async fn main_task(mut spi: spi::Spi<'static, SPI3, DMA1_CH3, DMA1_CH4>) {
for n in 0u32.. {
let mut write: String<128> = String::new();
let mut read = [0;128];
let mut read = [0; 128];
core::write!(&mut write, "Hello DMA World {}!\r\n", n).unwrap();
// read_write will slice the &mut read down to &write's actual length.
spi.read_write(&mut read, write.as_bytes()).await.ok();
info!("read via spi+dma: {}", from_utf8(&read).unwrap());
}
}
struct ZeroClock;
@ -49,7 +47,6 @@ impl Clock for ZeroClock {
static EXECUTOR: Forever<Executor> = Forever::new();
#[entry]
fn main() -> ! {
info!("Hello World!");
@ -58,11 +55,9 @@ fn main() -> ! {
Dbgmcu::enable_all();
}
let p = embassy_stm32::init(Config::default().rcc(
rcc::Config::default()
.sys_ck(400.mhz())
.pll1_q(100.mhz())
));
let p = embassy_stm32::init(
Config::default().rcc(rcc::Config::default().sys_ck(400.mhz()).pll1_q(100.mhz())),
);
let spi = spi::Spi::new(
p.SPI3,