{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE RecordWildCards #-}
module SwiftNav.SBP.Mag
( module SwiftNav.SBP.Mag
) where
import BasicPrelude
import Control.Lens
import Control.Monad.Loops
import Data.Binary
import Data.Binary.Get
import Data.Binary.IEEE754
import Data.Binary.Put
import Data.ByteString.Lazy hiding (ByteString)
import Data.Int
import Data.Word
import SwiftNav.SBP.TH
import SwiftNav.SBP.Types
{-# ANN module ("HLint: ignore Use camelCase"::String) #-}
{-# ANN module ("HLint: ignore Redundant do"::String) #-}
{-# ANN module ("HLint: ignore Use newtype instead of data"::String) #-}
msgMagRaw :: Word16
msgMagRaw = 0x0902
data MsgMagRaw = MsgMagRaw
{ _msgMagRaw_tow :: !Word32
, _msgMagRaw_tow_f :: !Word8
, _msgMagRaw_mag_x :: !Int16
, _msgMagRaw_mag_y :: !Int16
, _msgMagRaw_mag_z :: !Int16
} deriving ( Show, Read, Eq )
instance Binary MsgMagRaw where
get = do
_msgMagRaw_tow <- getWord32le
_msgMagRaw_tow_f <- getWord8
_msgMagRaw_mag_x <- fromIntegral <$> getWord16le
_msgMagRaw_mag_y <- fromIntegral <$> getWord16le
_msgMagRaw_mag_z <- fromIntegral <$> getWord16le
pure MsgMagRaw {..}
put MsgMagRaw {..} = do
putWord32le _msgMagRaw_tow
putWord8 _msgMagRaw_tow_f
(putWord16le . fromIntegral) _msgMagRaw_mag_x
(putWord16le . fromIntegral) _msgMagRaw_mag_y
(putWord16le . fromIntegral) _msgMagRaw_mag_z
$(makeSBP 'msgMagRaw ''MsgMagRaw)
$(makeJSON "_msgMagRaw_" ''MsgMagRaw)
$(makeLenses ''MsgMagRaw)