src/Motoron.h
static uint8_t calculateCrc(uint8_t length, const uint8_t * buffer)
  {
    uint8_t crc = 0;
    for (uint8_t i = 0; i < length; i++)
    {
      crc = pgm_read_byte(&motoronCrcTable[crc ^ buffer[i]]);

      // The code below shows an alternative method to calculate the CRC
      // without using a lookup table.  It will generally be slower but save
      // program space.
      // crc ^= buffer[i];
      // for (uint8_t j = 0; j < 8; j++)
      // {
      //   if (crc & 1) { crc ^= 0x91; }
      //   crc >>= 1;
      // }
    }
    return crc;
  }
/// This static method calculates the 7-bit CRC needed for a Motoron
/// command or response.  Most users will not need to use this, since most
/// methods in this library automatically append a CRC byte or check
/// received CRC bytes when appropriate.
This static method calculates the 7-bit CRC needed for a Motoron
command or response.  Most users will not need to use this, since most
methods in this library automatically append a CRC byte or check
received CRC bytes when appropriate.
This static method calculates the 7 - bit CRC needed for a Motoron command or response . Most users will not need to use this since most methods in this library automatically append a CRC byte or check received CRC bytes when appropriate .
static uint8_t calculateCrc(uint8_t length, const uint8_t * buffer)
  {
    uint8_t crc = 0;
    for (uint8_t i = 0; i < length; i++)
    {
      crc = pgm_read_byte(&motoronCrcTable[crc ^ buffer[i]]);
    }
    return crc;
  }
static uint8_t calculateCrc ( uint8_t length , const uint8_t * buffer ) { uint8_t crc = 0 ; for ( uint8_t i = 0 ; i < length ; i ++ ) { crc = pgm_read_byte ( & motoronCrcTable [ crc ^ buffer [ i ] ] ) ; } return crc ; }
This static method calculates the 7-bit CRC needed for a Motoron
command or response.
This static method calculates the 7 - bit CRC needed for a Motoron command or response .
// The code below shows an alternative method to calculate the CRC // without using a lookup table.  It will generally be slower but save // program space. // crc ^= buffer[i]; // for (uint8_t j = 0; j < 8; j++) // { //   if (crc & 1) { crc ^= 0x91; } //   crc >>= 1; // }