ESPHome 2025.9.0-dev
Loading...
Searching...
No Matches
ssd1331_spi.cpp
Go to the documentation of this file.
1#include "ssd1331_spi.h"
2#include "esphome/core/log.h"
4
5namespace esphome {
6namespace ssd1331_spi {
7
8static const char *const TAG = "ssd1331_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 SSD1331::setup();
19}
21 LOG_DISPLAY("", "SPI SSD1331", this);
22 LOG_PIN(" CS Pin: ", this->cs_);
23 LOG_PIN(" DC Pin: ", this->dc_pin_);
24 LOG_PIN(" Reset Pin: ", this->reset_pin_);
25 ESP_LOGCONFIG(TAG, " Initial Brightness: %.2f", this->brightness_);
26 LOG_UPDATE_INTERVAL(this);
27}
28void SPISSD1331::command(uint8_t value) {
29 if (this->cs_)
30 this->cs_->digital_write(true);
31 this->dc_pin_->digital_write(false);
32 delay(1);
33 this->enable();
34 if (this->cs_)
35 this->cs_->digital_write(false);
36 this->write_byte(value);
37 if (this->cs_)
38 this->cs_->digital_write(true);
39 this->disable();
40}
42 if (this->cs_)
43 this->cs_->digital_write(true);
44 this->dc_pin_->digital_write(true);
45 if (this->cs_)
46 this->cs_->digital_write(false);
47 delay(1);
48 this->enable();
49 this->write_array(this->buffer_, this->get_buffer_length_());
50 if (this->cs_)
51 this->cs_->digital_write(true);
52 this->disable();
53}
54
55} // namespace ssd1331_spi
56} // namespace esphome
virtual void setup()=0
virtual void digital_write(bool value)=0
void command(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