ESPHome 2025.9.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
4namespace esphome {
5namespace ssd1327_i2c {
6
7static const char *const TAG = "ssd1327_i2c";
8
10 this->init_reset_();
11
12 auto err = this->write(nullptr, 0);
13 if (err != i2c::ERROR_OK) {
14 this->error_code_ = COMMUNICATION_FAILED;
15 this->mark_failed();
16 return;
17 }
18
19 SSD1327::setup();
20}
22 LOG_DISPLAY("", "I2C SSD1327", this);
23 LOG_I2C_DEVICE(this);
24 ESP_LOGCONFIG(TAG, " Model: %s", this->model_str_());
25 LOG_PIN(" Reset Pin: ", this->reset_pin_);
26 LOG_UPDATE_INTERVAL(this);
27
28 if (this->error_code_ == COMMUNICATION_FAILED) {
29 ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
30 }
31}
32void I2CSSD1327::command(uint8_t value) { this->write_byte(0x00, value); }
34 for (uint32_t i = 0; i < this->get_buffer_length_();) {
35 uint8_t data[16];
36 for (uint8_t &j : data)
37 j = this->buffer_[i++];
38 this->write_bytes(0x40, data, sizeof(data));
39 }
40}
41
42} // namespace ssd1327_i2c
43} // namespace esphome
virtual void mark_failed()
Mark this component as failed.
bool write_bytes(uint8_t a_register, const uint8_t *data, uint8_t len, bool stop=true)
Definition i2c.h:252
ErrorCode write(const uint8_t *data, size_t len, bool stop=true)
writes an array of bytes to a device using an I2CBus
Definition i2c.h:190
bool write_byte(uint8_t a_register, uint8_t data, bool stop=true)
Definition i2c.h:266
void command(uint8_t value) override
@ ERROR_OK
No error found during execution of method.
Definition i2c_bus.h:13
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7