ESPHome
2024.10.2
esphome
esphome
components
gp8403
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
14
void
GP8403::dump_config
() {
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
esphome::gp8403::GP8403::voltage_
GP8403Voltage voltage_
Definition:
gp8403.h:23
esphome::gp8403::GP8403::setup
void setup() override
Definition:
gp8403.cpp:12
gp8403.h
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
esphome::i2c::I2CDevice::write_register
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
log.h
esphome::gp8403::GP8403::dump_config
void dump_config() override
Definition:
gp8403.cpp:14
esphome::gp8403::GP8403_VOLTAGE_5V
Definition:
gp8403.h:10
Generated by
1.8.13