Skip to content

Instantly share code, notes, and snippets.

@bjarkevad
Created June 21, 2014 22:06
Show Gist options
  • Save bjarkevad/b0b35981efb0a9999a62 to your computer and use it in GitHub Desktop.
Save bjarkevad/b0b35981efb0a9999a62 to your computer and use it in GitHub Desktop.
ByteString
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