Hello there, when trying to use a shared SPI bus, which is async, the SdCard cannot be instantiated, since the trait is not implemented. Is there a specific technical reason for this, or was this just not yet implemented?
As you may gather, I am trying to complement this with the oled_async crate, since i need a driver for SH1107
the trait `embedded_hal::spi::SpiDevice` is not implemented for `embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice<'_, NoopRawMutex, embassy_rp::spi::Spi<'static, SPI0, embassy_rp::spi::Async>, Output<'_>>`
main.rs (other initializations for i2c and oled left out):
type Spi0Bus = Mutex<NoopRawMutex, Spi<'static, SPI0, spi::Async>>;
#[embassy_executor::main]
async fn main(spawner: Spawner) {
info!("Starting main!");
embassy_rp::pac::SIO.spinlock(31).write_value(1);
let p = embassy_rp::init(Default::default());
// SPI clock needs to be running at <= 400kHz during initialization
let mut spi_config = spi::Config::default();
spi_config.frequency = 400_000;
let spi = Spi::new(
p.SPI0, p.PIN_2, p.PIN_3, p.PIN_4, p.DMA_CH0, p.DMA_CH1, spi_config,
);
static SPI_BUS: StaticCell<Spi0Bus> = StaticCell::new();
let spi_bus = SPI_BUS.init(Mutex::new(spi));
let cs = Output::new(p.PIN_5, Level::High);
let spi_dev = SpiDevice::new(&spi_bus, cs);
let sdcard = SdCard::new(spi_dev, embassy_time::Delay);
}
Cargo.toml:
[dependencies]
embassy-embedded-hal = { version = "0.2.0", features = ["defmt"] }
embassy-sync = { version = "0.6.0", features = ["defmt"] }
embassy-executor = { version = "0.6.0", features = [
"arch-cortex-m",
"executor-thread",
"executor-interrupt",
"defmt",
"integrated-timers",
] }
embassy-time = { version = "0.3.2", features = [
"defmt",
"defmt-timestamp-uptime",
] }
embassy-rp = { version = "0.2.0", features = [
"defmt",
"unstable-pac",
"time-driver",
"critical-section-impl",
] }
embassy-futures = { version = "0.1.1" }
embassy-usb = { version = "0.3.0", features = ["defmt"] }
# WARN(aver): this causes issues with dependency: byteorder and since use defmt for logging, we are
# not going to use this for now. Also some issues with `embassy-usb`
# embassy-usb-logger = { version = "0.2.0", git = "https://github.com/embassy-rs/embassy.git" }
embassy-net = { version = "0.4.0", features = [
"defmt",
"tcp",
"udp",
"dhcpv4",
"medium-ethernet",
] }
cyw43-pio = { version = "0.2.0", features = ["defmt", "overclock"] }
cyw43 = { version = "0.2.0", features = ["defmt", "firmware-logs"] }
defmt = "0.3"
defmt-rtt = "0.4"
fixed = "1.28.0"
fixed-macro = "1.2"
cortex-m = { version = "0.7.7", features = ["inline-asm"] }
cortex-m-rt = "0.7.3"
panic-probe = { version = "0.3", features = ["print-defmt"] }
futures = { version = "0.3.30", default-features = false, features = [
"async-await",
"cfg-target-has-atomic",
"unstable",
] }
heapless = "0.8"
embedded-hal = { version = "1.0.0" }
embedded-hal-async = "1.0.0"
embedded-hal-bus = { version = "0.1.0", features = ["async"] }
embedded-io-async = { version = "0.6.1", features = ["defmt-03"] }
static_cell = "2"
portable-atomic = { version = "1.9", features = ["critical-section"] }
log = "0.4"
pio-proc = "0.2"
pio = "0.2.1"
rand = { version = "0.8.5", default-features = false }
embedded-sdmmc = "0.8.0"
fugit = { version = "0.3.7", features = ["defmt"] }
adxl345-eh-driver = "0.2.2"
oled_async = { version = "0.1.0-alpha1", features = ["spi"], git = "https://github.com/cschuhen/oled_drivers" }
embedded-graphics = { version = "0.8.1", features = ["defmt"] }
display-interface-spi = "0.5.0"
Hello there, when trying to use a shared SPI bus, which is async, the
SdCard
cannot be instantiated, since the trait is not implemented. Is there a specific technical reason for this, or was this just not yet implemented? As you may gather, I am trying to complement this with the oled_async crate, since i need a driver for SH1107main.rs (other initializations for i2c and oled left out):
Cargo.toml: