mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 14:19:03 +00:00
[one_wire] Reset bus before SKIP ROM command (#14669)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
@@ -57,8 +57,11 @@ void OneWireBus::search() {
|
||||
}
|
||||
}
|
||||
|
||||
void OneWireBus::skip() {
|
||||
bool OneWireBus::skip() {
|
||||
if (!this->reset_())
|
||||
return false;
|
||||
this->write8(0xCC); // skip ROM
|
||||
return true;
|
||||
}
|
||||
|
||||
const LogString *OneWireBus::get_model_str(uint8_t model) {
|
||||
|
||||
@@ -16,7 +16,8 @@ class OneWireBus {
|
||||
virtual void write64(uint64_t val) = 0;
|
||||
|
||||
/// Write a command to the bus that addresses all devices by skipping the ROM.
|
||||
void skip();
|
||||
/// Returns true if a device presence pulse is detected.
|
||||
bool skip();
|
||||
|
||||
/// Read an 8 bit word from the bus.
|
||||
virtual uint8_t read8() = 0;
|
||||
|
||||
Reference in New Issue
Block a user