From 54c1ed199789a1ba4683e021615d223c434eaaa2 Mon Sep 17 00:00:00 2001 From: bsongis Date: Sat, 7 Apr 2012 07:35:23 +0000 Subject: [PATCH] Optrex LCD support --- src/audio.cpp | 4 ++++ src/general_menus.cpp | 20 +++++++++++++++++++- src/lcd.cpp | 2 +- src/myeeprom.h | 2 +- src/simpgmspace.h | 1 - 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/audio.cpp b/src/audio.cpp index 88fafff41..17dabc74e 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -58,6 +58,10 @@ bool audioQueue::freeslots(uint8_t slots) // it is called every 10ms void audioQueue::heartbeat() { +#if defined(SIMU) + return; +#endif + #if defined(PCBARM) if (toneTimeLeft) { diff --git a/src/general_menus.cpp b/src/general_menus.cpp index fea1afd9e..f8c7dacb4 100644 --- a/src/general_menus.cpp +++ b/src/general_menus.cpp @@ -73,6 +73,9 @@ const MenuFuncP_PROGMEM menuTabDiag[] PROGMEM = { enum menuProcSetupItems { ITEM_SETUP_BASE=18, +#ifdef PCBARM + ITEM_SETUP_OPTREX, +#endif #ifdef AUDIO ITEM_SETUP_SPEAKER, #endif @@ -115,9 +118,14 @@ void menuProcSetup(uint8_t event) #define FRSKY_ZEROS 0, 0, 0, #else #define FRSKY_ZEROS +#endif +#ifdef PCBARM +#define OPTREX_ZEROS 0, +#else +#define OPTREX_ZEROS #endif - MENU(STR_MENURADIOSETUP, menuTabDiag, e_Setup, ITEM_SETUP_MAX+1, {0, 0, 0, AUDIO_ZEROS HAPTIC_ZEROS 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, SPLASH_ZEROS 0, 0, 0, 0, FRSKY_ZEROS 0, (uint8_t)-1, 1}); + MENU(STR_MENURADIOSETUP, menuTabDiag, e_Setup, ITEM_SETUP_MAX+1, {0, 0, 0, AUDIO_ZEROS HAPTIC_ZEROS OPTREX_ZEROS 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, SPLASH_ZEROS 0, 0, 0, 0, FRSKY_ZEROS 0, (uint8_t)-1, 1}); int8_t sub = m_posVert; uint8_t y = 1*FH; @@ -171,6 +179,16 @@ void menuProcSetup(uint8_t event) }subN++; #endif +// TODO port onoffMenuItem here to save flash +#if defined(PCBARM) + if(s_pgOfs7*FH) return; + }subN++; +#endif + if(s_pgOfsPIO_OER = 0x0C00B0FFL; // Set bits 27,26,15,13,12,7-0 output #endif for (y = 0; y < 8; y++) { - lcdSendCtl(/*TODO g_eeGeneral.optrexDisplay ? 0 : */0x04); + lcdSendCtl(g_eeGeneral.optrexDisplay ? 0 : 0x04); lcdSendCtl(0x10); //column addr 0 lcdSendCtl(y | 0xB0); //page addr y diff --git a/src/myeeprom.h b/src/myeeprom.h index 02a86887e..52ee27794 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -111,7 +111,7 @@ PACK(typedef struct t_EEGeneral { uint8_t disableAlarmWarning:1; uint8_t stickMode:2; int8_t timezone:5; - uint8_t spare2:1; + uint8_t optrexDisplay:1; uint8_t inactivityTimer; uint8_t throttleReversed:1; uint8_t minuteBeep:1; diff --git a/src/simpgmspace.h b/src/simpgmspace.h index c512f4ed3..a7a01fb0c 100644 --- a/src/simpgmspace.h +++ b/src/simpgmspace.h @@ -254,7 +254,6 @@ extern uint32_t Master_frequency; #define NVIC_DisableIRQ(x) #define __disable_irq() #define __enable_irq() -#define AUDIO_HEARTBEAT() #endif extern volatile unsigned char pinb,pinc,pind,pine,ping,pinh,pinj,pinl;