Support unstable-trait feature for stm32
This commit is contained in:
@@ -10,7 +10,6 @@ use embassy::executor::Spawner;
|
||||
use embassy_stm32::spi::{Config, Spi};
|
||||
use embassy_stm32::time::Hertz;
|
||||
use embassy_stm32::Peripherals;
|
||||
use embassy_traits::spi::FullDuplex;
|
||||
use example_common::*;
|
||||
use heapless::String;
|
||||
|
||||
@@ -33,7 +32,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
let mut write: String<128> = String::new();
|
||||
let mut read = [0; 128];
|
||||
core::write!(&mut write, "Hello DMA World {}!\r\n", n).unwrap();
|
||||
spi.read_write(&mut read[0..write.len()], write.as_bytes())
|
||||
spi.transfer(&mut read[0..write.len()], write.as_bytes())
|
||||
.await
|
||||
.ok();
|
||||
info!("read via spi+dma: {}", from_utf8(&read).unwrap());
|
||||
|
@@ -10,7 +10,7 @@ resolver = "2"
|
||||
[dependencies]
|
||||
embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
|
||||
embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
|
||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32h743zi", "net", "time-driver-any", "exti", "unstable-pac"] }
|
||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32h743zi", "net", "time-driver-any", "exti", "unstable-pac", "unstable-traits"] }
|
||||
embassy-net = { path = "../../embassy-net", default-features = false, features = ["defmt", "tcp", "medium-ethernet", "pool-16"] }
|
||||
embassy-hal-common = { path = "../../embassy-hal-common", default-features = false, features = ["defmt"] }
|
||||
|
||||
@@ -20,6 +20,7 @@ defmt-rtt = "0.3"
|
||||
cortex-m = "0.7.3"
|
||||
cortex-m-rt = "0.7.0"
|
||||
embedded-hal = "0.2.6"
|
||||
embedded-hal-async = { version = "0.0.1", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy"}
|
||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||
heapless = { version = "0.7.5", default-features = false }
|
||||
|
@@ -128,7 +128,7 @@ mod ov7725 {
|
||||
use defmt::Format;
|
||||
use embassy::time::{Duration, Timer};
|
||||
use embassy_stm32::rcc::{Mco, McoInstance};
|
||||
use embassy_traits::i2c::I2c;
|
||||
use embedded_hal_async::i2c::I2c;
|
||||
|
||||
#[repr(u8)]
|
||||
pub enum RgbFormat {
|
||||
|
@@ -9,7 +9,6 @@ use core::fmt::Write;
|
||||
use embassy::executor::Executor;
|
||||
use embassy::util::Forever;
|
||||
use embassy_stm32::time::U32Ext;
|
||||
use embassy_traits::spi::FullDuplex;
|
||||
use example_common::*;
|
||||
|
||||
use core::str::from_utf8;
|
||||
@@ -24,8 +23,8 @@ async fn main_task(mut spi: spi::Spi<'static, SPI3, DMA1_CH3, DMA1_CH4>) {
|
||||
let mut write: String<128> = String::new();
|
||||
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();
|
||||
// transfer will slice the &mut read down to &write's actual length.
|
||||
spi.transfer(&mut read, write.as_bytes()).await.ok();
|
||||
info!("read via spi+dma: {}", from_utf8(&read).unwrap());
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ resolver = "2"
|
||||
[dependencies]
|
||||
embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
|
||||
embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
|
||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l072cz", "time-driver-any", "exti", "memory-x"] }
|
||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l072cz", "time-driver-any", "exti", "unstable-traits", "memory-x"] }
|
||||
|
||||
embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["sx127x", "time", "defmt"] }
|
||||
|
||||
|
@@ -10,7 +10,7 @@ resolver = "2"
|
||||
[dependencies]
|
||||
embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt" ] }
|
||||
embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
|
||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "unstable-pac", "stm32l4s5vi", "time-driver-any", "exti"] }
|
||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "unstable-pac", "stm32l4s5vi", "time-driver-any", "exti", "unstable-traits"] }
|
||||
|
||||
defmt = "0.3"
|
||||
defmt-rtt = "0.3"
|
||||
@@ -18,6 +18,7 @@ defmt-rtt = "0.3"
|
||||
cortex-m = "0.7.3"
|
||||
cortex-m-rt = "0.7.0"
|
||||
embedded-hal = "0.2.6"
|
||||
embedded-hal-async = { version = "0.0.1", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy"}
|
||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||
heapless = { version = "0.7.5", default-features = false }
|
||||
|
@@ -11,7 +11,8 @@ use embassy_stm32::i2c::I2c;
|
||||
use embassy_stm32::interrupt;
|
||||
use embassy_stm32::time::Hertz;
|
||||
use embassy_stm32::Peripherals;
|
||||
use embassy_traits::{adapter::BlockingAsync, i2c::I2c as _};
|
||||
use embassy_traits::adapter::BlockingAsync;
|
||||
use embedded_hal_async::i2c::I2c as I2cTrait;
|
||||
use example_common::{info, unwrap};
|
||||
|
||||
const ADDRESS: u8 = 0x5F;
|
||||
|
@@ -11,7 +11,8 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
|
||||
use embassy_stm32::spi::{Config, Spi};
|
||||
use embassy_stm32::time::Hertz;
|
||||
use embassy_stm32::Peripherals;
|
||||
use embassy_traits::{adapter::BlockingAsync, spi::FullDuplex};
|
||||
use embassy_traits::adapter::BlockingAsync;
|
||||
use embedded_hal_async::spi::ReadWrite;
|
||||
use example_common::*;
|
||||
|
||||
#[embassy::main]
|
||||
@@ -47,10 +48,10 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
info!("waiting for ready");
|
||||
}
|
||||
|
||||
let write = [0x0A; 10];
|
||||
let mut read = [0; 10];
|
||||
let write: [u8; 10] = [0x0A; 10];
|
||||
let mut read: [u8; 10] = [0; 10];
|
||||
cs.set_low();
|
||||
spi.read_write(&mut read, &write).await.ok();
|
||||
spi.transfer(&mut read, &write).await.ok();
|
||||
cs.set_high();
|
||||
info!("xfer {=[u8]:x}", read);
|
||||
}
|
||||
|
@@ -10,7 +10,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
|
||||
use embassy_stm32::spi::{Config, Spi};
|
||||
use embassy_stm32::time::Hertz;
|
||||
use embassy_stm32::Peripherals;
|
||||
use embassy_traits::spi::FullDuplex;
|
||||
use example_common::*;
|
||||
|
||||
#[embassy::main]
|
||||
@@ -47,7 +46,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
let write = [0x0A; 10];
|
||||
let mut read = [0; 10];
|
||||
cs.set_low();
|
||||
spi.read_write(&mut read, &write).await.ok();
|
||||
spi.transfer(&mut read, &write).await.ok();
|
||||
cs.set_high();
|
||||
info!("xfer {=[u8]:x}", read);
|
||||
}
|
||||
|
@@ -6,13 +6,11 @@
|
||||
mod example_common;
|
||||
|
||||
use embassy::executor::Spawner;
|
||||
use embassy::traits::{
|
||||
adapter::BlockingAsync,
|
||||
uart::{Read, Write},
|
||||
};
|
||||
use embassy::traits::adapter::BlockingAsync;
|
||||
use embassy_stm32::dma::NoDma;
|
||||
use embassy_stm32::usart::{Config, Uart};
|
||||
use embassy_stm32::Peripherals;
|
||||
use embedded_hal_async::serial::{Read, Write};
|
||||
use example_common::*;
|
||||
|
||||
#[embassy::main]
|
||||
|
Reference in New Issue
Block a user