1 /*---------------------------------------------------------------------------*
2 Project: TwlSDK - MB - demos - multiboot-PowerSave
3 File: common.c
4
5 Copyright 2006-2008 Nintendo. All rights reserved.
6
7 These coded instructions, statements, and computer programs contain
8 proprietary information of Nintendo of America Inc. and/or Nintendo
9 Company Ltd., and are protected by Federal copyright law. They may
10 not be disclosed to third parties or copied or duplicated in any form,
11 in whole or in part, without the prior written consent of Nintendo.
12
13 $Date:: 2008-09-18#$
14 $Rev: 8573 $
15 $Author: okubata_ryoma $
16 *---------------------------------------------------------------------------*/
17
18
19 #ifdef SDK_TWL
20 #include <twl.h>
21 #else
22 #include <nitro.h>
23 #endif
24 #include "common.h"
25
26
27 /*****************************************************************************/
28 /* Variables */
29
30 BOOL g_power_save_mode;
31
32
33 /*****************************************************************************/
34 /* Functions */
35
36 /*---------------------------------------------------------------------------*
37 Name: ReadKeySetTrigger
38
39 Description: Detect key trigger.
40
41 Arguments: None.
42
43 Returns: The bit set of key input that was NOT pressed the last time this function was called but was pressed during this function call.
44
45 *---------------------------------------------------------------------------*/
ReadKeySetTrigger(void)46 u16 ReadKeySetTrigger(void)
47 {
48 /* Measures to handle A button presses inside IPL */
49 static u16 cont = 0xffff;
50 u16 keyset = PAD_Read();
51 u16 trigger = (u16)(keyset & (keyset ^ cont));
52 cont = keyset;
53 return trigger;
54 }
55