1 /*---------------------------------------------------------------------------*
2   Project:  WPAD
3   File:     wpadBalance.h
4 
5   Copyright (C) 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  *---------------------------------------------------------------------------*/
14 
15 #ifndef __WPAD_BALANCE_H__
16 #define __WPAD_BALANCE_H__
17 
18 #include <cafe/pads/wpad/wpad.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #define WPAD_PRESS_UNITS            4
25 #define WPAD_DEV_BALANCE_CHECKER    3
26 #define WPAD_FMT_BALANCE_CHECKER    12      // buttons + balance checker
27 
28 typedef struct WPADBLStatus
29 {
30     u16       button;                       // Or-ed WPAD_BUTTON_* bits
31     s16       accX;                         // -WPAD_ACC_RESO/2 <= accX < WPAD_ACC_RESO/2
32     s16       accY;                         // -WPAD_ACC_RESO/2 <= accY < WPAD_ACC_RESO/2
33     s16       accZ;                         // -WPAD_ACC_RESO/2 <= accZ < WPAD_ACC_RESO/2
34     DPDObject obj[WPAD_DPD_MAX_OBJECTS];
35 
36     u8        dev;                          // one of WPAD_DEV_* number
37     s8        err;                          // one of WPAD_ERR_* number
38 
39     u16       press[WPAD_PRESS_UNITS];
40     s8        temp;                         // temperature
41     u8        battery;                      // battery
42 
43 } WPADBLStatus;
44 
45 #define WPAD_BLCMD_ON               0xaa
46 #define WPAD_BLCMD_OFF              0x55
47 #define WPAD_BLCMD_UPDATE_TEMP      0x00
48 
49 s32  WPADControlBLC( s32 chan, u8  command, WPADCallback callback );
50 
51 #define WPAD_BLCLB_BLK1_ADDR        0x0024
52 #define WPAD_BLCLB_BLK1_LEN         16
53 #define WPAD_BLCLB_BLK2_ADDR        0x0034
54 #define WPAD_BLCLB_BLK2_LEN         8
55 #define WPAD_BLCLB_BLK3_ADDR        0x003c
56 #define WPAD_BLCLB_BLK3_LEN         4
57 #define WPAD_BLCLB_BLK4_ADDR        0x0050
58 #define WPAD_BLCLB_BLK4_LEN         16
59 #define WPAD_BLCLB_BLK5_ADDR        0x0060
60 #define WPAD_BLCLB_BLK5_LEN         16
61 
62 s32  WPADGetBLCalibration( s32 chan, u8 *data, u16 addr, u16 len, WPADCallback callback );
63 
64 BOOL WPADIsRegisteredBLC( void );                   // DEPRECATED
65 void WPADRegisterBLCWorkarea( void *workarea );     // DEPRECATED
66 
67 #define WPAD_BLCINT_WORK_LEN        307200
68 
69 
70 BOOL WPADIsEnabledWBC( void );  // move to wpadBalance.h
71 void WPADEnableWBC              ( void );
72 
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 #endif // __WPAD_BALANCE_H__
78 
79