ESPHome 2025.5.0
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 {
8namespace tx20 {
9
12 volatile uint16_t *buffer;
13 volatile uint32_t start_time;
14 volatile uint8_t buffer_index;
15 volatile uint32_t spent_time;
16 volatile bool tx20_available;
17 volatile bool pin_state;
19
20 void reset();
21 static void gpio_intr(Tx20ComponentStore *arg);
22};
23
25class Tx20Component : public Component {
26 public:
28 std::string get_wind_cardinal_direction() const;
29
30 void set_pin(InternalGPIOPin *pin) { pin_ = pin; }
31 void set_wind_speed_sensor(sensor::Sensor *wind_speed_sensor) { wind_speed_sensor_ = wind_speed_sensor; }
32 void set_wind_direction_degrees_sensor(sensor::Sensor *wind_direction_degrees_sensor) {
33 wind_direction_degrees_sensor_ = wind_direction_degrees_sensor;
34 }
35
36 void setup() override;
37 void dump_config() override;
38 float get_setup_priority() const override;
39 void loop() override;
40
41 protected:
43
49};
50
51} // namespace tx20
52} // namespace esphome
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
Definition gpio.h:73
Base-class for all sensors.
Definition sensor.h:57
This class implements support for the Tx20 Wind sensor.
Definition tx20.h:25
sensor::Sensor * wind_direction_degrees_sensor_
Definition tx20.h:47
std::string get_wind_cardinal_direction() const
Get the textual representation of the wind direction ('N', 'SSE', ..).
Definition tx20.cpp:44
void set_wind_speed_sensor(sensor::Sensor *wind_speed_sensor)
Definition tx20.h:31
std::string wind_cardinal_direction_
Definition tx20.h:44
void loop() override
Definition tx20.cpp:35
void setup() override
Definition tx20.cpp:17
Tx20ComponentStore store_
Definition tx20.h:48
sensor::Sensor * wind_speed_sensor_
Definition tx20.h:46
void set_wind_direction_degrees_sensor(sensor::Sensor *wind_direction_degrees_sensor)
Definition tx20.h:32
void set_pin(InternalGPIOPin *pin)
Definition tx20.h:30
InternalGPIOPin * pin_
Definition tx20.h:45
void dump_config() override
Definition tx20.cpp:27
float get_setup_priority() const override
Definition tx20.cpp:42
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
Store data in a class that doesn't use multiple-inheritance (vtables in flash)
Definition tx20.h:11
ISRInternalGPIOPin pin
Definition tx20.h:18
volatile uint32_t start_time
Definition tx20.h:13
volatile uint32_t spent_time
Definition tx20.h:15
static void gpio_intr(Tx20ComponentStore *arg)
Definition tx20.cpp:145
volatile uint16_t * buffer
Definition tx20.h:12
volatile uint8_t buffer_index
Definition tx20.h:14
volatile bool tx20_available
Definition tx20.h:16