idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches
idfxx::onewire::address Class Reference

1-Wire device address. More...

Public Member Functions

constexpr address ()=default
 Constructs an address with value 0 (equivalent to any()).
 
constexpr address (uint64_t raw)
 Constructs an address from a raw 64-bit value.
 
constexpr uint64_t raw () const
 Returns the underlying 64-bit ROM address.
 
constexpr uint8_t family () const
 Extracts the family code from the address.
 
constexpr bool operator== (const address &) const noexcept=default
 Compares two addresses for equality.
 
constexpr auto operator<=> (const address &) const noexcept=default
 Default three-way comparison for ordering.
 

Static Public Member Functions

static constexpr address any ()
 Returns the wildcard address for single-device buses.
 
static constexpr address none ()
 Returns an invalid sentinel address indicating no device.
 

Detailed Description

1-Wire device address.

Typed wrapper around a 64-bit 1-Wire ROM address. Each device on the bus has a unique address containing a family code (low byte), serial number, and CRC (high byte).

For single-device buses, address::any() can be used to skip ROM matching.

Definition at line 47 of file onewire.hpp.

Constructor & Destructor Documentation

◆ address() [1/2]

constexpr idfxx::onewire::address::address ( )
constexprdefault

Constructs an address with value 0 (equivalent to any()).

◆ address() [2/2]

constexpr idfxx::onewire::address::address ( uint64_t  raw)
inlineexplicitconstexpr

Constructs an address from a raw 64-bit value.

Parameters
rawThe 64-bit ROM address.

Definition at line 56 of file onewire.hpp.

Member Function Documentation

◆ any()

static constexpr address idfxx::onewire::address::any ( )
inlinestaticconstexpr

Returns the wildcard address for single-device buses.

When only one device is connected, this address can be used to skip ROM matching, simplifying communication.

Returns
The wildcard address (value 0).

Definition at line 67 of file onewire.hpp.

◆ family()

constexpr uint8_t idfxx::onewire::address::family ( ) const
inlineconstexpr

Extracts the family code from the address.

The family code is stored in the low byte of the ROM address and identifies the device type (e.g., 0x28 for DS18B20).

Returns
The 8-bit family code.

Definition at line 93 of file onewire.hpp.

◆ none()

static constexpr address idfxx::onewire::address::none ( )
inlinestaticconstexpr

Returns an invalid sentinel address indicating no device.

This address will never occur in a real device (CRC mismatch) and can be used as a "no-such-device" indicator.

Returns
The sentinel address (all bits set).

Definition at line 77 of file onewire.hpp.

◆ operator<=>()

constexpr auto idfxx::onewire::address::operator<=> ( const address ) const
constexprdefaultnoexcept

Default three-way comparison for ordering.

◆ operator==()

constexpr bool idfxx::onewire::address::operator== ( const address ) const
constexprdefaultnoexcept

Compares two addresses for equality.

◆ raw()

constexpr uint64_t idfxx::onewire::address::raw ( ) const
inlineconstexpr

Returns the underlying 64-bit ROM address.

Returns
The raw address value.

Definition at line 83 of file onewire.hpp.


The documentation for this class was generated from the following file: