summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/HWiid.hsc21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/HWiid.hsc b/src/HWiid.hsc
index 07a3a48..91b4ec8 100644
--- a/src/HWiid.hsc
+++ b/src/HWiid.hsc
@@ -12,6 +12,7 @@ module HWiid ( BDAddr(..)
, hwiidFlagNonblock
, hwiidReportStatus
, hwiidReportButtons
+ , hwiidReportAcc
, hwiidReportIR
, hwiidReportNunchuk
, hwiidReportExt
@@ -32,6 +33,8 @@ module HWiid ( BDAddr(..)
, hwiidButtonPlus
, hwiidNunchukButtonZ
, hwiidNunchukButtonC
+ , hwiidIRMaxX
+ , hwiidIRMaxY
, hwiidMesgTypeStatus
, hwiidMesgTypeButton
, hwiidExtNone
@@ -73,6 +76,9 @@ hwiidReportStatus = (#const CWIID_RPT_STATUS)
hwiidReportButtons :: Word8
hwiidReportButtons = (#const CWIID_RPT_BTN)
+hwiidReportAcc :: Word8
+hwiidReportAcc = (#const CWIID_RPT_ACC)
+
hwiidReportIR :: Word8
hwiidReportIR = (#const CWIID_RPT_IR)
@@ -137,6 +143,13 @@ hwiidNunchukButtonC :: Word16
hwiidNunchukButtonC = (#const CWIID_NUNCHUK_BTN_C)
+hwiidIRMaxX :: CInt
+hwiidIRMaxX = (#const CWIID_IR_X_MAX)
+
+hwiidIRMaxY :: CInt
+hwiidIRMaxY = (#const CWIID_IR_Y_MAX)
+
+
hwiidMesgTypeStatus :: (#type enum cwiid_mesg_type)
hwiidMesgTypeStatus = (#const CWIID_MESG_STATUS)
@@ -204,6 +217,9 @@ data WiimoteState = WiimoteState
, stateRumble :: Word8
, stateBattery :: Word8
, stateButtons :: Word16
+ , stateAccX :: Word8
+ , stateAccY :: Word8
+ , stateAccZ :: Word8
, stateIRSources :: [WiimoteIRSource]
, stateExt :: WiimoteExtState
} deriving (Eq, Show)
@@ -217,10 +233,13 @@ instance Storable WiimoteState where
rumble <- (#peek struct cwiid_state, rumble) state
battery <- (#peek struct cwiid_state, battery) state
buttons <- (#peek struct cwiid_state, buttons) state
+ accX <- (#peek struct cwiid_state, acc[0]) state
+ accY <- (#peek struct cwiid_state, acc[1]) state
+ accZ <- (#peek struct cwiid_state, acc[2]) state
irSources <- peekArray (#const CWIID_IR_SRC_COUNT) $ (#ptr struct cwiid_state, ir_src) state
exttype <- (#peek struct cwiid_state, ext_type) state
extstate <- peekExtState exttype $ (#ptr struct cwiid_state, ext) state
- return $ WiimoteState led rumble battery buttons (filter (\src -> (irValid src) /= 0) irSources) extstate
+ return $ WiimoteState led rumble battery buttons accX accY accZ (filter (\src -> (irValid src) /= 0) irSources) extstate
poke _ _ = fail "Can't write WiimoteState"