ESPHome  2024.3.2
gp8403.cpp
Go to the documentation of this file.
1 #include "gp8403.h"
2 
3 #include "esphome/core/log.h"
4 
5 namespace esphome {
6 namespace gp8403 {
7 
8 static const char *const TAG = "gp8403";
9 
10 static const uint8_t RANGE_REGISTER = 0x01;
11 
12 void GP8403::setup() { this->write_register(RANGE_REGISTER, (uint8_t *) (&this->voltage_), 1); }
13 
15  ESP_LOGCONFIG(TAG, "GP8403:");
16  ESP_LOGCONFIG(TAG, " Voltage: %dV", this->voltage_ == GP8403_VOLTAGE_5V ? 5 : 10);
17  LOG_I2C_DEVICE(this);
18 }
19 
20 } // namespace gp8403
21 } // namespace esphome
GP8403Voltage voltage_
Definition: gp8403.h:23
void setup() override
Definition: gp8403.cpp:12
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
ErrorCode write_register(uint8_t a_register, const uint8_t *data, size_t len, bool stop=true)
writes an array of bytes to a specific register in the I²C device
Definition: i2c.cpp:25
void dump_config() override
Definition: gp8403.cpp:14