NXT 0.2.1 → 0.2.2
raw patch · 2 files changed
+12/−12 lines, 2 filesdep ~NXT
Dependency ranges changed: NXT
Files
- NXT.cabal +6/−6
- lib/Robotics/NXT/Data.hs +6/−6
NXT.cabal view
@@ -1,5 +1,5 @@ Name: NXT -Version: 0.2.1 +Version: 0.2.2 Synopsis: A Haskell interface to Lego Mindstorms NXT Description: A Haskell interface to Lego Mindstorms NXT over Bluetoooth. It supports direct commands, messages and many sensors (also unofficial). It has also support for a simple message-based control of a NXT brick @@ -16,7 +16,7 @@ License-file: LICENSE Author: Mitar Milutinovic Maintainer: mitar.haskell@tnode.com -Copyright: (c) 2011 Mitar Milutinovic +Copyright: (c) 2011-2012 Mitar Milutinovic Category: Robotics Build-type: Simple Cabal-version: >= 1.10 @@ -69,7 +69,7 @@ HS-source-dirs: src Build-depends: base >= 4.3 && < 5, mtl >= 1.1 && < 3, - NXT == 0.2.1 + NXT == 0.2.2 GHC-options: -Wall Default-language: Haskell2010 @@ -78,7 +78,7 @@ HS-source-dirs: src Build-depends: base >= 4.3 && < 5, mtl >= 1.1 && < 3, - NXT == 0.2.1 + NXT == 0.2.2 GHC-options: -Wall Default-language: Haskell2010 @@ -89,7 +89,7 @@ mtl >= 1.1 && < 3, bytestring >= 0.9 && < 1, filepath >= 1.1 && < 2, - NXT == 0.2.1 + NXT == 0.2.2 GHC-options: -Wall Default-language: Haskell2010 @@ -106,7 +106,7 @@ time >= 1.2 && < 2, bytestring >= 0.9 && < 1.0, filepath >= 1.2 && < 2, - NXT == 0.2.1 + NXT == 0.2.2 GHC-options: -Wall -rtsopts Default-language: Haskell2010 HS-source-dirs: tests
lib/Robotics/NXT/Data.hs view
@@ -74,30 +74,30 @@ where getByte 0x00 = Nothing getByte y = Just (fromIntegral $ y `mod` 0x100, y `div` 0x100) -toUByte :: Integral a => a -> [Word8] -- one byte, unsigned+toUByte :: (Show a, Integral a) => a -> [Word8] -- one byte, unsigned toUByte x | x >= 0x00 && x <= 0xFF = intToData x | otherwise = throw . PatternMatchFail $ "toUByte: " ++ show x -toUWord :: Integral a => a -> [Word8] -- two bytes, unsigned, least significant byte first+toUWord :: (Show a, Integral a) => a -> [Word8] -- two bytes, unsigned, least significant byte first toUWord x | x >= 0x00 && x <= 0xFFFF = take 2 . flip (++) (repeat 0x00) . intToData $ x | otherwise = throw . PatternMatchFail $ "toUWord: " ++ show x -toULong :: Integral a => a -> [Word8] -- four bytes, unsigned, least significant byte first+toULong :: (Show a, Integral a) => a -> [Word8] -- four bytes, unsigned, least significant byte first toULong x | x' >= 0x00 && x' <= 0xFFFFFFFF = take 4 . flip (++) (repeat 0x00) . intToData $ x' | otherwise = throw . PatternMatchFail $ "toULong: " ++ show x where x' = fromIntegral x :: Integer -toSByte :: Integral a => a -> [Word8] -- one byte, signed+toSByte :: (Show a, Integral a) => a -> [Word8] -- one byte, signed toSByte x | x >= (-0x80) && x < 0x00 = intToData $ 0x100 + x | x >= 0x00 && x <= 0x7F = intToData x | otherwise = throw . PatternMatchFail $ "toSByte: " ++ show x -toSWord :: Integral a => a -> [Word8] -- two bytes, signed, least significant byte first+toSWord :: (Show a, Integral a) => a -> [Word8] -- two bytes, signed, least significant byte first toSWord x | x >= (-0x8000) && x < 0x00 = take 2 . flip (++) (repeat 0x00) . intToData $ 0x10000 + x | x >= 0x00 && x <= 0x7FFF = take 2 . flip (++) (repeat 0x00) . intToData $ x | otherwise = throw . PatternMatchFail $ "toSWord: " ++ show x -toSLong :: Integral a => a -> [Word8] -- four bytes, signed, least significant byte first+toSLong :: (Show a, Integral a) => a -> [Word8] -- four bytes, signed, least significant byte first toSLong x | x' >= (-0x80000000) && x' < 0x00 = take 4 . flip (++) (repeat 0x00) . intToData $ 0x100000000 + x' | x' >= 0x00 && x' <= 0x7FFFFFFF = take 4 . flip (++) (repeat 0x00) . intToData $ x' | otherwise = throw . PatternMatchFail $ "toSLong: " ++ show x