diff options
Diffstat (limited to 'project/mavlink-library/src/main/twirl/org/mavlink/Crc.scala.txt')
-rw-r--r-- | project/mavlink-library/src/main/twirl/org/mavlink/Crc.scala.txt | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/project/mavlink-library/src/main/twirl/org/mavlink/Crc.scala.txt b/project/mavlink-library/src/main/twirl/org/mavlink/Crc.scala.txt deleted file mode 100644 index 61b5c6f..0000000 --- a/project/mavlink-library/src/main/twirl/org/mavlink/Crc.scala.txt +++ /dev/null @@ -1,23 +0,0 @@ -@() - -package org.mavlink - -/** - * X.25 CRC calculation for MAVlink messages. The checksum must be initialized, - * updated with witch field of the message, and then finished with the message - * id. - */ -case class Crc(val crc: Int = 0xffff) extends AnyVal { - - def accumulate(datum: Byte): Crc = { - val d = datum & 0xff - var tmp = d ^ (crc & 0xff) - tmp ^= (tmp << 4) & 0xff; - Crc( - ((crc >> 8) & 0xff) ^ (tmp << 8) ^ (tmp << 3) ^ ((tmp >> 4) & 0xff)) - } - - def lsb: Byte = crc.toByte - def msb: Byte = (crc >> 8).toByte - -}
\ No newline at end of file |