12static constexpr uint8_t REG_TMST_VALUE = 0x00;
13static constexpr uint8_t REG_ENABLE = 0x01;
14static constexpr uint8_t REG_VCOM1 = 0x03;
15static constexpr uint8_t REG_VCOM2 = 0x04;
16static constexpr uint8_t REG_INT1 = 0x07;
17static constexpr uint8_t REG_INT2 = 0x08;
18static constexpr uint8_t REG_TMST1 = 0x0D;
19static constexpr uint8_t REG_PG = 0x0F;
20static constexpr uint8_t REG_REVID = 0x10;
23static constexpr uint8_t ENABLE_ALL_RAILS = 0x3F;
25static constexpr uint8_t PG_PIN_RAILS = 0x5A;
27static constexpr uint8_t PG_ALL_RAILS = 0xFA;
29static constexpr uint8_t VCOM2_RESET_BITS = 0x04;
30static constexpr uint8_t TMST1_READ_THERM = 0x80;
31static constexpr uint8_t TMST1_CONV_END = 0x20;
34static constexpr uint32_t WAKEUP_DELAY_MS = 3;
35static constexpr uint32_t POWER_UP_TIMEOUT_MS = 500;
36static constexpr uint32_t CONVERSION_TIMEOUT_MS = 100;
38static constexpr uint32_t POWER_DOWN_MS = 81;
40static constexpr uint32_t SLEEP_ENTRY_MS = POWER_DOWN_MS + 100;
48 delay(WAKEUP_DELAY_MS);
170 ESP_LOGV(TAG,
"Rails up in %" PRIu32
" ms", now - this->
state_start_);
177 if (this->
write_byte(REG_ENABLE, ENABLE_ALL_RAILS)) {
204 uint8_t mask = PG_ALL_RAILS;
212 return this->
read_byte(REG_PG, &pg) && (pg & mask) == mask;
240 ESP_LOGW(TAG,
"Power up timed out: PG 0x%02X, INT1 0x%02X, INT2 0x%02X", pg, int1, int2);
242 ESP_LOGW(TAG,
"Power up timed out; status registers unreadable");
254#ifdef USE_TPS65185_TEMPERATURE
255void TPS65185::request_temperature() {
257 if (this->temperature_sensor_ ==
nullptr)
264 this->temperature_sensor_->publish_state(NAN);
277#ifdef USE_TPS65185_TEMPERATURE
283 this->temperature_sensor_->publish_state(NAN);
288#ifdef USE_TPS65185_TEMPERATURE
294 if (!this->
write_byte(REG_TMST1, TMST1_READ_THERM))
304 if ((tmst1 & TMST1_CONV_END) == 0) {
315 this->temperature_sensor_->publish_state(
static_cast<int8_t
>(
value));
uint32_t IRAM_ATTR HOT get_loop_component_start_time() const
Get the cached time in milliseconds from when the current component started its loop execution.
void status_set_warning()
void enable_loop()
Enable this component's loop.
bool ESPHOME_ALWAYS_INLINE setup_check(bool ok)
Marks the component failed with message (default "Communication failed") unless ok; returns ok.
void disable_loop()
Disable this component's loop.
void status_clear_warning()
virtual void digital_write(bool value)=0
virtual bool digital_read()=0
void set(bool active)
Run the loop continuously while active is true. Repeating the current value does nothing.
void start()
Start running the loop continuously.
ErrorCode read(uint8_t *data, size_t len) const
reads an array of bytes from the device using an I2CBus
bool write_byte(uint8_t a_register, uint8_t data) const
bool read_byte(uint8_t a_register, uint8_t *data)
TemperatureRead temperature_read_
HighFrequencyLoopRequester high_freq_
void request_power(bool on)
GPIOPin * power_good_pin_
void on_powerdown() override
PowerState get_power_state() const
bool handle_temperature_(uint32_t now)
void dump_config() override
void dump_config() override
@ CHIP_STATE_POWERING_DOWN
ESPHOME_LOG_TAG(TAG, "tps65185")
@ TEMPERATURE_READ_CONVERTING
@ TEMPERATURE_READ_REQUESTED
void setup_output_pin(GPIOPin *pin, bool level)
Set up pin and drive it to level. Does nothing when pin is null, so an optional pin needs no check.
void HOT delay(uint32_t ms)
uint32_t IRAM_ATTR HOT millis()
Application App
Global storage of Application pointer - only one Application can exist.