mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-26 16:30:07 +08:00
Use unsigned int for crc calculation
This commit is contained in:
@@ -76,7 +76,7 @@ int spi_link_send(void *buf_out, size_t count, void *buf_in, uint8_t* crc_valid)
|
||||
#define TOPBIT (1 << (WIDTH - 1))
|
||||
uint8_t crc_calc_block_crc8(const uint8_t buf[], uint32_t len) {
|
||||
uint8_t _remainder = 0;
|
||||
for (int byte = 0; byte < len; ++byte) {
|
||||
for (uint32_t byte = 0; byte < len; ++byte) {
|
||||
_remainder ^= (buf[byte] << (WIDTH - 8));
|
||||
for (uint8_t bit = 8; bit > 0; --bit) {
|
||||
if (_remainder & TOPBIT)
|
||||
|
||||
Reference in New Issue
Block a user