embedded_onewire/
lib.rs

1#![no_std]
2#![deny(missing_docs)]
3#![cfg_attr(docsrs, feature(doc_cfg))]
4#![doc = include_str!("../README.md")]
5
6mod error;
7mod search;
8mod search_async;
9mod traits;
10mod traits_async;
11mod utils;
12pub use error::OneWireError;
13pub use search::{OneWireSearch, OneWireSearchKind};
14pub use search_async::OneWireSearchAsync;
15pub use traits::{OneWire, OneWireStatus};
16pub use traits_async::OneWireAsync;
17pub use utils::OneWireCrc;
18
19/// Error type for 1-Wire operations.
20pub type OneWireResult<T, E> = Result<T, OneWireError<E>>;
21
22/// Command to match a specific ROM address in 1-Wire communication (non-overdrive mode)
23pub const ONEWIRE_MATCH_ROM_CMD: u8 = 0x55;
24
25/// Command to skip ROM address in 1-Wire communication (non-overdrive mode)
26pub const ONEWIRE_SKIP_ROM_CMD: u8 = 0xcc;
27
28/// The Overdrive-Match ROM command followed by a 64-bit
29/// ROM sequence transmitted at overdrive speed allows the
30/// bus master to address a specific DS28EA00 on a multidrop
31/// bus and to simultaneously set it in over-drive mode.
32/// Only the DS28EA00 that exactly matches the 64-bit ROM
33/// sequence responds to the subsequent control function
34/// command. Slaves already in overdrive mode from a previous
35/// Overdrive-Skip ROM or successful Overdrive-Match
36/// ROM command remain in overdrive mode. All over-drivecapable
37/// slaves return to standard speed at the next reset
38/// pulse of minimum 480μs duration. The Overdrive-Match
39/// ROM command can be used with a single device or mul-
40/// tiple devices on the bus.
41pub const ONEWIRE_MATCH_ROM_CMD_OD: u8 = 0x69;
42
43/// On a single-drop bus this command can save time by
44/// allowing the bus master to access the control functions
45/// without providing the 64-bit ROM code. Unlike the normal
46/// Skip ROM command, the Overdrive-Skip ROM sets the
47/// DS28EA00 in the overdrive mode (OD = 1). All communication
48/// following this command has to occur at overdrive
49/// speed until a reset pulse of minimum 480μs duration
50/// resets all devices on the bus to standard speed (OD = 0).
51pub const ONEWIRE_SKIP_ROM_CMD_OD: u8 = 0x3c;
52
53/// Command to search for devices on the 1-Wire bus
54pub const ONEWIRE_SEARCH_CMD: u8 = 0xf0;
55
56/// Command to search for devices in alarm state on the 1-Wire bus
57pub const ONEWIRE_CONDITIONAL_SEARCH_CMD: u8 = 0xec;