diff -r 000000000000 -r 5de814552237 navienginebsp/ne1_tb/specific/keypad.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/navienginebsp/ne1_tb/specific/keypad.cpp Tue Sep 28 18:00:05 2010 +0100 @@ -0,0 +1,254 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* ne1_tb\specific\keypad.cpp +* This file contains the implementation of Keypad for the NEC LCD. +* +*/ + + + +#include +#include +#include +#include +#include +#include "lcdgce.h" + + +// =-==LCD keypad settings and registers================== +const TUint KKeybPollTime = 100; +const TUint KHWKeyRL = KHwFPGABase + 0x0410; // Key return line +const TUint KHWKeySR = KHwFPGABase + 0x0418; // Key scan register + +// Scan codes for buttons: (scan_register_value | (1<ProcessKey(KHwKeyNumArrowUp, ((key & KHwKeyCodeArrowUp )==KHwKeyCodeArrowUp )); + pD->ProcessKey(KHwKeyNumArrowRight, ((key & KHwKeyCodeArrowRight )==KHwKeyCodeArrowRight )); + pD->ProcessKey(KHwKeyNumArrowLeft, ((key & KHwKeyCodeArrowLeft )==KHwKeyCodeArrowLeft )); + pD->ProcessKey(KHwKeyNumArrowDown, ((key & KHwKeyCodeArrowDown )==KHwKeyCodeArrowDown )); + pD->ProcessKey(KHwKeyNumButtonCentre, ((key & KHwKeyCodeButtonCentre)==KHwKeyCodeButtonCentre)); + pD->ProcessKey(KHwKeyNumButtonLeft, ((key & KHwKeyCodeButtonLeft )==KHwKeyCodeButtonLeft )); + pD->ProcessKey(KHwKeyNumButtonRight, ((key & KHwKeyCodeButtonRight )==KHwKeyCodeButtonRight )); + + pD->iKeyboardTimer.Again(KKeybPollTime); + } + +DNE1Keypad::DNE1Keypad() : + iKeyboardTimer(GetScanCodes, this), + iKeyStates(0) + { + TUint idMode = AsspRegister::Read32(KHwIDMODE); + TUint keyMode = (idMode & KHmKeyConfigSwitch) >> KHsKeyConfigSwitch; + + switch (keyMode) + { + default: + case 0: iKeyMode = EKeyModeTechview; break; + case 1: iKeyMode = EKeyModeS60; break; + } + } + +TInt DNE1Keypad::DoCreate() + { + iKeyboardTimer.OneShot(KKeybPollTime, ETrue); + return KErrNone; + } + + +DECLARE_STANDARD_EXTENSION() + { + // check the display mode - and if LCD is not on + // (any of ANALOG modes is set)- do not create/start the driver.. + TInt r = KErrNoMemory; + TInt mode = ReadDipSwitchDisplayMode(); + if(mode == DISPLAY_MODE_ANALOG_VGA || + mode == DISPLAY_MODE_ANALOG_QVGA_LANDSCAPE_OLD || + mode == DISPLAY_MODE_ANALOG_QVGA_PORTRAIT || + mode == DISPLAY_MODE_ANALOG_QVGA_LANDSCAPE) + { + __KTRACE(Kern::Printf("keypad.cpp: LCD panel not switched on...\nwill not start the driver")); + r = KErrNone; // just return.. + } + else + { + DNE1Keypad* pD= new DNE1Keypad; + if (pD) + r = pD->DoCreate(); + } + + return r; + }