6static const char *
const TAG =
"one_wire";
29 if (this->
index_ >= devices.size()) {
30 ESP_LOGE(TAG,
"Index %d out of range, only %d devices found", this->
index_, devices.size());
37 if (devices.empty()) {
38 ESP_LOGE(TAG,
"No devices, can't auto-select address");
41 if (devices.size() > 1) {
42 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.
char * format_hex_prefixed_to(char(&buffer)[N], T val)
Format an unsigned integer as "0x" prefixed lowercase hex to buffer.