From e4e5eb7ef666f37b29e2e906501e6e7ba20e0fe1 Mon Sep 17 00:00:00 2001 From: Dirk Niggemann Date: Wed, 16 Oct 2019 10:02:17 +0100 Subject: [PATCH] SSD1306 support --- Disp_Plus.h | 4 ++-- UI.hpp | 21 +++++++++++++++++---- config.h | 2 ++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Disp_Plus.h b/Disp_Plus.h index 4e872cf..d415705 100644 --- a/Disp_Plus.h +++ b/Disp_Plus.h @@ -70,8 +70,8 @@ class Disp_Plus : public T strncpy(s, str, l); //setCursor(pos_x * getMaxCharWidth(), pos_y * getMaxCharHeight()); - setCursor(pos_x, pos_y ); - print(tmp); + this->setCursor(pos_x, pos_y ); + this->print(tmp); #ifdef DEBUG Serial.print(pos_y, DEC); diff --git a/UI.hpp b/UI.hpp index bda5f9e..76fedf6 100644 --- a/UI.hpp +++ b/UI.hpp @@ -27,12 +27,14 @@ #define _UI_HPP_ #include "config.h" -#ifdef I2C_DISPLAY +#include "Disp_Plus.h" +/* #ifdef I2C_DISPLAY #include "LiquidCrystalPlus_I2C.h" #endif #ifdef U8X8_DISPLAY #include "SSD1322_Plus.h" #endif + */ #include #include @@ -67,12 +69,23 @@ extern value_change_t soften_filter_cut; elapsedMillis back_from_volume; #ifdef I2C_DISPLAY -LiquidCrystalPlus_I2C lcd(LCD_I2C_ADDRESS, _LCDML_DISP_cols, _LCDML_DISP_rows); +#include +//LiquidCrystalPlus_I2C lcd(LCD_I2C_ADDRESS, _LCDML_DISP_cols, _LCDML_DISP_rows); +Disp_Plus lcd(LCD_I2C_ADDRESS, _LCDML_DISP_cols, _LCDML_DISP_rows); #endif #ifdef U8X8_DISPLAY -SSD1322_Plus lcd(/* cs=*/ U8X8_CS_PIN, /* dc=*/ U8X8_DC_PIN, /* reset=*/ U8X8_RESET_PIN); -#endif +#include +#ifdef U8X8_HAVE_HW_SPI +#include +#endif +#ifdef U8X8_HAVE_HW_I2C +#include +#endif +//SSD1322_Plus lcd(/* cs=*/ U8X8_CS_PIN, /* dc=*/ U8X8_DC_PIN, /* reset=*/ U8X8_RESET_PIN); +Disp_Plus lcd(/* cs=*/ U8X8_CS_PIN, /* dc=*/ U8X8_DC_PIN, /* reset=*/ U8X8_RESET_PIN); +//Disp_Plus lcd(U8X8_PIN_NONE); +#endif const uint8_t scroll_bar[5][8] = { {B10001, B10001, B10001, B10001, B10001, B10001, B10001, B10001}, // scrollbar top diff --git a/config.h b/config.h index a58b1d1..f794d5b 100644 --- a/config.h +++ b/config.h @@ -115,6 +115,8 @@ // LCD Display #define U8X8_DISPLAY +#define U8X8_DISPLAY_CLASS U8X8_SSD1322_NHD_256X64_4W_HW_SPI +//#define U8X8_DISPLAY_CLASS U8X8_SSD1306_128X64_NONAME_HW_I2C #define U8X8_CS_PIN 9 #define U8X8_DC_PIN 15 #define U8X8_RESET_PIN 14