1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     hid_DebugPadReader.h
4 
5   Copyright (C)2009 Nintendo Co., Ltd.  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   $Rev: 35857 $
14  *---------------------------------------------------------------------------*/
15 
16 /* Please see man pages for details
17 
18 
19 */
20 #ifndef NN_HID_CTR_HID_DEBUG_PAD_READER_H_
21 #define NN_HID_CTR_HID_DEBUG_PAD_READER_H_
22 
23 #include <nn/Handle.h>
24 #include <nn/Result.h>
25 #include <nn/types.h>
26 #include <nn/hid/CTR/hid_Result.h>
27 #include <nn/hid/CTR/hid_Api.h>
28 #include <nn/hid/CTR/hid_pad.h>
29 #include <nn/hid/CTR/hid_DeviceStatus.h>
30 #include <nn/util/util_SizedEnum.h>
31 #include <nn/util/util_NonCopyable.h>
32 
33 namespace nn {
34 namespace hid {
35 namespace CTR {
36 /* Please see man pages for details
37 
38 
39 
40 
41 
42 */
43 
44 class DebugPadReader : private nn::util::NonCopyable<DebugPadReader>
45 {
46 public:
47     /* Please see man pages for details
48 
49 
50      */
51 
52     typedef enum
53     {
54         /* Please see man pages for details */
55         STICK_CLAMP_MODE_CIRCLE_WITH_PLAY = 0,
56         /* Please see man pages for details */
57         STICK_CLAMP_MODE_CIRCLE_WITHOUT_PLAY
58     } StickClampMode;
59 
60     /* Please see man pages for details
61 
62 
63 
64 
65 
66 
67     */
68     DebugPadReader(DebugPad& debugPad=GetDebugPad( ))
m_DebugPad(debugPad)69         : m_DebugPad(debugPad)
70         , m_IndexOfRead(-1)
71         , m_IsReadLatestFirst(true)
72         , m_StickClampMode(STICK_CLAMP_MODE_CIRCLE_WITH_PLAY)
73         , m_TickOfRead(-1)
74         {};
75 
76     /* Please see man pages for details
77 
78 
79     */
~DebugPadReader()80     ~DebugPadReader( ) {};
81 
82     /* Please see man pages for details
83 
84 
85 
86 
87 
88 
89 
90     */
91     void Read(DebugPadStatus* pBufs, s32* pReadLen, s32 bufLen);
92 
93     /* Please see man pages for details
94 
95 
96 
97 
98 
99 
100 
101 
102 
103     */
104     bool ReadLatest(DebugPadStatus* pBuf);
105 
106     /* Please see man pages for details
107 
108 
109 
110 
111     */
112     StickClampMode GetStickClampMode( ) const;
113 
114     /* Please see man pages for details
115 
116 
117 
118 
119 
120 
121 
122 
123     */
124     void SetStickClampMode(StickClampMode mode);
125 
126 protected:
127     DebugPad&           m_DebugPad;
128     s32                 m_IndexOfRead;
129     bit16               m_LatestHold;
130     bool                m_IsReadLatestFirst;
131     nn::util::SizedEnum1<StickClampMode>      m_StickClampMode;
132     NN_PADDING4;
133     s64                 m_TickOfRead;
134 };
135 
136 
137 // inline definitions
138 
GetStickClampMode()139 inline DebugPadReader::StickClampMode DebugPadReader::GetStickClampMode( ) const
140 {
141     return m_StickClampMode;
142 }
143 
SetStickClampMode(DebugPadReader::StickClampMode mode)144 inline void DebugPadReader::SetStickClampMode(DebugPadReader::StickClampMode mode)
145 {
146     m_StickClampMode = mode;
147 }
148 
149 } // namespace CTR {
150 } // namespace hid {
151 } // namespace nn {
152 
153 #endif  // #ifndef NN_HID_CTR_HID_DEBUG_PAD_READER_H_
154