mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 15:38:11 +01:00
Splitting setup function
This commit is contained in:
parent
963e8e9be6
commit
57d7204a09
3 changed files with 13 additions and 9 deletions
|
@ -86,7 +86,11 @@ void WaveshareEPaper2P13InV3::send_reset_() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveshareEPaper2P13InV3::setup() {
|
void WaveshareEPaper2P13InV3::setup() {
|
||||||
setup_pins_();
|
this->init_internal_(this->get_buffer_length_());
|
||||||
|
this->setup_pins_();
|
||||||
|
this->spi_setup();
|
||||||
|
this->reset_();
|
||||||
|
|
||||||
delay(20);
|
delay(20);
|
||||||
this->send_reset_();
|
this->send_reset_();
|
||||||
// as a one-off delay this is not worth working around.
|
// as a one-off delay this is not worth working around.
|
||||||
|
|
|
@ -111,8 +111,14 @@ static const uint8_t PARTIAL_UPD_2IN9_LUT[PARTIAL_UPD_2IN9_LUT_SIZE] =
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
void WaveshareEPaperBase::setup_pins_() {
|
void WaveshareEPaperBase::setup() {
|
||||||
this->init_internal_(this->get_buffer_length_());
|
this->init_internal_(this->get_buffer_length_());
|
||||||
|
this->setup_pins_();//was in setup
|
||||||
|
this->spi_setup();
|
||||||
|
this->reset_();
|
||||||
|
this->initialize();//was in setup
|
||||||
|
}
|
||||||
|
void WaveshareEPaperBase::setup_pins_() {
|
||||||
this->dc_pin_->setup(); // OUTPUT
|
this->dc_pin_->setup(); // OUTPUT
|
||||||
this->dc_pin_->digital_write(false);
|
this->dc_pin_->digital_write(false);
|
||||||
if (this->reset_pin_ != nullptr) {
|
if (this->reset_pin_ != nullptr) {
|
||||||
|
@ -122,9 +128,6 @@ void WaveshareEPaperBase::setup_pins_() {
|
||||||
if (this->busy_pin_ != nullptr) {
|
if (this->busy_pin_ != nullptr) {
|
||||||
this->busy_pin_->setup(); // INPUT
|
this->busy_pin_->setup(); // INPUT
|
||||||
}
|
}
|
||||||
this->spi_setup();
|
|
||||||
|
|
||||||
this->reset_();
|
|
||||||
}
|
}
|
||||||
float WaveshareEPaperBase::get_setup_priority() const { return setup_priority::PROCESSOR; }
|
float WaveshareEPaperBase::get_setup_priority() const { return setup_priority::PROCESSOR; }
|
||||||
void WaveshareEPaperBase::command(uint8_t value) {
|
void WaveshareEPaperBase::command(uint8_t value) {
|
||||||
|
|
|
@ -27,10 +27,7 @@ class WaveshareEPaperBase : public display::DisplayBuffer,
|
||||||
|
|
||||||
void update() override;
|
void update() override;
|
||||||
|
|
||||||
void setup() override {
|
void setup() override;
|
||||||
this->setup_pins_();
|
|
||||||
this->initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_safe_shutdown() override;
|
void on_safe_shutdown() override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue