From a5395c978c0bbe109e0f03e43fec3b53a61ed120 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 26 Feb 2022 20:37:09 +0000 Subject: [PATCH] Move m_LCD to CMiniDexed, does not build yet --- src/kernel.cpp | 20 +------------------- src/kernel.h | 5 ----- src/minidexed.cpp | 6 ++++++ src/minidexed.h | 21 +++++++++++++++++++-- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/kernel.cpp b/src/kernel.cpp index 78f86b2..3b0a502 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -7,18 +7,6 @@ #include #include "voices.c" -// HD44780 LCD configuration -#define COLUMNS 16 -#define ROWS 2 -// GPIO pins (Brcm numbering) -#define EN_PIN 17 // Enable -#define RS_PIN 18 // Register Select -#define RW_PIN 19 // Read/Write (set to 0 if not connected) -#define D4_PIN 22 // Data 4 -#define D5_PIN 23 // Data 5 -#define D6_PIN 24 // Data 6 -#define D7_PIN 25 // Data 7 - uint8_t fmpiano_sysex[156] = { 95, 29, 20, 50, 99, 95, 00, 00, 41, 00, 19, 00, 00, 03, 00, 06, 79, 00, 01, 00, 14, // OP6 eg_rate_1-4, level_1-4, kbd_lev_scl_brk_pt, kbd_lev_scl_lft_depth, kbd_lev_scl_rht_depth, kbd_lev_scl_lft_curve, kbd_lev_scl_rht_curve, kbd_rate_scaling, amp_mod_sensitivity, key_vel_sensitivity, operator_output_level, osc_mode, osc_freq_coarse, osc_freq_fine, osc_detune 95, 20, 20, 50, 99, 95, 00, 00, 00, 00, 00, 00, 00, 03, 00, 00, 99, 00, 01, 00, 00, // OP5 @@ -39,8 +27,7 @@ LOGMODULE ("kernel"); CKernel::CKernel (void) : CStdlibAppStdio ("minidexed"), m_I2CMaster (CMachineInfo::Get ()->GetDevice (DeviceI2CMaster), TRUE), - m_pDexed (0), - m_LCD (COLUMNS, ROWS, D4_PIN, D5_PIN, D6_PIN, D7_PIN, EN_PIN, RS_PIN, RW_PIN) + m_pDexed (0) { // mActLED.Blink (5); // show we are alive } @@ -56,11 +43,6 @@ bool CKernel::Initialize (void) return FALSE; } - if (!m_LCD.Initialize ()) - { - return FALSE; - } - // select the sound device const char *pSoundDevice = mOptions.GetSoundDevice (); if (strcmp (pSoundDevice, "sndi2s") == 0) diff --git a/src/kernel.h b/src/kernel.h index 1fbbf6f..2802979 100644 --- a/src/kernel.h +++ b/src/kernel.h @@ -7,7 +7,6 @@ #include "circle_stdlib_app.h" #include #include "minidexed.h" -#include enum TShutdownMode { @@ -26,14 +25,10 @@ public: TShutdownMode Run (void); -private: - void LCDWrite (const char *pString); - private: // do not change this order CI2CMaster m_I2CMaster; CMiniDexed *m_pDexed; - CHD44780Device m_LCD; }; #endif \ No newline at end of file diff --git a/src/minidexed.cpp b/src/minidexed.cpp index 5d2893d..2a55ab3 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -30,6 +30,12 @@ bool CMiniDexed::Initialize (void) return false; } + + if (!m_LCD.Initialize ()) + { + return FALSE; + } + m_bUseSerial = true; activate(); diff --git a/src/minidexed.h b/src/minidexed.h index 251addc..6f9b180 100644 --- a/src/minidexed.h +++ b/src/minidexed.h @@ -16,6 +16,7 @@ #include #include #include "pckeyboard.h" +#include #define SAMPLE_RATE 48000 @@ -24,6 +25,18 @@ #define DAC_I2C_ADDRESS 0 // I2C slave address of the DAC (0 for auto probing) +// HD44780 LCD configuration +#define COLUMNS 16 +#define ROWS 2 +// GPIO pins (Brcm numbering) +#define EN_PIN 17 // Enable +#define RS_PIN 18 // Register Select +#define RW_PIN 19 // Read/Write (set to 0 if not connected) +#define D4_PIN 22 // Data 4 +#define D5_PIN 23 // Data 5 +#define D6_PIN 24 // Data 6 +#define D7_PIN 25 // Data 7 + class CMiniDexed : public Dexed { public: @@ -33,14 +46,18 @@ class CMiniDexed : public Dexed m_PCKeyboard (this), m_Serial (pInterrupt, TRUE), m_bUseSerial (FALSE), - m_nSerialState (0) + m_nSerialState (0), + m_LCD (COLUMNS, ROWS, D4_PIN, D5_PIN, D6_PIN, D7_PIN, EN_PIN, RS_PIN, RW_PIN) { s_pThis = this; }; virtual bool Initialize (void); void Process(boolean bPlugAndPlayUpdated); - + private: + void LCDWrite (const char *pString); + private: + CHD44780Device m_LCD; protected: static void MIDIPacketHandler (unsigned nCable, u8 *pPacket, unsigned nLength); static void KeyStatusHandlerRaw (unsigned char ucModifiers, const unsigned char RawKeys[6]);