File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed
Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change 11#include " msp.h"
22
33#include " logging.h"
4+ #include " crc.h"
45
56/* ==========================================
67MSP V2 Message Structure:
@@ -16,19 +17,11 @@ Offset: Usage: In CRC: Comment:
1617n+8 checksum uint8, (n= payload size), crc8_dvb_s2 checksum
1718========================================== */
1819
19- // CRC helper function. External to MSP class
20- // TODO: Move all our CRC functions to a CRC lib
20+ // CRC helper function.
2121uint8_t crc8_dvb_s2 (uint8_t crc, unsigned char a)
2222{
23- crc ^= a;
24- for (int ii = 0 ; ii < 8 ; ++ii) {
25- if (crc & 0x80 ) {
26- crc = (crc << 1 ) ^ 0xD5 ;
27- } else {
28- crc = crc << 1 ;
29- }
30- }
31- return crc;
23+ static GENERIC_CRC8 crc8_dvb_s2_instance (0xD5 );
24+ return crc8_dvb_s2_instance.calc (crc ^ a);
3225}
3326
3427MSP::MSP () : m_inputState(MSP_IDLE)
You can’t perform that action at this time.
0 commit comments