mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 07:28:10 +01:00
Using custom init_internal_ for 7C
This commit is contained in:
parent
57d7204a09
commit
c61c390e2e
3 changed files with 13 additions and 5 deletions
|
@ -25,7 +25,7 @@ class DisplayBuffer : public Display {
|
|||
protected:
|
||||
virtual void draw_absolute_pixel_internal(int x, int y, Color color) = 0;
|
||||
|
||||
virtual void init_internal_(uint32_t buffer_length);
|
||||
void init_internal_(uint32_t buffer_length);
|
||||
|
||||
uint8_t *buffer_{nullptr};
|
||||
};
|
||||
|
|
|
@ -113,10 +113,10 @@ static const uint8_t PARTIAL_UPD_2IN9_LUT[PARTIAL_UPD_2IN9_LUT_SIZE] =
|
|||
|
||||
void WaveshareEPaperBase::setup() {
|
||||
this->init_internal_(this->get_buffer_length_());
|
||||
this->setup_pins_();//was in setup
|
||||
this->setup_pins_();
|
||||
this->spi_setup();
|
||||
this->reset_();
|
||||
this->initialize();//was in setup
|
||||
this->initialize();
|
||||
}
|
||||
void WaveshareEPaperBase::setup_pins_() {
|
||||
this->dc_pin_->setup(); // OUTPUT
|
||||
|
@ -177,7 +177,14 @@ void WaveshareEPaper::fill(Color color) {
|
|||
for (uint32_t i = 0; i < this->get_buffer_length_(); i++)
|
||||
this->buffer_[i] = fill;
|
||||
}
|
||||
void WaveshareEPaper7C::init_internal_(uint32_t buffer_length) {
|
||||
void WaveshareEPaper7C::setup() {
|
||||
this->init_internal_7c_(this->get_buffer_length_());
|
||||
this->setup_pins_();
|
||||
this->spi_setup();
|
||||
this->reset_();
|
||||
this->initialize();
|
||||
}
|
||||
void WaveshareEPaper7C::init_internal_7c_(uint32_t buffer_length) {
|
||||
ExternalRAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE);
|
||||
uint32_t small_buffer_length = buffer_length / NUM_BUFFERS;
|
||||
|
||||
|
|
|
@ -93,7 +93,8 @@ class WaveshareEPaper7C : public WaveshareEPaperBase {
|
|||
protected:
|
||||
void draw_absolute_pixel_internal(int x, int y, Color color) override;
|
||||
uint32_t get_buffer_length_() override;
|
||||
void init_internal_(uint32_t buffer_length);
|
||||
void setup() override;
|
||||
void init_internal_7c_(uint32_t buffer_length);
|
||||
|
||||
static const int NUM_BUFFERS = 10;
|
||||
uint8_t *buffers_[NUM_BUFFERS];
|
||||
|
|
Loading…
Reference in a new issue