pub struct PreparedCard<CS: OutputPin> { /* private fields */ }Expand description
A card device on the shared SPI2 bus, pre-initialised by
Spi2Parts::finish_sd (the ≥74-clock power-up idle has run) and
presence-resolved. The BSP owns everything up to here with no SD-driver
type in its graph; the app supplies only its SD driver:
SdSpi::new(prepared.into_inner()).
Implementations§
Source§impl<CS: OutputPin> PreparedCard<CS>
impl<CS: OutputPin> PreparedCard<CS>
Sourcepub async fn set_config(&mut self, config: SpiConfig)
pub async fn set_config(&mut self, config: SpiConfig)
Change the config re-applied on every acquire — the post-init clock raise. Setting it only on a live guard would last exactly one command, because the next acquire re-applies the stored one.
Source§impl<CS: OutputPin> PreparedCard<CS>
impl<CS: OutputPin> PreparedCard<CS>
Sourcepub async fn acquire(&mut self) -> Option<Spi2CardGuard<'_, CS>>
pub async fn acquire(&mut self) -> Option<Spi2CardGuard<'_, CS>>
Take the bus for ONE command, with the chip-select in hand.
Released on drop. Hold it across a command; drop it between commands and between busy probes.
Sourcepub fn into_inner(self) -> FairSpiDevice<CardSpiDevice<PresenceCs<CS>>>
pub fn into_inner(self) -> FairSpiDevice<CardSpiDevice<PresenceCs<CS>>>
The presence-resolved card SpiDevice, for drivers that do not need
CS held across a command.
Retained for existing callers. Prefer Self::acquire: a driver
built on this cannot keep CS asserted across the data-token wait,
because each SpiDevice call deasserts it.
It IS still fairly arbitrated — the device is wrapped so every
transaction queues for the same permit the display takes. An earlier
version handed back the raw SpiDeviceWithConfig, which silently
left the card outside the arbiter: exactly the half-fair
configuration this change exists to remove, reachable through the
path the module docs recommend for compatibility.