Created
June 21, 2014 22:06
-
-
Save bjarkevad/b0b35981efb0a9999a62 to your computer and use it in GitHub Desktop.
ByteString
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Binary.Put | |
import GHC.Word | |
data HeartBeat = HeartBeat { | |
typet :: Word8, | |
autopilot :: Word8, | |
basemode :: Word8, | |
custommode :: Word32, | |
systemstatus :: Word8, | |
version :: Word8 | |
} | |
serializeHeartBeat :: HeartBeat -> Put | |
serializeHeartBeat h = do | |
putWord32be $ custommode h | |
putWord8 $ typet h | |
putWord8 $ autopilot h | |
putWord8 $ basemode h | |
putWord8 $ systemstatus h | |
putWord8 $ version h | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment