HAL-Bus SPI Exclusive Device Unsatisfied Traits
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- rust
- Ambito
- embedded-iot
Direzione di ricerca
Reproduce the failure from examples/tiva-c-connected-launchpad/examples/spi_hello.rs, then inspect embedded-hal-bus-0.1.0/src/spi/exclusive.rs and the tm4c129x_hal SPI implementation. Trace the required blocking SPI Write and Default trait bounds and compare them with the HAL's implemented traits. Done means identifying which component causes the mismatch and documenting or correcting the compatible trait usage.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Good morning,
I am trying to understand if the unsatisfied traits error I am receiving in my implementation is due to an error in my implementation, the platform HAL package, or the underlying embedded HAL code.
I am trying to use the embedded_hal_bus ExclusiveDevice struct to wrap an SPI bus into an SPI device.
The SPI bus I have initialised using the platform HAL package (tm4c129x_hal):
let mut spi0 = hal::spi::Spi::spi0(
p.SSI0,
(
porta
.pa2
.into_af_push_pull::<hal::gpio::AF15>(&mut porta.control),
porta
.pa5
.into_af_push_pull::<hal::gpio::AF15>(&mut porta.control),
porta
.pa4
.into_af_push_pull::<hal::gpio::AF15>(&mut porta.control),
),
hal::spi::MODE_0,
1_u32.mhz(),
&clocks,
&sc.power_control,
);
I'm then wrapping that up in the ExclusiveDevice object (cs0 is just a normal GPIO pin in output mode).
let mut spi0_dev0 = ExclusiveDevice::new_no_delay(
&spi0, cs0
);
However, this won't compile when I try to use the write() method of the ExlusiveDevice object. (message is a Vec of bytes).
error[E0599]: the method `write` exists for struct `ExclusiveDevice<&Spi<SSI0, (PA2<AlternateFunction<AF15, ...>>, ..., ...)>, ..., ...>`, but its trait bounds were not satisfied
--> examples/tiva-c-connected-launchpad/examples/spi_hello.rs:67:27
|
67 | let _ = spi0_dev0.write(message);
| ^^^^^ method cannot be called due to unsatisfied trait bounds
|
::: /home/***/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-hal-bus-0.1.0/src/spi/exclusive.rs:19:1
|
19 | pub struct ExclusiveDevice<BUS, CS, D> {
| --------------------------------------
| |
| doesn't satisfy `_: Default<_>`
| doesn't satisfy `_: _embedded_hal_blocking_spi_Write<_>`
|
= note: the full type name has been written to '.../target/thumbv7em-none-eabihf/debug/examples/spi_hello-b9cc2dd24018ba0e.long-type-5094367532974101285.txt'
= note: the following trait bounds were not satisfied:
`ExclusiveDevice<&tm4c129x_hal::spi::Spi<tm4c129x_hal::tm4c129x::SSI0, (PA2<AlternateFunction<AF15, PushPull>>, PA5<AlternateFunction<AF15, PushPull>>, PA4<AlternateFunction<AF15, PushPull>>)>, PA6<Output<PushPull>>, NoDelay>: embedded_hal::blocking::spi::write::Default<_>`
which is required by `ExclusiveDevice<&tm4c129x_hal::spi::Spi<tm4c129x_hal::tm4c129x::SSI0, (PA2<AlternateFunction<AF15, PushPull>>, PA5<AlternateFunction<AF15, PushPull>>, PA4<AlternateFunction<AF15, PushPull>>)>, PA6<Output<PushPull>>, NoDelay>: tm4c129x_hal::prelude::_embedded_hal_blocking_spi_Write<_>`
What I can't work out is what needs to be changed so that the trait bounds are satisfied. Can anyone shed some light?
- Lingua principale
- Rust
- Stelle
- 2.7k
- Fork
- 283
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rust-embedded/embedded-hal
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
rust-embedded/embedded-hal#750 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
rust-embedded/embedded-hal#742 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
rust-embedded/embedded-hal#747 · 5 commenti · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
rust-embedded/embedded-hal#746 · 2 commenti · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
rust-embedded/embedded-hal#745 · 1 reazione ·
Tutte le issue di rust-embedded/embedded-hal
Issue simili
-
Perl - Readme DriftForse già presa @Omnideth l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
CommunityToolkit/Aspire#2375 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno