mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
21 lines
387 B
C++
21 lines
387 B
C++
#include "lib/core/globals.h"
|
|
#include "lib/decoders/decoders.h"
|
|
#include "arch/agat/agat.h"
|
|
#include "lib/core/bytes.h"
|
|
#include "fmt/format.h"
|
|
|
|
uint8_t agatChecksum(const Bytes& bytes)
|
|
{
|
|
uint16_t checksum = 0;
|
|
|
|
for (uint8_t b : bytes)
|
|
{
|
|
if (checksum > 0xff)
|
|
checksum = (checksum + 1) & 0xff;
|
|
|
|
checksum += b;
|
|
}
|
|
|
|
return checksum & 0xff;
|
|
}
|