ADS124S08 Example C Code
1.0.0
|
Library of functions for CRC implementations. More...
#include "crc.h"
Functions | |
static uint8_t | calculateCRC (const uint8_t dataBytes[], uint8_t numberBytes, uint8_t initialValue) |
calculateCRC() Calculates the CRC for the selected CRC polynomial More... | |
static void | initTable (void) |
initTable() Creates lookup table in memory using byte wide computation in a 256 element array More... | |
static uint8_t | lookupCRC (const uint8_t dataBytes[], uint8_t numberBytes, uint8_t initialValue) |
lookupCRC(() Performs CRC lookup operation in byte increments More... | |
void | initCRC (void) |
initCRC() Initializes CRC module and creates lookup table (if using lookup method) More... | |
uint8_t | getCRC (const uint8_t dataBytes[], uint8_t numberBytes, uint8_t initialValue) |
getCRC() Performs CRC lookup or calculation More... | |
Variables | |
static bool | initialized = false |
static uint8_t | crcLookupTable [256] |
Library of functions for CRC implementations.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
static |
calculateCRC() Calculates the CRC for the selected CRC polynomial
[in] | dataBytes | pointer to first element in the data byte array |
[in] | numberBytes | number of bytes to be used in CRC calculation |
[in] | initialValue | the seed value (or partial crc calculation), use CRC_INITIAL_SEED when beginning a new CRC computation |
uint8_t getCRC | ( | const uint8_t | dataBytes[], |
uint8_t | numberBytes, | ||
uint8_t | initialValue | ||
) |
getCRC() Performs CRC lookup or calculation
[in] | dataBytes | pointer to the data array |
[in] | numberBytes | number of bytes in array to process |
[in] | initialValue | CRC initial seed value or partial result of previous CRC calculation |
void initCRC | ( | void | ) |
initCRC() Initializes CRC module and creates lookup table (if using lookup method)
|
static |
initTable() Creates lookup table in memory using byte wide computation in a 256 element array
|
static |
lookupCRC(() Performs CRC lookup operation in byte increments
[in] | dataBytes | pointer to the data array (little endian) |
[in] | numberBytes | number of bytes in array to process |
[in] | initialValue | CRC initial seed value or partial result of previous CRC calculation |
|
static |
|
static |