diff --git a/src/kernel.cpp b/src/kernel.cpp index f8d5338..78f86b2 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -7,6 +7,18 @@ #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 @@ -27,7 +39,8 @@ LOGMODULE ("kernel"); CKernel::CKernel (void) : CStdlibAppStdio ("minidexed"), m_I2CMaster (CMachineInfo::Get ()->GetDevice (DeviceI2CMaster), TRUE), - m_pDexed (0) + m_pDexed (0), + m_LCD (COLUMNS, ROWS, D4_PIN, D5_PIN, D6_PIN, D7_PIN, EN_PIN, RS_PIN, RW_PIN) { // mActLED.Blink (5); // show we are alive } @@ -43,6 +56,11 @@ 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) @@ -90,4 +108,4 @@ CStdlibApp::TShutdownMode CKernel::Run (void) } return ShutdownHalt; -} +} \ No newline at end of file diff --git a/src/kernel.h b/src/kernel.h index 1018013..1fbbf6f 100644 --- a/src/kernel.h +++ b/src/kernel.h @@ -7,6 +7,7 @@ #include "circle_stdlib_app.h" #include #include "minidexed.h" +#include enum TShutdownMode { @@ -25,10 +26,14 @@ 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 +#endif \ No newline at end of file diff --git a/src/minidexed.cpp b/src/minidexed.cpp index ddf1e28..ee77078 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -314,4 +314,4 @@ unsigned CMiniDexedHDMI::GetChunk(u32 *pBuffer, unsigned nChunkSize) #endif return(nResult); -}; +}; \ No newline at end of file