mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
Run cargo-fmt on the h7 examples.
This commit is contained in:
parent
88c11a653c
commit
3e6aceaaa7
@ -13,20 +13,18 @@ use embassy_stm32::gpio::NoPin;
|
|||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use embassy_stm32::Config;
|
|
||||||
use embassy_stm32::rcc;
|
|
||||||
use embassy_stm32::dac::{Channel, Dac, Value};
|
use embassy_stm32::dac::{Channel, Dac, Value};
|
||||||
|
use embassy_stm32::rcc;
|
||||||
use embassy_stm32::time::U32Ext;
|
use embassy_stm32::time::U32Ext;
|
||||||
|
use embassy_stm32::Config;
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
info!("Hello World, dude!");
|
info!("Hello World, dude!");
|
||||||
|
|
||||||
let p = embassy_stm32::init(Config::default().rcc(
|
let p = embassy_stm32::init(
|
||||||
rcc::Config::default()
|
Config::default().rcc(rcc::Config::default().sys_ck(400.mhz()).pll1_q(100.mhz())),
|
||||||
.sys_ck(400.mhz())
|
);
|
||||||
.pll1_q(100.mhz())
|
|
||||||
));
|
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
Dbgmcu::enable_all();
|
Dbgmcu::enable_all();
|
||||||
@ -42,8 +40,8 @@ fn main() -> ! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use micromath::F32Ext;
|
|
||||||
use embassy_stm32::dbgmcu::Dbgmcu;
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
|
use micromath::F32Ext;
|
||||||
|
|
||||||
fn to_sine_wave(v: u8) -> u8 {
|
fn to_sine_wave(v: u8) -> u8 {
|
||||||
if v >= 128 {
|
if v >= 128 {
|
||||||
|
@ -12,20 +12,20 @@ mod example_common;
|
|||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
use embassy::executor::Executor;
|
use embassy::executor::Executor;
|
||||||
use embassy::time::Clock;
|
use embassy::time::Clock;
|
||||||
use embassy_stm32::Config;
|
|
||||||
use embassy::util::Forever;
|
use embassy::util::Forever;
|
||||||
use embassy_stm32::dma::NoDma;
|
use embassy_stm32::dma::NoDma;
|
||||||
use embassy_stm32::spi;
|
|
||||||
use embassy_stm32::rcc;
|
use embassy_stm32::rcc;
|
||||||
use example_common::*;
|
use embassy_stm32::spi;
|
||||||
|
use embassy_stm32::Config;
|
||||||
use embedded_hal::blocking::spi::Transfer;
|
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 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]
|
#[embassy::task]
|
||||||
async fn main_task(mut spi: spi::Spi<'static, SPI3, NoDma, NoDma>) {
|
async fn main_task(mut spi: spi::Spi<'static, SPI3, NoDma, NoDma>) {
|
||||||
@ -60,11 +60,9 @@ fn main() -> ! {
|
|||||||
Dbgmcu::enable_all();
|
Dbgmcu::enable_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
let p = embassy_stm32::init(Config::default().rcc(
|
let p = embassy_stm32::init(
|
||||||
rcc::Config::default()
|
Config::default().rcc(rcc::Config::default().sys_ck(400.mhz()).pll1_q(100.mhz())),
|
||||||
.sys_ck(400.mhz())
|
);
|
||||||
.pll1_q(100.mhz())
|
|
||||||
));
|
|
||||||
|
|
||||||
let spi = spi::Spi::new(
|
let spi = spi::Spi::new(
|
||||||
p.SPI3,
|
p.SPI3,
|
||||||
|
@ -11,32 +11,30 @@ mod example_common;
|
|||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
use embassy::executor::Executor;
|
use embassy::executor::Executor;
|
||||||
use embassy::time::Clock;
|
use embassy::time::Clock;
|
||||||
use embassy_stm32::time::U32Ext;
|
|
||||||
use embassy::util::Forever;
|
use embassy::util::Forever;
|
||||||
use example_common::*;
|
use embassy_stm32::time::U32Ext;
|
||||||
use embassy_traits::spi::FullDuplex;
|
use embassy_traits::spi::FullDuplex;
|
||||||
|
use example_common::*;
|
||||||
|
|
||||||
|
use core::str::from_utf8;
|
||||||
use cortex_m_rt::entry;
|
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::spi;
|
||||||
use embassy_stm32::Config;
|
use embassy_stm32::Config;
|
||||||
use core::str::from_utf8;
|
use heapless::String;
|
||||||
use embassy_stm32::dbgmcu::Dbgmcu;
|
|
||||||
use embassy_stm32::rcc;
|
|
||||||
use embassy_stm32::peripherals::{DMA1_CH4, DMA1_CH3, SPI3};
|
|
||||||
|
|
||||||
#[embassy::task]
|
#[embassy::task]
|
||||||
async fn main_task(mut spi: spi::Spi<'static, SPI3, DMA1_CH3, DMA1_CH4>) {
|
async fn main_task(mut spi: spi::Spi<'static, SPI3, DMA1_CH3, DMA1_CH4>) {
|
||||||
|
|
||||||
for n in 0u32.. {
|
for n in 0u32.. {
|
||||||
let mut write: String<128> = String::new();
|
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();
|
core::write!(&mut write, "Hello DMA World {}!\r\n", n).unwrap();
|
||||||
// read_write will slice the &mut read down to &write's actual length.
|
// read_write will slice the &mut read down to &write's actual length.
|
||||||
spi.read_write(&mut read, write.as_bytes()).await.ok();
|
spi.read_write(&mut read, write.as_bytes()).await.ok();
|
||||||
info!("read via spi+dma: {}", from_utf8(&read).unwrap());
|
info!("read via spi+dma: {}", from_utf8(&read).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ZeroClock;
|
struct ZeroClock;
|
||||||
@ -49,7 +47,6 @@ impl Clock for ZeroClock {
|
|||||||
|
|
||||||
static EXECUTOR: Forever<Executor> = Forever::new();
|
static EXECUTOR: Forever<Executor> = Forever::new();
|
||||||
|
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
@ -58,11 +55,9 @@ fn main() -> ! {
|
|||||||
Dbgmcu::enable_all();
|
Dbgmcu::enable_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
let p = embassy_stm32::init(Config::default().rcc(
|
let p = embassy_stm32::init(
|
||||||
rcc::Config::default()
|
Config::default().rcc(rcc::Config::default().sys_ck(400.mhz()).pll1_q(100.mhz())),
|
||||||
.sys_ck(400.mhz())
|
);
|
||||||
.pll1_q(100.mhz())
|
|
||||||
));
|
|
||||||
|
|
||||||
let spi = spi::Spi::new(
|
let spi = spi::Spi::new(
|
||||||
p.SPI3,
|
p.SPI3,
|
||||||
|
Loading…
Reference in New Issue
Block a user