6static const char *
const TAG =
"one_wire";
27 if (this->
index_ >= devices.size()) {
28 ESP_LOGE(TAG,
"Index %d out of range, only %d devices found", this->
index_, devices.size());
35 if (devices.empty()) {
36 ESP_LOGE(TAG,
"No devices, can't auto-select address");
39 if (devices.size() > 1) {
40 ESP_LOGE(TAG,
"More than one device, can't auto-select address");
const std::vector< uint64_t > & get_devices()
Return the list of found devices.
bool select(uint64_t address)
Select a specific address on the bus for the following command.
virtual void write8(uint8_t val)=0
Write a word to the bus. LSB first.
std::string address_name_
static constexpr uint8_t INDEX_NOT_SET
OneWireBus * bus_
pointer to OneWireBus instance
bool send_command_(uint8_t cmd)
send command on the bus
const std::string & get_address_name()
Helper to create (and cache) the name for this sensor. For example "0xfe0000031f1eaf29".
bool check_address_or_index_()
find an address if necessary should be called from setup
Providing packet encoding functions for exchanging data with a remote host.
std::string format_hex(const uint8_t *data, size_t length)
Format the byte array data of length len in lowercased hex.