Fixed ADSB TX frame rotation

This commit is contained in:
furrtek
2017-08-12 09:54:58 +01:00
parent 482729918d
commit 7f97a090e4
7 changed files with 125 additions and 157 deletions

View File

@@ -70,13 +70,16 @@ FormattedSymbols format_symbols(
return { hex_data, hex_error };
}
void manchester_encode(uint8_t * dest, uint8_t * src, size_t length, const size_t sense) {
uint_fast8_t part = sense ? 0 : 0xFF;
void manchester_encode(uint8_t * dest, uint8_t * src, const size_t length, const size_t sense) {
uint8_t part = sense ? 0 : 0xFF;
for (size_t c = 0; c < length; c++) {
if ((src[c >> 3] << (c & 7)) & 0x80) {
*(dest++) = part;
*(dest++) = ~part;
} else {
*(dest++) = ~part;
*(dest++) = part;
}
}
}