ESPHome 2025.12.0-dev
Loading...
Searching...
No Matches
gdk101.h
Go to the documentation of this file.
1#pragma once
2
5#ifdef USE_SENSOR
7#endif // USE_SENSOR
8#ifdef USE_BINARY_SENSOR
10#endif // USE_BINARY_SENSOR
11#ifdef USE_TEXT_SENSOR
13#endif // USE_TEXT_SENSOR
15
16namespace esphome {
17namespace gdk101 {
18
19static const uint8_t GDK101_REG_READ_FIRMWARE = 0xB4; // Firmware version
20static const uint8_t GDK101_REG_RESET = 0xA0; // Reset register - reading its value triggers reset
21static const uint8_t GDK101_REG_READ_STATUS = 0xB0; // Status register
22static const uint8_t GDK101_REG_READ_MEASURING_TIME = 0xB1; // Mesuring time
23static const uint8_t GDK101_REG_READ_10MIN_AVG = 0xB2; // Average radiation dose per 10 min
24static const uint8_t GDK101_REG_READ_1MIN_AVG = 0xB3; // Average radiation dose per 1 min
25
27#ifdef USE_SENSOR
28 SUB_SENSOR(rad_1m)
29 SUB_SENSOR(rad_10m)
30 SUB_SENSOR(status)
31 SUB_SENSOR(measurement_duration)
32#endif // USE_SENSOR
33#ifdef USE_BINARY_SENSOR
34 SUB_BINARY_SENSOR(vibration)
35#endif // USE_BINARY_SENSOR
36#ifdef USE_TEXT_SENSOR
37 SUB_TEXT_SENSOR(fw_version)
38#endif // USE_TEXT_SENSOR
39
40 public:
41 void setup() override;
42 void dump_config() override;
43 float get_setup_priority() const override;
44 void update() override;
45
46 protected:
47 bool read_bytes_with_retry_(uint8_t a_register, uint8_t *data, uint8_t len);
48 bool reset_sensor_(uint8_t *data);
49 bool read_dose_1m_(uint8_t *data);
50 bool read_dose_10m_(uint8_t *data);
51 bool read_status_(uint8_t *data);
52 bool read_fw_version_(uint8_t *data);
53 bool read_measurement_duration_(uint8_t *data);
54};
55
56} // namespace gdk101
57} // namespace esphome
uint8_t status
Definition bl0942.h:8
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:94
This class simplifies creating components that periodically check a state.
Definition component.h:437
bool read_status_(uint8_t *data)
Definition gdk101.cpp:137
bool read_bytes_with_retry_(uint8_t a_register, uint8_t *data, uint8_t len)
Definition gdk101.cpp:82
bool read_dose_1m_(uint8_t *data)
Definition gdk101.cpp:105
bool read_dose_10m_(uint8_t *data)
Definition gdk101.cpp:121
bool read_fw_version_(uint8_t *data)
Definition gdk101.cpp:158
bool reset_sensor_(uint8_t *data)
Definition gdk101.cpp:92
bool read_measurement_duration_(uint8_t *data)
Definition gdk101.cpp:174
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:133
uint8_t size_t len
Definition i2c.h:273
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7