8 static const char *
const TAG =
"gpio.one_wire";
11 ESP_LOGCONFIG(TAG,
"Setting up 1-wire bus...");
20 ESP_LOGCONFIG(TAG,
"GPIO 1-wire bus:");
21 LOG_PIN(
" Pin: ", this->
t_pin_);
30 uint8_t retries = 125;
66 uint32_t delay0 = bit ? 6 : 60;
67 uint32_t delay1 = bit ? 59 : 5;
106 if (now - start < 60)
113 for (uint8_t i = 0; i < 8; i++) {
119 for (uint8_t i = 0; i < 64; i++) {
126 for (uint8_t i = 0; i < 8; i++) {
127 ret |= (uint8_t(this->
read_bit_()) << i);
134 for (uint8_t i = 0; i < 8; i++) {
135 ret |= (uint64_t(this->
read_bit_()) << i);
150 uint8_t last_zero = 0;
151 uint64_t bit_mask = 1;
155 for (
int bit_number = 1; bit_number <= 64; bit_number++, bit_mask <<= 1) {
161 if (id_bit && cmp_id_bit) {
168 if (id_bit != cmp_id_bit) {
174 branch = (address & bit_mask) > 0;
180 last_zero = bit_number;
187 address &= ~bit_mask;
virtual void pin_mode(gpio::Flags flags)=0
uint32_t IRAM_ATTR HOT micros()
void search()
Search for 1-Wire devices on the bus.
void dump_devices_(const char *tag)
log the found devices
void write64(uint64_t val) override
void dump_config() override
void reset_search() override
void pin_mode(gpio::Flags flags)
uint8_t last_discrepancy_
uint64_t search_int() override
void write_bit_(bool bit)
Implementation of SPI Controller mode.
void IRAM_ATTR HOT delayMicroseconds(uint32_t us)
void write8(uint8_t val) override
void digital_write(bool value)
uint64_t read64() override