ESPHome 2025.5.0
Loading...
Searching...
No Matches
one_wire_bus.h
Go to the documentation of this file.
1#pragma once
2
3#include "esphome/core/hal.h"
4#include "esphome/core/log.h"
5#include <vector>
6
7namespace esphome {
8namespace one_wire {
9
11 public:
13 virtual void write8(uint8_t val) = 0;
14
16 virtual void write64(uint64_t val) = 0;
17
19 void skip();
20
22 virtual uint8_t read8() = 0;
23
25 virtual uint64_t read64() = 0;
26
28 bool select(uint64_t address);
29
31 const std::vector<uint64_t> &get_devices();
32
34 void search();
35
37 const LogString *get_model_str(uint8_t model);
38
39 protected:
40 std::vector<uint64_t> devices_;
41
43 void dump_devices_(const char *tag);
44
51 bool reset_();
52
57 virtual int reset_int() = 0;
58
60 virtual void reset_search() = 0;
61
63 virtual uint64_t search_int() = 0;
64};
65
66} // namespace one_wire
67} // namespace esphome
uint8_t address
Definition bl0906.h:4
virtual void reset_search()=0
Reset the device search.
const std::vector< uint64_t > & get_devices()
Return the list of found devices.
std::vector< uint64_t > devices_
void dump_devices_(const char *tag)
log the found devices
virtual int reset_int()=0
Bus Reset.
bool reset_()
Reset the bus, should be done before all write operations.
virtual uint64_t read64()=0
Read an 64-bit unsigned integer from the bus.
void skip()
Write a command to the bus that addresses all devices by skipping the ROM.
virtual void write64(uint64_t val)=0
Write a 64 bit unsigned integer to the bus. LSB first.
bool select(uint64_t address)
Select a specific address on the bus for the following command.
const LogString * get_model_str(uint8_t model)
Get the description string for this model.
virtual void write8(uint8_t val)=0
Write a word to the bus. LSB first.
void search()
Search for 1-Wire devices on the bus.
virtual uint8_t read8()=0
Read an 8 bit word from the bus.
virtual uint64_t search_int()=0
Search for a 1-Wire device on the bus. Returns 0 if all devices have been found.
mopeka_std_values val[4]
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7