ESPHome 2025.5.0
Loading...
Searching...
No Matches
esphome::one_wire::OneWireBus Class Referenceabstract

#include <one_wire_bus.h>

Inheritance diagram for esphome::one_wire::OneWireBus:
esphome::gpio::GPIOOneWireBus

Public Member Functions

virtual void write8 (uint8_t val)=0
 Write a word to the bus. LSB first.
 
virtual void write64 (uint64_t val)=0
 Write a 64 bit unsigned integer to the bus. LSB first.
 
void skip ()
 Write a command to the bus that addresses all devices by skipping the ROM.
 
virtual uint8_t read8 ()=0
 Read an 8 bit word from the bus.
 
virtual uint64_t read64 ()=0
 Read an 64-bit unsigned integer from the bus.
 
bool select (uint64_t address)
 Select a specific address on the bus for the following command.
 
const std::vector< uint64_t > & get_devices ()
 Return the list of found devices.
 
void search ()
 Search for 1-Wire devices on the bus.
 
const LogString * get_model_str (uint8_t model)
 Get the description string for this model.
 

Protected Member Functions

void dump_devices_ (const char *tag)
 log the found devices
 
bool reset_ ()
 Reset the bus, should be done before all write operations.
 
virtual int reset_int ()=0
 Bus Reset.
 
virtual void reset_search ()=0
 Reset the device search.
 
virtual uint64_t search_int ()=0
 Search for a 1-Wire device on the bus. Returns 0 if all devices have been found.
 

Protected Attributes

std::vector< uint64_t > devices_
 

Detailed Description

Definition at line 10 of file one_wire_bus.h.

Member Function Documentation

◆ dump_devices_()

void esphome::one_wire::OneWireBus::dump_devices_ ( const char * tag)
protected

log the found devices

Definition at line 80 of file one_wire_bus.cpp.

◆ get_devices()

const std::vector< uint64_t > & esphome::one_wire::OneWireBus::get_devices ( )

Return the list of found devices.

Definition at line 18 of file one_wire_bus.cpp.

◆ get_model_str()

const LogString * esphome::one_wire::OneWireBus::get_model_str ( uint8_t model)

Get the description string for this model.

Definition at line 63 of file one_wire_bus.cpp.

◆ read64()

virtual uint64_t esphome::one_wire::OneWireBus::read64 ( )
pure virtual

Read an 64-bit unsigned integer from the bus.

Implemented in esphome::gpio::GPIOOneWireBus.

◆ read8()

virtual uint8_t esphome::one_wire::OneWireBus::read8 ( )
pure virtual

Read an 8 bit word from the bus.

Implemented in esphome::gpio::GPIOOneWireBus.

◆ reset_()

bool esphome::one_wire::OneWireBus::reset_ ( )
protected

Reset the bus, should be done before all write operations.

Takes approximately 1ms.

Returns
Whether the operation was successful.

Definition at line 20 of file one_wire_bus.cpp.

◆ reset_int()

virtual int esphome::one_wire::OneWireBus::reset_int ( )
protectedpure virtual

Bus Reset.

Returns
-1: signal fail, 0: no device detected, 1: device detected

Implemented in esphome::gpio::GPIOOneWireBus.

◆ reset_search()

virtual void esphome::one_wire::OneWireBus::reset_search ( )
protectedpure virtual

Reset the device search.

Implemented in esphome::gpio::GPIOOneWireBus.

◆ search()

void esphome::one_wire::OneWireBus::search ( )

Search for 1-Wire devices on the bus.

Definition at line 35 of file one_wire_bus.cpp.

◆ search_int()

virtual uint64_t esphome::one_wire::OneWireBus::search_int ( )
protectedpure virtual

Search for a 1-Wire device on the bus. Returns 0 if all devices have been found.

Implemented in esphome::gpio::GPIOOneWireBus.

◆ select()

bool IRAM_ATTR esphome::one_wire::OneWireBus::select ( uint64_t address)

Select a specific address on the bus for the following command.

Definition at line 27 of file one_wire_bus.cpp.

◆ skip()

void esphome::one_wire::OneWireBus::skip ( )

Write a command to the bus that addresses all devices by skipping the ROM.

Definition at line 59 of file one_wire_bus.cpp.

◆ write64()

virtual void esphome::one_wire::OneWireBus::write64 ( uint64_t val)
pure virtual

Write a 64 bit unsigned integer to the bus. LSB first.

Implemented in esphome::gpio::GPIOOneWireBus.

◆ write8()

virtual void esphome::one_wire::OneWireBus::write8 ( uint8_t val)
pure virtual

Write a word to the bus. LSB first.

Implemented in esphome::gpio::GPIOOneWireBus.

Field Documentation

◆ devices_

std::vector<uint64_t> esphome::one_wire::OneWireBus::devices_
protected

Definition at line 40 of file one_wire_bus.h.


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