ESPHome  2022.12.8
Public Member Functions | Protected Member Functions | Protected Attributes
esphome::dallas::ESPOneWire Class Reference

#include <esp_one_wire.h>

Public Member Functions

 ESPOneWire (InternalGPIOPin *pin)
 
bool reset ()
 Reset the bus, should be done before all write operations. More...
 
void write_bit (bool bit)
 Write a single bit to the bus, takes about 70µs. More...
 
bool read_bit ()
 Read a single bit from the bus, takes about 70µs. More...
 
void write8 (uint8_t val)
 Write a word to the bus. LSB first. More...
 
void write64 (uint64_t val)
 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...
 
uint8_t read8 ()
 Read an 8 bit word from the bus. More...
 
uint64_t read64 ()
 Read an 64-bit unsigned integer from the bus. More...
 
void select (uint64_t address)
 Select a specific address on the bus for the following command. More...
 
void reset_search ()
 Reset the device search. More...
 
uint64_t search ()
 Search for a 1-Wire device on the bus. Returns 0 if all devices have been found. More...
 
std::vector< uint64_t > search_vec ()
 Helper that wraps search in a std::vector. More...
 

Protected Member Functions

uint8_t * rom_number8_ ()
 Helper to get the internal 64-bit unsigned rom number as a 8-bit integer pointer. More...
 

Protected Attributes

ISRInternalGPIOPin pin_
 
uint8_t last_discrepancy_ {0}
 
bool last_device_flag_ {false}
 
uint64_t rom_number_ {0}
 

Detailed Description

Definition at line 12 of file esp_one_wire.h.

Constructor & Destructor Documentation

◆ ESPOneWire()

esphome::dallas::ESPOneWire::ESPOneWire ( InternalGPIOPin pin)
explicit

Definition at line 13 of file esp_one_wire.cpp.

Member Function Documentation

◆ read64()

uint64_t IRAM_ATTR esphome::dallas::ESPOneWire::read64 ( )

Read an 64-bit unsigned integer from the bus.

Definition at line 129 of file esp_one_wire.cpp.

◆ read8()

uint8_t IRAM_ATTR esphome::dallas::ESPOneWire::read8 ( )

Read an 8 bit word from the bus.

Definition at line 122 of file esp_one_wire.cpp.

◆ read_bit()

bool HOT IRAM_ATTR esphome::dallas::ESPOneWire::read_bit ( )

Read a single bit from the bus, takes about 70µs.

Definition at line 65 of file esp_one_wire.cpp.

◆ reset()

bool HOT IRAM_ATTR esphome::dallas::ESPOneWire::reset ( )

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

Takes approximately 1ms.

Returns
Whether the operation was successful.

Definition at line 15 of file esp_one_wire.cpp.

◆ reset_search()

void IRAM_ATTR esphome::dallas::ESPOneWire::reset_search ( )

Reset the device search.

Definition at line 140 of file esp_one_wire.cpp.

◆ rom_number8_()

uint8_t IRAM_ATTR * esphome::dallas::ESPOneWire::rom_number8_ ( )
inlineprotected

Helper to get the internal 64-bit unsigned rom number as a 8-bit integer pointer.

Definition at line 249 of file esp_one_wire.cpp.

◆ search()

uint64_t IRAM_ATTR esphome::dallas::ESPOneWire::search ( )

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

Definition at line 145 of file esp_one_wire.cpp.

◆ search_vec()

std::vector< uint64_t > esphome::dallas::ESPOneWire::search_vec ( )

Helper that wraps search in a std::vector.

Definition at line 235 of file esp_one_wire.cpp.

◆ select()

void IRAM_ATTR esphome::dallas::ESPOneWire::select ( uint64_t  address)

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

Definition at line 136 of file esp_one_wire.cpp.

◆ skip()

void IRAM_ATTR esphome::dallas::ESPOneWire::skip ( )

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

Definition at line 245 of file esp_one_wire.cpp.

◆ write64()

void IRAM_ATTR esphome::dallas::ESPOneWire::write64 ( uint64_t  val)

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

Definition at line 116 of file esp_one_wire.cpp.

◆ write8()

void IRAM_ATTR esphome::dallas::ESPOneWire::write8 ( uint8_t  val)

Write a word to the bus. LSB first.

Definition at line 110 of file esp_one_wire.cpp.

◆ write_bit()

void HOT IRAM_ATTR esphome::dallas::ESPOneWire::write_bit ( bool  bit)

Write a single bit to the bus, takes about 70µs.

Definition at line 43 of file esp_one_wire.cpp.

Field Documentation

◆ last_device_flag_

bool esphome::dallas::ESPOneWire::last_device_flag_ {false}
protected

Definition at line 63 of file esp_one_wire.h.

◆ last_discrepancy_

uint8_t esphome::dallas::ESPOneWire::last_discrepancy_ {0}
protected

Definition at line 62 of file esp_one_wire.h.

◆ pin_

ISRInternalGPIOPin esphome::dallas::ESPOneWire::pin_
protected

Definition at line 61 of file esp_one_wire.h.

◆ rom_number_

uint64_t esphome::dallas::ESPOneWire::rom_number_ {0}
protected

Definition at line 64 of file esp_one_wire.h.


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