idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches
1-Wire Component

Type-safe 1-Wire bus protocol driver for ESP32. More...

Namespaces

namespace  idfxx
 
namespace  idfxx::onewire
 1-Wire bus protocol classes and utilities.
 

Classes

class  idfxx::onewire::address
 1-Wire device address. More...
 
class  idfxx::onewire::bus
 1-Wire bus controller with thread-safe access. More...
 

Functions

uint8_t idfxx::onewire::crc8 (std::span< const uint8_t > data)
 Computes a Dallas Semiconductor 8-bit CRC.
 
uint16_t idfxx::onewire::crc16 (std::span< const uint8_t > data, uint16_t crc_iv=0)
 Computes a Dallas Semiconductor 16-bit CRC.
 
bool idfxx::onewire::check_crc16 (std::span< const uint8_t > data, std::span< const uint8_t, 2 > inverted_crc, uint16_t crc_iv=0)
 Verifies a 16-bit CRC against received data.
 

Detailed Description

Type-safe 1-Wire bus protocol driver for ESP32.

Provides 1-Wire bus lifecycle management with thread-safe device access, device search, ROM commands, and CRC utilities.

Depends on Core Utilities for error handling and GPIO Component for pin configuration.

Function Documentation

◆ check_crc16()

bool idfxx::onewire::check_crc16 ( std::span< const uint8_t data,
std::span< const uint8_t, 2 >  inverted_crc,
uint16_t  crc_iv = 0 
)

Verifies a 16-bit CRC against received data.

Parameters
dataThe data bytes to checksum.
inverted_crcThe two CRC16 bytes as received from the device.
crc_ivThe CRC starting value (default: 0).
Returns
true if the CRC matches, false otherwise.

◆ crc16()

uint16_t idfxx::onewire::crc16 ( std::span< const uint8_t data,
uint16_t  crc_iv = 0 
)

Computes a Dallas Semiconductor 16-bit CRC.

Used to verify data integrity for certain 1-Wire device operations.

Parameters
dataThe data bytes to checksum.
crc_ivThe CRC starting value (default: 0).
Returns
The computed 16-bit CRC.
Note
The CRC computed here is not what you'll get directly from the 1-Wire network, as it is transmitted bitwise inverted.

◆ crc8()

uint8_t idfxx::onewire::crc8 ( std::span< const uint8_t data)

Computes a Dallas Semiconductor 8-bit CRC.

Used to verify the integrity of ROM addresses and scratchpad data.

Parameters
dataThe data bytes to checksum.
Returns
The computed 8-bit CRC.