7 static const char *
const TAG =
"t6615";
9 static const uint32_t T6615_TIMEOUT = 1000;
10 static const uint8_t T6615_MAGIC = 0xFF;
11 static const uint8_t T6615_ADDR_HOST = 0xFA;
12 static const uint8_t T6615_ADDR_SENSOR = 0xFE;
13 static const uint8_t T6615_COMMAND_GET_PPM[] = {0x02, 0x03};
14 static const uint8_t T6615_COMMAND_GET_SERIAL[] = {0x02, 0x01};
15 static const uint8_t T6615_COMMAND_GET_VERSION[] = {0x02, 0x0D};
16 static const uint8_t T6615_COMMAND_GET_ELEVATION[] = {0x02, 0x0F};
17 static const uint8_t T6615_COMMAND_GET_ABC[] = {0xB7, 0x00};
18 static const uint8_t T6615_COMMAND_ENABLE_ABC[] = {0xB7, 0x01};
19 static const uint8_t T6615_COMMAND_DISABLE_ABC[] = {0xB7, 0x02};
20 static const uint8_t T6615_COMMAND_SET_ELEVATION[] = {0x03, 0x0F};
27 this->
write_byte(
sizeof(T6615_COMMAND_GET_PPM));
28 this->
write_array(T6615_COMMAND_GET_PPM,
sizeof(T6615_COMMAND_GET_PPM));
42 uint8_t response_buffer[6];
48 if (response_buffer[0] != T6615_MAGIC || response_buffer[1] != T6615_ADDR_HOST) {
49 ESP_LOGW(TAG,
"Got bad data from T6615! Magic was %02X and address was %02X", response_buffer[0],
64 const uint16_t ppm =
encode_uint16(response_buffer[3], response_buffer[4]);
65 ESP_LOGD(TAG,
"T6615 Received CO₂=%uppm", ppm);
89 ESP_LOGCONFIG(TAG,
"T6615:");
const float DATA
For components that import data from directly connected sensors like DHT.
optional< std::array< uint8_t, N > > read_array()
void write_array(const uint8_t *data, size_t len)
void status_set_warning(const char *message="unspecified")
void write_byte(uint8_t data)
void dump_config() override
uint32_t IRAM_ATTR HOT millis()
void check_uart_settings(uint32_t baud_rate, uint8_t stop_bits=1, UARTParityOptions parity=UART_CONFIG_PARITY_NONE, uint8_t data_bits=8)
Check that the configuration of the UART bus matches the provided values and otherwise print a warnin...
void status_clear_warning()
void publish_state(float state)
Publish a new state to the front-end.
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb)
Encode a 16-bit value given the most and least significant byte.
Implementation of SPI Controller mode.
float get_setup_priority() const override
sensor::Sensor * co2_sensor_