ESPHome 2026.5.0b1
Loading...
Searching...
No Matches
ssd1327_spi.cpp
Go to the documentation of this file.
1#include "ssd1327_spi.h"
2#include "esphome/core/log.h"
4
6
7static const char *const TAG = "ssd1327_spi";
8
10 this->spi_setup();
11 this->dc_pin_->setup(); // OUTPUT
12 if (this->cs_)
13 this->cs_->setup(); // OUTPUT
14
15 this->init_reset_();
16 delay(500); // NOLINT
17 SSD1327::setup();
18}
20 LOG_DISPLAY("", "SPI SSD1327", this);
21 ESP_LOGCONFIG(TAG,
22 " Model: %s\n"
23 " Initial Brightness: %.2f",
24 this->model_str_(), this->brightness_);
25 LOG_PIN(" CS Pin: ", this->cs_);
26 LOG_PIN(" DC Pin: ", this->dc_pin_);
27 LOG_PIN(" Reset Pin: ", this->reset_pin_);
28 LOG_UPDATE_INTERVAL(this);
29}
30void SPISSD1327::command(uint8_t value) {
31 if (this->cs_)
32 this->cs_->digital_write(true);
33 this->dc_pin_->digital_write(false);
34 delay(1);
35 this->enable();
36 if (this->cs_)
37 this->cs_->digital_write(false);
38 this->write_byte(value);
39 if (this->cs_)
40 this->cs_->digital_write(true);
41 this->disable();
42}
44 if (this->cs_)
45 this->cs_->digital_write(true);
46 this->dc_pin_->digital_write(true);
47 if (this->cs_)
48 this->cs_->digital_write(false);
49 delay(1);
50 this->enable();
51 this->write_array(this->buffer_, this->get_buffer_length_());
52 if (this->cs_)
53 this->cs_->digital_write(true);
54 this->disable();
55}
56
57} // namespace esphome::ssd1327_spi
virtual void setup()=0
virtual void digital_write(bool value)=0
void command(uint8_t value) override
void HOT delay(uint32_t ms)
Definition hal.cpp:82