ESPHome 2025.5.0
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
12
13namespace esphome {
14namespace gdk101 {
15
16static const uint8_t GDK101_REG_READ_FIRMWARE = 0xB4; // Firmware version
17static const uint8_t GDK101_REG_RESET = 0xA0; // Reset register - reading its value triggers reset
18static const uint8_t GDK101_REG_READ_STATUS = 0xB0; // Status register
19static const uint8_t GDK101_REG_READ_MEASURING_TIME = 0xB1; // Mesuring time
20static const uint8_t GDK101_REG_READ_10MIN_AVG = 0xB2; // Average radiation dose per 10 min
21static const uint8_t GDK101_REG_READ_1MIN_AVG = 0xB3; // Average radiation dose per 1 min
22
24#ifdef USE_SENSOR
25 SUB_SENSOR(rad_1m)
26 SUB_SENSOR(rad_10m)
27 SUB_SENSOR(status)
28 SUB_SENSOR(fw_version)
29 SUB_SENSOR(measurement_duration)
30#endif // USE_SENSOR
31#ifdef USE_BINARY_SENSOR
32 SUB_BINARY_SENSOR(vibration)
33#endif // USE_BINARY_SENSOR
34
35 public:
36 void setup() override;
37 void dump_config() override;
38 float get_setup_priority() const override;
39 void update() override;
40
41 protected:
42 bool read_bytes_with_retry_(uint8_t a_register, uint8_t *data, uint8_t len);
43 bool reset_sensor_(uint8_t *data);
44 bool read_dose_1m_(uint8_t *data);
45 bool read_dose_10m_(uint8_t *data);
46 bool read_status_(uint8_t *data);
47 bool read_fw_version_(uint8_t *data);
48 bool read_measurement_duration_(uint8_t *data);
49};
50
51} // namespace gdk101
52} // namespace esphome
uint8_t status
Definition bl0942.h:8
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:51
This class simplifies creating components that periodically check a state.
Definition component.h:301
bool read_status_(uint8_t *data)
Definition gdk101.cpp:135
bool read_bytes_with_retry_(uint8_t a_register, uint8_t *data, uint8_t len)
Definition gdk101.cpp:80
bool read_dose_1m_(uint8_t *data)
Definition gdk101.cpp:103
bool read_dose_10m_(uint8_t *data)
Definition gdk101.cpp:119
bool read_fw_version_(uint8_t *data)
Definition gdk101.cpp:156
bool reset_sensor_(uint8_t *data)
Definition gdk101.cpp:90
bool read_measurement_duration_(uint8_t *data)
Definition gdk101.cpp:172
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:133
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
std::string size_t len
Definition helpers.h:301