Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data XcpCommandId
- pid :: XcpCommandId -> Word8
- class Storable a => ToByteString a
- data XcpError = GenericError Word8
- xcpGet :: Word32 -> Word8 -> ByteString
- xcpSet :: ToByteString a => Word32 -> a -> ByteString
- xcpConnect :: ByteString
- xcpDisconnect :: ByteString
- data XcpResult
- byteStringToResult :: ByteString -> XcpResult
- fromBytes :: Storable a => a -> [Word8] -> Maybe a
- bytesToString :: [Word8] -> String
Types and Classes
data XcpCommandId Source
XCP commands from the standard. Note: Not all of these are implemented and a few from the XCP reference are missing. Please add them as needed if you like.
pid :: XcpCommandId -> Word8 Source
class Storable a => ToByteString a Source
Class for types that can be converted to a lazy ByteString
for transmission.
toByteString
XCP packets
:: Word32 | Memory address |
-> Word8 | Number of bytes to retrieve |
-> ByteString | The XCP packet |
Create an XCP packet to get a number of bytes from an address.
:: ToByteString a | |
=> Word32 | Memory address |
-> a | Value to set at the given address |
-> ByteString | The XCP packet |
Create an XCP packet to set a number of bytes at an address.
xcpConnect :: ByteString Source
The XCP connect packet.
xcpDisconnect :: ByteString Source
The XCP disconnect packet.
XCP Results and Conversion
Result structure for the result of XCP commands, received from a slave.
:: ByteString | The XCP message as received from the slave. |
-> XcpResult | The decoded result. |
Convert a result XCP message received from a slave into a XcpResult
.
:: Storable a | |
=> a | Just a dummy to fix the type of the return value. |
-> [Word8] | The bytes that make up the return value. |
-> Maybe a | If the number of bytes are sufficient, the first sizeOf a bytes from the list of bytes are poked into the returned value. |
Generate a value from a list of bytes by poking them into memory.
bytesToString :: [Word8] -> String Source
Show a string of bytes.