Skip to content

Commit

Permalink
Adds rumble control.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanperez-keera committed May 1, 2014
1 parent 73c9978 commit 03d4deb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion System/CWiid.hsc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{-# LANGUAGE ForeignFunctionInterface #-}

module System.CWiid
(cwiidOpen, cwiidSetLed, cwiidSetRptMode, cwiidGetBtnState,
(cwiidOpen, cwiidSetLed, cwiidSetRptMode, cwiidSetRumble,
cwiidGetBtnState,
cwiidLed1, cwiidLed2, cwiidLed3, cwiidLed4, combineCwiidLedFlag,
cwiidBtn2, cwiidBtn1, cwiidBtnB, cwiidBtnA, cwiidBtnMinus,
cwiidBtnHome, cwiidBtnLeft, cwiidBtnRight, cwiidBtnDown, cwiidBtnUp,
Expand Down Expand Up @@ -136,6 +137,10 @@ cwiidSetRptMode :: CWiidWiimote -> IO CInt
cwiidSetRptMode wm = c_cwiid_set_rpt_mode handle 2 -- set BTN
where handle = unCWiidWiimote wm

cwiidSetRumble :: CWiidWiimote -> CUChar -> IO CInt
cwiidSetRumble wm rm = c_cwiid_set_rumble handle rm
where handle = unCWiidWiimote wm

cwiidGetBtnState :: CWiidWiimote -> IO CWiidBtnFlag
cwiidGetBtnState wm =
alloca $ \wiState -> do
Expand Down Expand Up @@ -163,6 +168,10 @@ foreign import ccall safe "cwiid_set_led" c_cwiid_set_led
foreign import ccall safe "cwiid_set_rpt_mode" c_cwiid_set_rpt_mode
:: Ptr () -> CUChar -> IO CInt

-- int cwiid_set_rumble(cwiid_wiimote_t *wiimote, uint8_t rumble);
foreign import ccall safe "cwiid_set_rumble" c_cwiid_set_rumble
:: Ptr () -> CUChar -> IO CInt

-- int cwiid_get_state(cwiid_wiimote_t *wiimote, struct cwiid_state *state);
foreign import ccall safe "cwiid_get_state" c_cwiid_get_state
:: Ptr () -> Ptr CWiidState -> IO CInt
Expand Down

0 comments on commit 03d4deb

Please sign in to comment.