mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	Add waveshare 2.7in V2 model (#5903)
This commit is contained in:
		| @@ -26,6 +26,9 @@ WaveshareEPaperTypeA = waveshare_epaper_ns.class_( | ||||
| WaveshareEPaper2P7In = waveshare_epaper_ns.class_( | ||||
|     "WaveshareEPaper2P7In", WaveshareEPaper | ||||
| ) | ||||
| WaveshareEPaper2P7InV2 = waveshare_epaper_ns.class_( | ||||
|     "WaveshareEPaper2P7InV2", WaveshareEPaper | ||||
| ) | ||||
| WaveshareEPaper2P9InB = waveshare_epaper_ns.class_( | ||||
|     "WaveshareEPaper2P9InB", WaveshareEPaper | ||||
| ) | ||||
| @@ -83,6 +86,7 @@ MODELS = { | ||||
|     "2.90inv2": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_2_9_IN_V2), | ||||
|     "gdey029t94": ("c", GDEY029T94), | ||||
|     "2.70in": ("b", WaveshareEPaper2P7In), | ||||
|     "2.70inv2": ("b", WaveshareEPaper2P7InV2), | ||||
|     "2.90in-b": ("b", WaveshareEPaper2P9InB), | ||||
|     "4.20in": ("b", WaveshareEPaper4P2In), | ||||
|     "4.20in-bv2": ("b", WaveshareEPaper4P2InBV2), | ||||
|   | ||||
| @@ -634,6 +634,59 @@ void WaveshareEPaper2P7In::dump_config() { | ||||
|   LOG_UPDATE_INTERVAL(this); | ||||
| } | ||||
|  | ||||
| void WaveshareEPaper2P7InV2::initialize() { | ||||
|   this->reset_(); | ||||
|   this->wait_until_idle_(); | ||||
|  | ||||
|   this->command(0x12);  // SWRESET | ||||
|   this->wait_until_idle_(); | ||||
|  | ||||
|   // SET WINDOWS | ||||
|   // XRAM_START_AND_END_POSITION | ||||
|   this->command(0x44); | ||||
|   this->data(0x00); | ||||
|   this->data(((get_width_internal() - 1) >> 3) & 0xFF); | ||||
|   // YRAM_START_AND_END_POSITION | ||||
|   this->command(0x45); | ||||
|   this->data(0x00); | ||||
|   this->data(0x00); | ||||
|   this->data((get_height_internal() - 1) & 0xFF); | ||||
|   this->data(((get_height_internal() - 1) >> 8) & 0xFF); | ||||
|  | ||||
|   // SET CURSOR | ||||
|   // XRAM_ADDRESS | ||||
|   this->command(0x4E); | ||||
|   this->data(0x00); | ||||
|   // YRAM_ADDRESS | ||||
|   this->command(0x4F); | ||||
|   this->data(0x00); | ||||
|   this->data(0x00); | ||||
|  | ||||
|   this->command(0x11);  // data entry mode | ||||
|   this->data(0x03); | ||||
| } | ||||
| void HOT WaveshareEPaper2P7InV2::display() { | ||||
|   this->command(0x24); | ||||
|   this->start_data_(); | ||||
|   this->write_array(this->buffer_, this->get_buffer_length_()); | ||||
|   this->end_data_(); | ||||
|  | ||||
|   // COMMAND DISPLAY REFRESH | ||||
|   this->command(0x22); | ||||
|   this->data(0xF7); | ||||
|   this->command(0x20); | ||||
| } | ||||
| int WaveshareEPaper2P7InV2::get_width_internal() { return 176; } | ||||
| int WaveshareEPaper2P7InV2::get_height_internal() { return 264; } | ||||
| void WaveshareEPaper2P7InV2::dump_config() { | ||||
|   LOG_DISPLAY("", "Waveshare E-Paper", this); | ||||
|   ESP_LOGCONFIG(TAG, "  Model: 2.7in V2"); | ||||
|   LOG_PIN("  Reset Pin: ", this->reset_pin_); | ||||
|   LOG_PIN("  DC Pin: ", this->dc_pin_); | ||||
|   LOG_PIN("  Busy Pin: ", this->busy_pin_); | ||||
|   LOG_UPDATE_INTERVAL(this); | ||||
| } | ||||
|  | ||||
| // ======================================================== | ||||
| //               2.90in Type B (LUT from OTP) | ||||
| // Datasheet: | ||||
|   | ||||
| @@ -160,6 +160,22 @@ class WaveshareEPaper2P7In : public WaveshareEPaper { | ||||
|   int get_height_internal() override; | ||||
| }; | ||||
|  | ||||
| class WaveshareEPaper2P7InV2 : public WaveshareEPaper { | ||||
|  public: | ||||
|   void initialize() override; | ||||
|  | ||||
|   void display() override; | ||||
|  | ||||
|   void dump_config() override; | ||||
|  | ||||
|   void deep_sleep() override { ; } | ||||
|  | ||||
|  protected: | ||||
|   int get_width_internal() override; | ||||
|  | ||||
|   int get_height_internal() override; | ||||
| }; | ||||
|  | ||||
| class GDEY029T94 : public WaveshareEPaper { | ||||
|  public: | ||||
|   void initialize() override; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user