Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add tilt control.

  • Loading branch information...
commit 94783acf4e9890471b6e1875973859a03f79be6e 1 parent 2a47e8c
@chrisdone authored
Showing with 12 additions and 0 deletions.
  1. +8 −0 src/Freenect.hs
  2. +4 −0 src/Freenect/FFI.hs
View
8 src/Freenect.hs
@@ -19,6 +19,7 @@ module Freenect
,setLogLevel
,setDepthCallback
,startDepth
+ ,setTiltDegrees
,Context
,FreenectException(..)
,Subdevice(..)
@@ -65,6 +66,7 @@ data FreenectException
| ProcessEvents -- ^ Call to process events failed.
| OpenDeviceFailed Integer -- ^ Opening a device failed.
| StartDepthProblem -- ^ Problem starting the depth stream.
+ | UnableToSetTilt -- ^ Unable to set the tilt.
deriving (Show,Typeable)
instance Exception FreenectException
@@ -208,3 +210,9 @@ startDepth :: Device -> IO ()
startDepth = withD $ \ptr -> succeed StartDepthProblem (return ()) $ do
ptr <- peek ptr
freenect_start_depth ptr
+
+-- | Start the depth information stream for a device.
+setTiltDegrees :: Double -> Device -> IO ()
+setTiltDegrees angle = withD $ \ptr -> succeed UnableToSetTilt (return ()) $ do
+ ptr <- peek ptr
+ freenect_set_tilt_degs ptr (realToFrac angle)
View
4 src/Freenect/FFI.hs
@@ -64,6 +64,10 @@ foreign import ccall
freenect_start_depth :: Ptr DeviceStruct
-> IO CInt
+foreign import ccall
+ "freenect.h freenect_set_tilt_degs"
+ freenect_set_tilt_degs :: Ptr DeviceStruct -> CDouble -> IO CInt
+
--------------------------------------------------------------------------------
-- Helpers.
Please sign in to comment.
Something went wrong with that request. Please try again.