ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
ssd1327_i2c.cpp
Go to the documentation of this file.
1#include "ssd1327_i2c.h"
2#include "esphome/core/log.h"
3
5
6static const char *const TAG = "ssd1327_i2c";
7
9 this->init_reset_();
10
11 auto err = this->write(nullptr, 0);
12 if (err != i2c::ERROR_OK) {
13 this->error_code_ = COMMUNICATION_FAILED;
14 this->mark_failed();
15 return;
16 }
17
18 SSD1327::setup();
19}
21 LOG_DISPLAY("", "I2C SSD1327", this);
22 LOG_I2C_DEVICE(this);
23 ESP_LOGCONFIG(TAG, " Model: %s", this->model_str_());
24 LOG_PIN(" Reset Pin: ", this->reset_pin_);
25 LOG_UPDATE_INTERVAL(this);
26
27 if (this->error_code_ == COMMUNICATION_FAILED) {
28 ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
29 }
30}
31void I2CSSD1327::command(uint8_t value) { this->write_byte(0x00, value); }
33 for (uint32_t i = 0; i < this->get_buffer_length_();) {
34 uint8_t data[16];
35 for (uint8_t &j : data)
36 j = this->buffer_[i++];
37 this->write_bytes(0x40, data, sizeof(data));
38 }
39}
40
41} // namespace esphome::ssd1327_i2c
void mark_failed()
Mark this component as failed.
ErrorCode write(const uint8_t *data, size_t len) const
writes an array of bytes to a device using an I2CBus
Definition i2c.h:183
bool write_byte(uint8_t a_register, uint8_t data) const
Definition i2c.h:265
bool write_bytes(uint8_t a_register, const uint8_t *data, uint8_t len) const
Definition i2c.h:251
void command(uint8_t value) override
@ ERROR_OK
No error found during execution of method.
Definition i2c_bus.h:14
static void uint32_t