ESPHome 2026.5.0b1
Loading...
Searching...
No Matches
ssd1325_spi.cpp
Go to the documentation of this file.
1#include "ssd1325_spi.h"
2#include "esphome/core/log.h"
4
6
7static const char *const TAG = "ssd1325_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 SSD1325::setup();
18}
20 LOG_DISPLAY("", "SPI SSD1325", this);
21 ESP_LOGCONFIG(TAG,
22 " Model: %s\n"
23 " Initial Brightness: %.2f\n"
24 " External VCC: %s",
25 this->model_str_(), this->brightness_, YESNO(this->external_vcc_));
26 LOG_PIN(" CS Pin: ", this->cs_);
27 LOG_PIN(" DC Pin: ", this->dc_pin_);
28 LOG_PIN(" Reset Pin: ", this->reset_pin_);
29 LOG_UPDATE_INTERVAL(this);
30}
31void SPISSD1325::command(uint8_t value) {
32 if (this->cs_)
33 this->cs_->digital_write(true);
34 this->dc_pin_->digital_write(false);
35 delay(1);
36 this->enable();
37 if (this->cs_)
38 this->cs_->digital_write(false);
39 this->write_byte(value);
40 if (this->cs_)
41 this->cs_->digital_write(true);
42 this->disable();
43}
45 if (this->cs_)
46 this->cs_->digital_write(true);
47 this->dc_pin_->digital_write(true);
48 if (this->cs_)
49 this->cs_->digital_write(false);
50 delay(1);
51 this->enable();
52 this->write_array(this->buffer_, this->get_buffer_length_());
53 if (this->cs_)
54 this->cs_->digital_write(true);
55 this->disable();
56}
57
58} // namespace esphome::ssd1325_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