ESPHome 2026.5.1
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
6
7static const char *const TAG = "ssd1331_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 SSD1331::setup();
18}
20 LOG_DISPLAY("", "SPI SSD1331", this);
21 LOG_PIN(" CS Pin: ", this->cs_);
22 LOG_PIN(" DC Pin: ", this->dc_pin_);
23 LOG_PIN(" Reset Pin: ", this->reset_pin_);
24 ESP_LOGCONFIG(TAG, " Initial Brightness: %.2f", this->brightness_);
25 LOG_UPDATE_INTERVAL(this);
26}
27void SPISSD1331::command(uint8_t value) {
28 if (this->cs_)
29 this->cs_->digital_write(true);
30 this->dc_pin_->digital_write(false);
31 delay(1);
32 this->enable();
33 if (this->cs_)
34 this->cs_->digital_write(false);
35 this->write_byte(value);
36 if (this->cs_)
37 this->cs_->digital_write(true);
38 this->disable();
39}
41 if (this->cs_)
42 this->cs_->digital_write(true);
43 this->dc_pin_->digital_write(true);
44 if (this->cs_)
45 this->cs_->digital_write(false);
46 delay(1);
47 this->enable();
48 this->write_array(this->buffer_, this->get_buffer_length_());
49 if (this->cs_)
50 this->cs_->digital_write(true);
51 this->disable();
52}
53
54} // namespace esphome::ssd1331_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:85