1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - MB - demos - multiboot-Model
3   File:     common.h
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 #ifndef MB_DEMO_COMMON_H_
18 #define MB_DEMO_COMMON_H_
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #ifdef SDK_TWL
25 #include	<twl.h>
26 #else
27 #include	<nitro.h>
28 #endif
29 
30 //============================================================================
31 //  Function Declarations
32 //============================================================================
33 
34 void    CommonInit();
35 void    ReadKey(void);
36 u16     GetPressKey(void);
37 u16     GetTrigKey(void);
38 void    InitAllocateSystem(void);
39 
40 /*---------------------------------------------------------------------------*
41   Name:         IS_PAD_PRESS
42 
43   Description:  Key determination
44 
45   Arguments:    Key flag to determine
46 
47   Returns:      TRUE if specified key is pressed
48                 Otherwise, FALSE
49  *---------------------------------------------------------------------------*/
IS_PAD_PRESS(u16 flag)50 static inline BOOL IS_PAD_PRESS(u16 flag)
51 {
52     return (GetPressKey() & flag) == flag;
53 }
54 
55 /*---------------------------------------------------------------------------*
56   Name:         IS_PAD_TRIGGER
57 
58   Description:  Determines key trigger
59 
60   Arguments:    Key flag to determine
61 
62   Returns:      If specified key trigger is enabled, TRUE
63                 Otherwise, FALSE
64  *---------------------------------------------------------------------------*/
IS_PAD_TRIGGER(u16 flag)65 static inline BOOL IS_PAD_TRIGGER(u16 flag)
66 {
67     return (GetTrigKey() & flag) == flag;
68 }
69 
70 
71 #ifdef __cplusplus
72 }/* extern "C" */
73 #endif
74 
75 #endif // MB_DEMO_COMMON_H_
76