Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CISLibrary/tools/CRC.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once

#include "CRC.h"

#define key 0x2F

char CRC8(const char * data, int length) {
char crc = 0x00;
for (int i = 0; i < length; ++i) {
crc ^= *(data + i);

for (int j = 0; j < 8; ++j) {
if ((crc & 0x80)) {
crc = ((crc << 1) ^ key);
} else {
crc <<= 1;
}
}
}

return crc;
}
3 changes: 3 additions & 0 deletions CISLibrary/tools/CRC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

char CRC8(const char * data, int length);
Binary file added CougSat1-ADCS/docs/IHU communication.pdf
Binary file not shown.
Binary file added CougSat1-IHU/docs/IHU communication.pdf
Binary file not shown.