TwlIPL/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/keypad.c
kamikawa c7e8f8228b Makeが通るように修正。
これまでNandInitializerRed の ARM7コードをほぼそのまま使用していましたが、製品技術部のリクエスト対応を実装するにつれ
SystemUpdater には実装すべきでないコードが増えきました。そのためARM7コードを独自に持つ形に変更しました。ビルドスイッチも増えすぎてかえって分雑なため。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1316 b08762b0-b915-fc4b-9d8c-17b2551a87ff
2008-05-12 10:47:28 +00:00

86 lines
2.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*---------------------------------------------------------------------------*
Project: TwlSDK - NandInitializer
File: keypad.c
Copyright 2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#include <twl.h>
#include "keypad.h"
/*---------------------------------------------------------------------------*
è<E28099>è`
*---------------------------------------------------------------------------*/
#define KEY_REPEAT_TRIGGER_START 20
#define KEY_REPEAT_TRIGGER_TERM 5
/*---------------------------------------------------------------------------*
“à•”•Ï<E280A2>è`
*---------------------------------------------------------------------------*/
static u16 Cont;
static u16 Trg;
static u16 Release;
static u16 RepeatTrg;
static u8 key = 60;
static int repeat_counter;
/*---------------------------------------------------------------------------*
“à•”ŠÖ<C5A0>è`
*---------------------------------------------------------------------------*/
void
kamiPadRead(void)
{
u16 ReadData;
ReadData = PAD_Read();
Trg = (u16)(ReadData & (ReadData ^ Cont));
Release = (u16)(Cont & (ReadData ^ Cont));
Cont = ReadData;
RepeatTrg = Trg;
if (++repeat_counter > (KEY_REPEAT_TRIGGER_START + KEY_REPEAT_TRIGGER_TERM))
{
repeat_counter = KEY_REPEAT_TRIGGER_START;
}
if (repeat_counter == KEY_REPEAT_TRIGGER_START)
{
RepeatTrg = ReadData;
}
if (!ReadData)
{
repeat_counter = 0;
}
}
BOOL
kamiPadIsTrigger(u16 key)
{
return (Trg & key)? TRUE : FALSE;
}
BOOL
kamiPadIsRepeatTrigger(u16 key)
{
return (RepeatTrg & key)? TRUE : FALSE;
}
BOOL
kamiPadIsPress(u16 key)
{
return (Cont & key)? TRUE : FALSE;
}