⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keypad.c

📁 Windows CE 6.0 BSP for VOIP sample phone. Intel PXA270 platform.
💻 C
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
//  File: KeyPad.c
//
//  This file contains keypad functions for the bootloader.

#include <windows.h>
#include <halether.h>
#include "bulverde_base_regs.h"
#include <oal_memory.h>
#include "xllp_defs.h"
#include <xllp_clkmgr.h>
#include <xllp_gpio.h>
#include <xllp_keypad.h>
#include <blcommon.h>
#include "wait.h"

//
// GLOBALS
//
volatile XLLP_KEYPAD_REGS *g_pKeyPadRegs;


BOOL KeyPadInit()
{
    volatile XLLP_CLKMGR_T *p_CLKRegs;
    volatile XLLP_GPIO_T *p_GPIORegs;

    p_CLKRegs = (volatile XLLP_CLKMGR_T *) OALPAtoVA(BULVERDE_BASE_REG_PA_CLKMGR, FALSE);
    p_GPIORegs = (volatile XLLP_GPIO_T *) OALPAtoVA(BULVERDE_BASE_REG_PA_GPIO, FALSE);
    g_pKeyPadRegs = (volatile XLLP_KEYPAD_REGS *) OALPAtoVA(BULVERDE_BASE_REG_PA_KEYPAD, FALSE);

    p_CLKRegs->cken |= 0x1 << 19;

    Wait(50);

    if (XllpKeyPadConfigure((XLLP_KEYPAD_REGS *)g_pKeyPadRegs,  (XLLP_GPIO_T *)p_GPIORegs))
    {
        // ensure all interupts are disabled in the bootloader
        XllpSetUpKeyPadInterrupts((XLLP_KEYPAD_REGS *)g_pKeyPadRegs,  (XLLP_BOOL_T) 0);
    }

    return TRUE;
}

BOOL ReadKeyPad(UINT8 *pui8Data)
{
    BOOL bRet = FALSE;

    // Beyond disabling interrupts, the keys status register is also cached by this call.
    XllpSetUpKeyPadInterrupts((XLLP_KEYPAD_REGS *)g_pKeyPadRegs,  (XLLP_BOOL_T) 0);

    // Read the keypad scan code.
    bRet = (XllpReadScanCode((XLLP_KEYPAD_REGS *)g_pKeyPadRegs, pui8Data) == XLLP_TRUE ? TRUE : FALSE);

    return(bRet);
}




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -