SPI struct implements both SpiBus and SpiDevice
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- linux, rust
- Ambito
- embedded-iot, operating-systems
Direzione di ricerca
Inizia esaminando il wrapper Spidev attuale e le implementazioni di embedded-hal per SpiBus e SpiDevice, insieme alla discussione nell’issue #87. Valuta la suddivisione del wrapper in SpidevBus e SpidevDevice, incluso il comportamento proposto per la selezione del chip e la condivisione del bus. Il lavoro è completato quando la separazione dell’API e la relativa documentazione corrispondono chiaramente alla semantica prevista del kernel e del multiplexing del bus.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Currently our Spidev wrapper struct implements both SpiBus and SpiDevice from embedded-hal. I think this is likely to lead to some confusion, especially since the SpiBus methods will still actually be using a shared SPI bus, toggling CS, and multiplexing with any other spidev devices on the same bus.
We discussed this a bit in #87 and while the main problem there is resolved by the new embedded-hal design, I think the split suggested is still worth considering. The proposal is to have two wrapper structs, SpidevBus and SpidevDevice perhaps, where:
SpidevBusimplements just theSpiBustrait- we configure
spidevto not drive the associated CS pin - we explain in the documentation that when this struct is used, it must be the only active
spidevdevice on that bus - we encourage users to give it a CS pin that is not connected to anything, since whatever pin is assigned to it in the device tree can't be re-used as GPIO (and therefore can't be used as a CS)
- this struct can then be used with any of the bus-multiplexing crates (like embedded-hal-bus) to generate lots of
SpiDeviceobjects, using generic GPIO for CS control, or used when dedicated bus access is required (eg to generate smart LED waveforms) - we are basically lying to the kernel about it being a single device, because there's no way to request exclusive bus access with
spidev
- we configure
SpidevDeviceimplements just theSpiDevicetrait- it's already a perfect fit for
SpiDevice, the kernel handles sharing and CS for us, even with other programs - it will work just as users expect
- but their device tree has to be set up to create the device and use the right CS
- it's already a perfect fit for
I'm happy to implement this as a PR if it sounds good to people, but it'd be great to get some feedback first or any suggestions on how it might be better done, especially if there's any clever spidev-related tricks that might be useful.
- Lingua principale
- Rust
- Stelle
- 319
- Fork
- 60
- Merge medio
- 12h 31m
- PR unite (30g)
- 1
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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/linux-embedded-hal
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
rust-embedded/linux-embedded-hal#121 · 4 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
rust-embedded/linux-embedded-hal#117 · 3 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
rust-embedded/linux-embedded-hal#116 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
Tutte le issue di rust-embedded/linux-embedded-hal
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
TheLarkInn/aipm#2413 ·
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
alexgorbatchev/simple-ptt#15 ·
-
tooling
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
todo:ticket
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
taikoxyz/taiko-mono#22168 · 1 commento ·