pub struct Ds18b20Driver { /* private fields */ }Implementations§
Source§impl Ds18b20Driver
impl Ds18b20Driver
Sourcepub fn new(rmt: RMT<'static>, pin: AnyPin<'static>) -> Result<Self, Error>
pub fn new(rmt: RMT<'static>, pin: AnyPin<'static>) -> Result<Self, Error>
Claim the WHOLE RMT peripheral and drive pin as the 1-Wire bus.
Convenience for an app that uses RMT for nothing else. If it also drives
the SK6812 bars, use Self::with_channels and
crate::driver::sk6812::Sk6812Driver::with_channel with channels from
crate::board::rmt::RmtChannels — both drivers used to take the
peripheral by value and both wanted channel 0, so having temperature
sensing meant having no LEDs.
Sourcepub fn with_channels(
tx: impl TxChannelCreator<'static, Async>,
rx: impl RxChannelCreator<'static, Async>,
pin: AnyPin<'static>,
) -> Result<Self, Error>
pub fn with_channels( tx: impl TxChannelCreator<'static, Async>, rx: impl RxChannelCreator<'static, Async>, pin: AnyPin<'static>, ) -> Result<Self, Error>
Drive pin as the 1-Wire bus using the given RMT channels.
One TX and one RX channel, which leaves the rest of the peripheral for other users — the point of the split. The bit timing is the RMT’s, so which channel it is does not matter to this driver.
Sourcepub fn forget_addresses(&mut self)
pub fn forget_addresses(&mut self)
Enumerate the bus and cache the discovered ROM addresses.
Runs the full ROM Search once. [read_all_temperatures] calls this
lazily on first use; call it explicitly to refresh the set. As no sensor
hot-plug is assumed at runtime, the cached addresses are reused across
reads — avoiding a 64-step ROM search on every cycle (which otherwise
dominates the RMT round-trips and task wakeups, the main cost here since
the RMT does the bit timing in hardware).
Drop the cached ROM addresses, so the next read enumerates again.
For a caller recovering from a bus error: the cache (and the power mode that came with it) describes a bus that was working, and after a fault neither can be assumed.