ESPHome  2024.11.2
Public Member Functions | Protected Member Functions | Protected Attributes
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 bool reset ()=0
 Reset the bus, should be done before all write operations. More...
 
virtual void write8 (uint8_t val)=0
 Write a word to the bus. LSB first. More...
 
virtual void write64 (uint64_t val)=0
 Write a 64 bit unsigned integer to the bus. LSB first. More...
 
void skip ()
 Write a command to the bus that addresses all devices by skipping the ROM. More...
 
virtual uint8_t read8 ()=0
 Read an 8 bit word from the bus. More...
 
virtual uint64_t read64 ()=0
 Read an 64-bit unsigned integer from the bus. More...
 
bool select (uint64_t address)
 Select a specific address on the bus for the following command. More...
 
const std::vector< uint64_t > & get_devices ()
 Return the list of found devices. More...
 
void search ()
 Search for 1-Wire devices on the bus. More...
 
const LogString * get_model_str (uint8_t model)
 Get the description string for this model. More...
 

Protected Member Functions

void dump_devices_ (const char *tag)
 log the found devices More...
 
virtual void reset_search ()=0
 Reset the device search. More...
 
virtual uint64_t search_int ()=0
 Search for a 1-Wire device on the bus. Returns 0 if all devices have been found. More...
 

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 76 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 59 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()

virtual bool esphome::one_wire::OneWireBus::reset ( )
pure virtual

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

Takes approximately 1ms.

Returns
Whether the operation was successful.

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 28 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 20 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 55 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 48 of file one_wire_bus.h.


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