You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
703 B

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "protocolPTZ.h"
  2. static inline uint16_t x25_crc_calculate( uint8_t *pBuffer, size_t length ){
  3. uint16_t crcTmp = 0xffff;
  4. for ( size_t i = 0; i < length; i++){
  5. uint8_t tmp;
  6. tmp = pBuffer[i] ^ (uint8_t)(crcTmp & 0xff);
  7. tmp ^= (tmp<<4);
  8. crcTmp = (crcTmp>>8) ^ (crcTmp<<8) ^ (tmp <<3) ^ (tmp>>4);
  9. };
  10. return crcTmp;
  11. };
  12. protocolMAVLINK::protocolMAVLINK(){
  13. m_oDataTransport = NULL;
  14. };
  15. protocolMAVLINK::protocolMAVLINK( basicTransport *Serial ):protocolParser(){
  16. m_oDataTransport = Serial;
  17. if( m_oDataTransport != NULL ) {
  18. m_oDataTransport->addRecipient( ( protocolParser *) this );
  19. };
  20. };
  21. protocolMAVLINK::~protocolMAVLINK(){
  22. };