1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 06:15:16 +03:00

Initial commit of SPI receiver code.

This commit is contained in:
Martin Budden 2016-09-14 01:44:43 +01:00
parent 9b9b16faed
commit 551bbe1d1a
33 changed files with 2971 additions and 32 deletions

View file

@ -336,3 +336,17 @@ int16_t qMultiply(fix12_t q, int16_t input) {
fix12_t qConstruct(int16_t num, int16_t den) {
return (num << 12) / den;
}
uint16_t crc16_ccitt(uint16_t crc, unsigned char a)
{
crc ^= a << 8;
for (int ii = 0; ii < 8; ++ii) {
if (crc & 0x8000) {
crc = (crc << 1) ^ 0x1021;
} else {
crc = crc << 1;
}
}
return crc;
}