From d64bd4e614eb6d5d5bb68af2e198d0c05a412beb Mon Sep 17 00:00:00 2001 From: Dirk Niggemann Date: Mon, 21 Oct 2019 17:27:52 +0100 Subject: [PATCH] Adjust values for pull --- Disp_Plus.h | 6 +++--- MicroDexed.ino | 9 ++++++++- config.h | 8 +++++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Disp_Plus.h b/Disp_Plus.h index d415705..ae73c13 100644 --- a/Disp_Plus.h +++ b/Disp_Plus.h @@ -26,7 +26,7 @@ #ifndef DISP_PLUS_H_INCLUDED #define DISP_PLUS_H_INCLUDED -#define STRING_BUF_SIZE 21 +#define STRING_BUFFER_SIZE 21 template class Disp_Plus : public T @@ -42,7 +42,7 @@ class Disp_Plus : public T void show(uint8_t y, uint8_t x, uint8_t fs, long num) { - char _buf10[STRING_BUF_SIZE]; + char _buf10[STRING_BUFFER_SIZE]; _show(y, x, fs, itoa(num, _buf10, 10), true, true); } @@ -51,7 +51,7 @@ class Disp_Plus : public T void _show(uint8_t pos_y, uint8_t pos_x, uint8_t field_size, const char *str, bool justify_right, bool fill_zero) { { - char tmp[STRING_BUF_SIZE]; + char tmp[STRING_BUFFER_SIZE]; char *s = tmp; uint8_t l = strlen(str); diff --git a/MicroDexed.ino b/MicroDexed.ino index 2c2bf35..475edd6 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -164,18 +164,22 @@ extern LCDMenuLib2 LCDML; extern uint8_t menu_state; #endif +#ifdef DISPLAY_LCD_SPI void change_disp_sd(bool disp) { digitalWrite(SDCARD_CS_PIN, disp); digitalWrite(U8X8_CS_PIN, !disp); } +#endif void setup() { //while (!Serial) ; // wait for Arduino Serial Monitor Serial.begin(SERIAL_SPEED); +#ifdef DISPLAY_LCD_SPI pinMode(SDCARD_CS_PIN, OUTPUT); pinMode(U8X8_CS_PIN, OUTPUT); +#endif #ifdef ENABLE_LCD_UI setup_ui(); @@ -251,7 +255,9 @@ void setup() SPI.setMOSI(SDCARD_MOSI_PIN); SPI.setSCK(SDCARD_SCK_PIN); #endif +#ifdef DISPLAY_LCD_SPI change_disp_sd(false); +#endif if (!SD.begin(SDCARD_CS_PIN)) { Serial.println(F("SD card not accessable.")); @@ -290,7 +296,9 @@ void setup() // load default SYSEX data load_sysex(configuration.bank, configuration.voice); } +#ifdef DISPLAY_LCD_SPI change_disp_sd(true); +#endif // Init effects if (!modchorus.begin(delayline, MOD_DELAY_SAMPLE_BUFFER)) { Serial.println(F("AudioEffectModulatedDelay - right channel begin failed")); @@ -426,7 +434,6 @@ void loop() { #ifdef ENABLE_LCD_UI // LCD Menu - delay(1); LCDML.loop(); // initial starts voice selection menu as default diff --git a/config.h b/config.h index a99a1b9..e7a1a23 100644 --- a/config.h +++ b/config.h @@ -110,17 +110,23 @@ //* UI //************************************************************************************************* #define ENABLE_LCD_UI 1 +// LCD Display +//I2C_DISPLAY only #define LCD_I2C_ADDRESS 0x3f +//Display size, must be set for U8X8 as well #define LCD_cols 16 #define LCD_rows 4 -// LCD Display +//enable U8X8 support #define U8X8_DISPLAY +//enable SPI CS switching +#define DISPLAY_LCD_SPI #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 +//Standard 16x2 LCD display (SPI/PCF8874) //#define I2C_DISPLAY // [I2C] SCL: Pin 19, SDA: Pin 18 (https://www.pjrc.com/teensy/td_libs_Wire.html) //#define LCD_GFX 1