[−][src]Struct one_wire_bus::OneWire
Methods
impl<T, E> OneWire<T> where
T: InputPin<Error = E>,
T: OutputPin<Error = E>,
[src]
T: InputPin<Error = E>,
T: OutputPin<Error = E>,
pub fn new(pin: T) -> OneWireResult<OneWire<T>, E>
[src]
pub fn into_inner(self) -> T
[src]
pub fn release_bus(&mut self) -> OneWireResult<(), E>
[src]
Disconnects the bus, letting another device (or the pull-up resistor) set the bus value
pub fn set_bus_low(&mut self) -> OneWireResult<(), E>
[src]
Drives the bus low
pub fn is_bus_high(&self) -> OneWireResult<bool, E>
[src]
pub fn is_bus_low(&self) -> OneWireResult<bool, E>
[src]
pub fn reset(&mut self, delay: &mut impl DelayUs<u16>) -> OneWireResult<bool, E>
[src]
Sends a reset pulse, then returns true if a device is present
pub fn read_bit(
&mut self,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<bool, E>
[src]
&mut self,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<bool, E>
pub fn read_byte(
&mut self,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<u8, E>
[src]
&mut self,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<u8, E>
pub fn read_bytes(
&mut self,
output: &mut [u8],
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
[src]
&mut self,
output: &mut [u8],
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
pub fn write_1_bit(
&mut self,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
[src]
&mut self,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
pub fn write_0_bit(
&mut self,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
[src]
&mut self,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
pub fn write_bit(
&mut self,
value: bool,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
[src]
&mut self,
value: bool,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
pub fn write_byte(
&mut self,
value: u8,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
[src]
&mut self,
value: u8,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
pub fn write_bytes(
&mut self,
bytes: &[u8],
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
[src]
&mut self,
bytes: &[u8],
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
pub fn match_address(
&mut self,
address: &Address,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
[src]
&mut self,
address: &Address,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
Address a specific device. All others will wait for a reset pulse. This should only be called after a reset, and should be immediately followed by another command
pub fn skip_address(
&mut self,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
[src]
&mut self,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
Address all devices on the bus simultaneously. This should only be called after a reset, and should be immediately followed by another command
pub fn send_command(
&mut self,
command: u8,
address: Option<&Address>,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
[src]
&mut self,
command: u8,
address: Option<&Address>,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<(), E>
Sends a reset, followed with either a SKIP_ROM or MATCH_ROM (with an address), and then the supplied command This should be followed by any reading/writing, if needed by the command used
ⓘImportant traits for DeviceSearch<'a, 'b, T, D>pub fn devices<'a, 'b, D>(
&'a mut self,
only_alarming: bool,
delay: &'b mut D
) -> DeviceSearch<'a, 'b, T, D> where
D: DelayUs<u16>,
[src]
&'a mut self,
only_alarming: bool,
delay: &'b mut D
) -> DeviceSearch<'a, 'b, T, D> where
D: DelayUs<u16>,
Returns an iterator that iterates over all device addresses on the bus They can be filtered to only alarming devices if needed There is no requirement to immediately finish iterating all devices, but if devices are added / removed / change alarm state, the search may return an error or fail to find a device Device addresses will always be returned in the same order (lowest to highest, Little Endian)
pub fn device_search(
&mut self,
search_state: Option<&SearchState>,
only_alarming: bool,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<Option<(Address, SearchState)>, E>
[src]
&mut self,
search_state: Option<&SearchState>,
only_alarming: bool,
delay: &mut impl DelayUs<u16>
) -> OneWireResult<Option<(Address, SearchState)>, E>
Search for device addresses on the bus
They can be filtered to only alarming devices if needed
Start the first search with a search_state of None
, then use the returned state for subsequent searches
There is no time limit for continuing a search, but if devices are
added / removed / change alarm state, the search may return an error or fail to find a device
Device addresses will always be returned in the same order (lowest to highest, Little Endian)
Auto Trait Implementations
impl<T> Send for OneWire<T> where
T: Send,
T: Send,
impl<T> Sync for OneWire<T> where
T: Sync,
T: Sync,
impl<T> Unpin for OneWire<T> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,