packages feed

freenect 1.1.1 → 1.2

raw patch · 3 files changed

+32/−4 lines, 3 files

Files

freenect.cabal view
@@ -1,12 +1,12 @@ Name:                freenect-Version:             1.1.1+Version:             1.2 Synopsis:            Interface to the Kinect device. Description:         Interface to the Kinect device. Currently supports                      depth perception. (No video or audio.) Homepage:            https://github.com/chrisdone/freenect License:             BSD3 License-file:        LICENSE-Author:              Chris Done+Author:              Chris Done, Kevin Conley, Chris Müller Maintainer:          chrisdone@gmail.com Copyright:           Chris Done Category:            Graphics@@ -23,7 +23,7 @@   Exposed-Modules:   Freenect Freenect.FFI   Ghc-options:       -O2   Build-depends:     base > 4 && < 5, vector-  Includes:          libfreenect.h libfreenect_sync.h+  Includes:          libfreenect.h   Extra-libraries:   freenect, freenect_sync   C-sources:         cbits/freenect-helpers.c   Include-dirs:      cbits
src/Freenect.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ViewPatterns #-}+{-# LANGUAGE ViewPatterns, BangPatterns #-} {-# OPTIONS -fno-warn-name-shadowing #-} {-# LANGUAGE DeriveDataTypeable #-} @@ -35,6 +35,7 @@        ,setDepthCallback        ,startDepth        ,setTiltDegrees+       ,setLed        ,setVideoMode        ,setDepthMode        ,Context@@ -42,6 +43,7 @@        ,FreenectException(..)        ,Subdevice(..)        ,LogLevel(..)+       ,Led(..)        ,Resolution(..)        ,VideoFormat(..)        ,DepthFormat(..))@@ -89,6 +91,7 @@   | StartVideoProblem        -- ^ Problem starting the video stream.   | StartDepthProblem        -- ^ Problem starting the depth stream.   | UnableToSetTilt          -- ^ Unable to set the tilt.+  | UnableToSetLed           -- ^ Unable to set active led   | SetVideoMode             -- ^ Unable to set the video mode.   | VideoModeNotSet          -- ^ TODO, not used: You didn't set the video mode.   | SetDepthMode             -- ^ Unable to set the depth mode.@@ -319,6 +322,27 @@                                         (fromIntegral (fromEnum fmt))   succeed SetDepthMode (return ()) $     set_freenect_depth_mode dptr frameMode++data Led +  = Off+  | Green+  | Red+  | Yellow+  | BlinkGreen+  | BlinkRedYellow+  deriving (Enum,Show,Eq)++-- | Sets the current LED state for the specified device+setLed :: Device -> Led -> IO ()+setLed d led = flip withD d $ \ptr -> do+   ptr <- peek ptr+   succeed UnableToSetLed (return ()) $+      -- BlinkGreen is 4 and 5, BlinkRedYellow is 6 (see libfreenect.h)+      freenect_set_led ptr (if ledcode == 5 then 6 else ledcode)+   where+   ledcode = (fromIntegral (fromEnum led))++  -- $contexts -- 
src/Freenect/FFI.hs view
@@ -85,6 +85,10 @@   "freenect.h freenect_set_tilt_degs"   freenect_set_tilt_degs :: Ptr DeviceStruct -> CDouble -> IO CInt ++foreign import ccall+   "freenect.h freenect_set_led"+   freenect_set_led :: Ptr DeviceStruct -> CInt -> IO CInt -------------------------------------------------------------------------------- -- Helpers.