ESPHome 2025.9.0-dev
Loading...
Searching...
No Matches
ssd1351_spi.cpp
Go to the documentation of this file.
1#include "ssd1351_spi.h"
2#include "esphome/core/log.h"
4
5namespace esphome {
6namespace ssd1351_spi {
7
8static const char *const TAG = "ssd1351_spi";
9
11 this->spi_setup();
12 this->dc_pin_->setup(); // OUTPUT
13 if (this->cs_)
14 this->cs_->setup(); // OUTPUT
15
16 this->init_reset_();
17 delay(500); // NOLINT
18 SSD1351::setup();
19}
21 LOG_DISPLAY("", "SPI SSD1351", this);
22 ESP_LOGCONFIG(TAG, " Model: %s", this->model_str_());
23 LOG_PIN(" CS Pin: ", this->cs_);
24 LOG_PIN(" DC Pin: ", this->dc_pin_);
25 LOG_PIN(" Reset Pin: ", this->reset_pin_);
26 ESP_LOGCONFIG(TAG, " Initial Brightness: %.2f", this->brightness_);
27 LOG_UPDATE_INTERVAL(this);
28}
29void SPISSD1351::command(uint8_t value) {
30 if (this->cs_)
31 this->cs_->digital_write(true);
32 this->dc_pin_->digital_write(false);
33 delay(1);
34 this->enable();
35 if (this->cs_)
36 this->cs_->digital_write(false);
37 this->write_byte(value);
38 if (this->cs_)
39 this->cs_->digital_write(true);
40 this->disable();
41}
42void SPISSD1351::data(uint8_t value) {
43 if (this->cs_)
44 this->cs_->digital_write(true);
45 this->dc_pin_->digital_write(true);
46 delay(1);
47 this->enable();
48 if (this->cs_)
49 this->cs_->digital_write(false);
50 this->write_byte(value);
51 if (this->cs_)
52 this->cs_->digital_write(true);
53 this->disable();
54}
56 if (this->cs_)
57 this->cs_->digital_write(true);
58 this->dc_pin_->digital_write(true);
59 if (this->cs_)
60 this->cs_->digital_write(false);
61 delay(1);
62 this->enable();
63 this->write_array(this->buffer_, this->get_buffer_length_());
64 if (this->cs_)
65 this->cs_->digital_write(true);
66 this->disable();
67}
68
69} // namespace ssd1351_spi
70} // namespace esphome
virtual void setup()=0
virtual void digital_write(bool value)=0
void command(uint8_t value) override
void data(uint8_t value) override
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
void IRAM_ATTR HOT delay(uint32_t ms)
Definition core.cpp:29