Added acceleration
This commit is contained in:
parent
6e96cdf9ea
commit
2ce242f608
1 changed files with 20 additions and 1 deletions
|
@ -12,6 +12,7 @@ module HWiid ( BDAddr(..)
|
||||||
, hwiidFlagNonblock
|
, hwiidFlagNonblock
|
||||||
, hwiidReportStatus
|
, hwiidReportStatus
|
||||||
, hwiidReportButtons
|
, hwiidReportButtons
|
||||||
|
, hwiidReportAcc
|
||||||
, hwiidReportIR
|
, hwiidReportIR
|
||||||
, hwiidReportNunchuk
|
, hwiidReportNunchuk
|
||||||
, hwiidReportExt
|
, hwiidReportExt
|
||||||
|
@ -32,6 +33,8 @@ module HWiid ( BDAddr(..)
|
||||||
, hwiidButtonPlus
|
, hwiidButtonPlus
|
||||||
, hwiidNunchukButtonZ
|
, hwiidNunchukButtonZ
|
||||||
, hwiidNunchukButtonC
|
, hwiidNunchukButtonC
|
||||||
|
, hwiidIRMaxX
|
||||||
|
, hwiidIRMaxY
|
||||||
, hwiidMesgTypeStatus
|
, hwiidMesgTypeStatus
|
||||||
, hwiidMesgTypeButton
|
, hwiidMesgTypeButton
|
||||||
, hwiidExtNone
|
, hwiidExtNone
|
||||||
|
@ -73,6 +76,9 @@ hwiidReportStatus = (#const CWIID_RPT_STATUS)
|
||||||
hwiidReportButtons :: Word8
|
hwiidReportButtons :: Word8
|
||||||
hwiidReportButtons = (#const CWIID_RPT_BTN)
|
hwiidReportButtons = (#const CWIID_RPT_BTN)
|
||||||
|
|
||||||
|
hwiidReportAcc :: Word8
|
||||||
|
hwiidReportAcc = (#const CWIID_RPT_ACC)
|
||||||
|
|
||||||
hwiidReportIR :: Word8
|
hwiidReportIR :: Word8
|
||||||
hwiidReportIR = (#const CWIID_RPT_IR)
|
hwiidReportIR = (#const CWIID_RPT_IR)
|
||||||
|
|
||||||
|
@ -137,6 +143,13 @@ hwiidNunchukButtonC :: Word16
|
||||||
hwiidNunchukButtonC = (#const CWIID_NUNCHUK_BTN_C)
|
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 :: (#type enum cwiid_mesg_type)
|
||||||
hwiidMesgTypeStatus = (#const CWIID_MESG_STATUS)
|
hwiidMesgTypeStatus = (#const CWIID_MESG_STATUS)
|
||||||
|
|
||||||
|
@ -204,6 +217,9 @@ data WiimoteState = WiimoteState
|
||||||
, stateRumble :: Word8
|
, stateRumble :: Word8
|
||||||
, stateBattery :: Word8
|
, stateBattery :: Word8
|
||||||
, stateButtons :: Word16
|
, stateButtons :: Word16
|
||||||
|
, stateAccX :: Word8
|
||||||
|
, stateAccY :: Word8
|
||||||
|
, stateAccZ :: Word8
|
||||||
, stateIRSources :: [WiimoteIRSource]
|
, stateIRSources :: [WiimoteIRSource]
|
||||||
, stateExt :: WiimoteExtState
|
, stateExt :: WiimoteExtState
|
||||||
} deriving (Eq, Show)
|
} deriving (Eq, Show)
|
||||||
|
@ -217,10 +233,13 @@ instance Storable WiimoteState where
|
||||||
rumble <- (#peek struct cwiid_state, rumble) state
|
rumble <- (#peek struct cwiid_state, rumble) state
|
||||||
battery <- (#peek struct cwiid_state, battery) state
|
battery <- (#peek struct cwiid_state, battery) state
|
||||||
buttons <- (#peek struct cwiid_state, buttons) 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
|
irSources <- peekArray (#const CWIID_IR_SRC_COUNT) $ (#ptr struct cwiid_state, ir_src) state
|
||||||
exttype <- (#peek struct cwiid_state, ext_type) state
|
exttype <- (#peek struct cwiid_state, ext_type) state
|
||||||
extstate <- peekExtState exttype $ (#ptr struct cwiid_state, ext) 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"
|
poke _ _ = fail "Can't write WiimoteState"
|
||||||
|
|
||||||
|
|
Reference in a new issue