ESPHome 2026.6.0-dev
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 : public Component {
25 public:
27 std::string get_wind_cardinal_direction() const;
28
29 void set_pin(InternalGPIOPin *pin) { pin_ = pin; }
30 void set_wind_speed_sensor(sensor::Sensor *wind_speed_sensor) { wind_speed_sensor_ = wind_speed_sensor; }
31 void set_wind_direction_degrees_sensor(sensor::Sensor *wind_direction_degrees_sensor) {
32 wind_direction_degrees_sensor_ = wind_direction_degrees_sensor;
33 }
34
35 void setup() override;
36 void dump_config() override;
37 void loop() override;
38
39 protected:
41
47};
48
49} // namespace esphome::tx20
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
Definition gpio.h:92
Base-class for all sensors.
Definition sensor.h:47
This class implements support for the Tx20 Wind sensor.
Definition tx20.h:24
sensor::Sensor * wind_direction_degrees_sensor_
Definition tx20.h:45
std::string get_wind_cardinal_direction() const
Get the textual representation of the wind direction ('N', 'SSE', ..).
Definition tx20.cpp:40
void set_wind_speed_sensor(sensor::Sensor *wind_speed_sensor)
Definition tx20.h:30
std::string wind_cardinal_direction_
Definition tx20.h:42
void loop() override
Definition tx20.cpp:33
void setup() override
Definition tx20.cpp:16
Tx20ComponentStore store_
Definition tx20.h:46
sensor::Sensor * wind_speed_sensor_
Definition tx20.h:44
void set_wind_direction_degrees_sensor(sensor::Sensor *wind_direction_degrees_sensor)
Definition tx20.h:31
void set_pin(InternalGPIOPin *pin)
Definition tx20.h:29
InternalGPIOPin * pin_
Definition tx20.h:43
void dump_config() override
Definition tx20.cpp:25
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:157
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