ESPHome 2026.1.5
Loading...
Searching...
No Matches
ssd1322_spi.cpp
Go to the documentation of this file.
1#include "ssd1322_spi.h"
2#include "esphome/core/log.h"
4
5namespace esphome {
6namespace ssd1322_spi {
7
8static const char *const TAG = "ssd1322_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 SSD1322::setup();
19}
21 LOG_DISPLAY("", "SPI SSD1322", this);
22 ESP_LOGCONFIG(TAG,
23 " Model: %s\n"
24 " Initial Brightness: %.2f",
25 this->model_str_(), this->brightness_);
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 SPISSD1322::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}
44void SPISSD1322::data(uint8_t value) {
45 if (this->cs_)
46 this->cs_->digital_write(true);
47 this->dc_pin_->digital_write(true);
48 delay(1);
49 this->enable();
50 if (this->cs_)
51 this->cs_->digital_write(false);
52 this->write_byte(value);
53 if (this->cs_)
54 this->cs_->digital_write(true);
55 this->disable();
56}
58 if (this->cs_)
59 this->cs_->digital_write(true);
60 this->dc_pin_->digital_write(true);
61 if (this->cs_)
62 this->cs_->digital_write(false);
63 delay(1);
64 this->enable();
65 this->write_array(this->buffer_, this->get_buffer_length_());
66 if (this->cs_)
67 this->cs_->digital_write(true);
68 this->disable();
69}
70
71} // namespace ssd1322_spi
72} // 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:26