ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
tx20.h
Go to the documentation of this file.
1#pragma once
2
4#include "esphome/core/hal.h"
6
7namespace esphome::tx20 {
8
11 volatile uint16_t *buffer;
13 volatile uint8_t buffer_index;
15 volatile bool tx20_available;
16 volatile bool pin_state;
18
19 void reset();
20 static void gpio_intr(Tx20ComponentStore *arg);
21};
22
24class Tx20Component final : public Component {
25 SUB_SENSOR(wind_speed)
26 SUB_SENSOR(wind_direction_degrees)
27
28 public:
30 std::string get_wind_cardinal_direction() const;
31
32 void set_pin(InternalGPIOPin *pin) { pin_ = pin; }
33
34 void setup() override;
35 void dump_config() override;
36 void loop() override;
37
38 protected:
40
41 uint8_t wind_direction_index_{0xFF}; // 0xFF until the first reading
44};
45
46} // namespace esphome::tx20
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
Definition gpio_pin.h:98
This class implements support for the Tx20 Wind sensor.
Definition tx20.h:24
Tx20ComponentStore store_
Definition tx20.h:43
InternalGPIOPin * pin_
Definition tx20.h:42
uint8_t wind_direction_index_
Definition tx20.h:41
static void uint32_t
Store data in a class that doesn't use multiple-inheritance (vtables in flash)
Definition tx20.h:10
ISRInternalGPIOPin pin
Definition tx20.h:17
volatile uint32_t start_time
Definition tx20.h:12
volatile uint32_t spent_time
Definition tx20.h:14
static void gpio_intr(Tx20ComponentStore *arg)
Definition tx20.cpp:159
volatile uint16_t * buffer
Definition tx20.h:11
volatile uint8_t buffer_index
Definition tx20.h:13
volatile bool tx20_available
Definition tx20.h:15