嵌入式软件开发中常用到的一些函数
CRC16快速查表法
// CRC16的表
static const uint16_t crctalbeabs[] = {
0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401,
0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400};
// CRC16快速查表法
uint16_t crc16tablefast(uint8_t *data, uint32_t len)
{
uint16_t crc = 0xFFFF;
uint32_t i = 0;
uint8_t ch = 0;
for (i = 0; i < len; i++)
{
ch =