mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	Added a function to load custom characters in LCD display (#3279)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
		| @@ -167,6 +167,13 @@ void LCDDisplay::strftime(uint8_t column, uint8_t row, const char *format, time: | ||||
| } | ||||
| void LCDDisplay::strftime(const char *format, time::ESPTime time) { this->strftime(0, 0, format, time); } | ||||
| #endif | ||||
| void LCDDisplay::loadchar(uint8_t location, uint8_t charmap[]) { | ||||
|   location &= 0x7;  // we only have 8 locations 0-7 | ||||
|   this->command_(LCD_DISPLAY_COMMAND_SET_CGRAM_ADDR | (location << 3)); | ||||
|   for (int i = 0; i < 8; i++) { | ||||
|     this->send(charmap[i], true); | ||||
|   } | ||||
| } | ||||
|  | ||||
| }  // namespace lcd_base | ||||
| }  // namespace esphome | ||||
|   | ||||
| @@ -51,6 +51,9 @@ class LCDDisplay : public PollingComponent { | ||||
|   void strftime(const char *format, time::ESPTime time) __attribute__((format(strftime, 2, 0))); | ||||
| #endif | ||||
|  | ||||
|   /// Load custom char to given location | ||||
|   void loadchar(uint8_t location, uint8_t charmap[]); | ||||
|  | ||||
|  protected: | ||||
|   virtual bool is_four_bit_mode() = 0; | ||||
|   virtual void write_n_bits(uint8_t value, uint8_t n) = 0; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user