Fix stm32 SPI examples

This commit is contained in:
bofh 2023-07-30 18:58:40 +02:00
parent 1d815f4ba0
commit d2127f6b82
9 changed files with 5 additions and 35 deletions

View file

@ -8,7 +8,6 @@ use core::str::from_utf8;
use defmt::*; use defmt::*;
use embassy_executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::spi::{Config, Spi}; use embassy_stm32::spi::{Config, Spi};
use embassy_stm32::time::Hertz;
use heapless::String; use heapless::String;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
@ -24,7 +23,6 @@ async fn main(_spawner: Spawner) {
p.PB4, p.PB4,
p.DMA1_CH3, p.DMA1_CH3,
p.DMA1_CH2, p.DMA1_CH2,
Hertz(1_000_000),
Config::default(), Config::default(),
); );

View file

@ -7,7 +7,6 @@ use defmt::*;
use embassy_stm32::dma::NoDma; use embassy_stm32::dma::NoDma;
use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::spi::{Config, Spi}; use embassy_stm32::spi::{Config, Spi};
use embassy_stm32::time::Hertz;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
#[entry] #[entry]
@ -16,16 +15,7 @@ fn main() -> ! {
let p = embassy_stm32::init(Default::default()); let p = embassy_stm32::init(Default::default());
let mut spi = Spi::new( let mut spi = Spi::new(p.SPI3, p.PC10, p.PC12, p.PC11, NoDma, NoDma, Config::default());
p.SPI3,
p.PC10,
p.PC12,
p.PC11,
NoDma,
NoDma,
Hertz(1_000_000),
Config::default(),
);
let mut cs = Output::new(p.PE0, Level::High, Speed::VeryHigh); let mut cs = Output::new(p.PE0, Level::High, Speed::VeryHigh);

View file

@ -8,7 +8,6 @@ use core::str::from_utf8;
use defmt::*; use defmt::*;
use embassy_executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::spi::{Config, Spi}; use embassy_stm32::spi::{Config, Spi};
use embassy_stm32::time::Hertz;
use heapless::String; use heapless::String;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
@ -24,7 +23,6 @@ async fn main(_spawner: Spawner) {
p.PB4, p.PB4,
p.DMA2_CH3, p.DMA2_CH3,
p.DMA2_CH2, p.DMA2_CH2,
Hertz(1_000_000),
Config::default(), Config::default(),
); );

View file

@ -76,7 +76,9 @@ async fn main(_spawner: Spawner) {
let p = embassy_stm32::init(Default::default()); let p = embassy_stm32::init(Default::default());
info!("Start test using spi as neopixel driver"); info!("Start test using spi as neopixel driver");
let mut spi = Spi::new_txonly_nosck(p.SPI1, p.PB5, p.DMA1_CH3, NoDma, Hertz(4_000_000), Config::default()); let mut config = Config::default();
config.frequency = Hertz(4_000_000);
let mut spi = Spi::new_txonly_nosck(p.SPI1, p.PB5, p.DMA1_CH3, NoDma, config);
let mut neopixels = Ws2812::new(); let mut neopixels = Ws2812::new();

View file

@ -7,7 +7,6 @@ use embassy_executor::Spawner;
use embassy_stm32::dma::NoDma; use embassy_stm32::dma::NoDma;
use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::spi::{Config, Spi}; use embassy_stm32::spi::{Config, Spi};
use embassy_stm32::time::Hertz;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main] #[embassy_executor::main]
@ -22,7 +21,6 @@ async fn main(_spawner: Spawner) {
p.PA6, p.PA6,
NoDma, NoDma,
NoDma, NoDma,
Hertz(1_000_000),
Config::default(), Config::default(),
); );

View file

@ -7,7 +7,6 @@ use embassy_executor::Spawner;
use embassy_stm32::dma::NoDma; use embassy_stm32::dma::NoDma;
use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::spi::{Config, Spi}; use embassy_stm32::spi::{Config, Spi};
use embassy_stm32::time::Hertz;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main] #[embassy_executor::main]
@ -22,7 +21,6 @@ async fn main(_spawner: Spawner) {
p.PA6, p.PA6,
NoDma, NoDma,
NoDma, NoDma,
Hertz(1_000_000),
Config::default(), Config::default(),
); );

View file

@ -6,7 +6,6 @@ use defmt::*;
use embassy_stm32::dma::NoDma; use embassy_stm32::dma::NoDma;
use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::spi::{Config, Spi}; use embassy_stm32::spi::{Config, Spi};
use embassy_stm32::time::Hertz;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
#[cortex_m_rt::entry] #[cortex_m_rt::entry]
@ -15,16 +14,7 @@ fn main() -> ! {
let p = embassy_stm32::init(Default::default()); let p = embassy_stm32::init(Default::default());
let mut spi = Spi::new( let mut spi = Spi::new(p.SPI3, p.PC10, p.PC12, p.PC11, NoDma, NoDma, Config::default());
p.SPI3,
p.PC10,
p.PC12,
p.PC11,
NoDma,
NoDma,
Hertz(1_000_000),
Config::default(),
);
let mut cs = Output::new(p.PE0, Level::High, Speed::VeryHigh); let mut cs = Output::new(p.PE0, Level::High, Speed::VeryHigh);

View file

@ -8,7 +8,6 @@ use embassy_executor::Spawner;
use embassy_stm32::dma::NoDma; use embassy_stm32::dma::NoDma;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
use embassy_stm32::spi::{Config, Spi}; use embassy_stm32::spi::{Config, Spi};
use embassy_stm32::time::Hertz;
use embedded_hal_async::spi::SpiBus; use embedded_hal_async::spi::SpiBus;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
@ -24,7 +23,6 @@ async fn main(_spawner: Spawner) {
p.PC11, p.PC11,
NoDma, NoDma,
NoDma, NoDma,
Hertz(1_000_000),
Config::default(), Config::default(),
); );

View file

@ -6,7 +6,6 @@ use defmt::*;
use embassy_executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
use embassy_stm32::spi::{Config, Spi}; use embassy_stm32::spi::{Config, Spi};
use embassy_stm32::time::Hertz;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main] #[embassy_executor::main]
@ -21,7 +20,6 @@ async fn main(_spawner: Spawner) {
p.PC11, p.PC11,
p.DMA1_CH1, p.DMA1_CH1,
p.DMA1_CH2, p.DMA1_CH2,
Hertz(1_000_000),
Config::default(), Config::default(),
); );