bugfix for duplicate symbol

Fork of nRF51822 by Nordic Semiconductor

Committer:
finneyj
Date:
Fri May 15 12:12:21 2015 +0000
Revision:
177:7a1917171a20
Parent:
103:138bdc859cc9
bug fix - redefined symbol

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rgrover1 103:138bdc859cc9 1 /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
rgrover1 103:138bdc859cc9 2 *
rgrover1 103:138bdc859cc9 3 * The information contained herein is property of Nordic Semiconductor ASA.
rgrover1 103:138bdc859cc9 4 * Terms and conditions of usage are described in detail in NORDIC
rgrover1 103:138bdc859cc9 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
rgrover1 103:138bdc859cc9 6 *
rgrover1 103:138bdc859cc9 7 * Licensees are granted free, non-transferable use of the information. NO
rgrover1 103:138bdc859cc9 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
rgrover1 103:138bdc859cc9 9 * the file.
rgrover1 103:138bdc859cc9 10 *
rgrover1 103:138bdc859cc9 11 */
rgrover1 103:138bdc859cc9 12
rgrover1 103:138bdc859cc9 13 #include "crc16.h"
rgrover1 103:138bdc859cc9 14 #include <stdio.h>
rgrover1 103:138bdc859cc9 15
rgrover1 103:138bdc859cc9 16 uint16_t crc16_compute(const uint8_t * p_data, uint32_t size, const uint16_t * p_crc)
rgrover1 103:138bdc859cc9 17 {
rgrover1 103:138bdc859cc9 18 uint32_t i;
rgrover1 103:138bdc859cc9 19 uint16_t crc = (p_crc == NULL) ? 0xffff : *p_crc;
rgrover1 103:138bdc859cc9 20
rgrover1 103:138bdc859cc9 21 for (i = 0; i < size; i++)
rgrover1 103:138bdc859cc9 22 {
rgrover1 103:138bdc859cc9 23 crc = (unsigned char)(crc >> 8) | (crc << 8);
rgrover1 103:138bdc859cc9 24 crc ^= p_data[i];
rgrover1 103:138bdc859cc9 25 crc ^= (unsigned char)(crc & 0xff) >> 4;
rgrover1 103:138bdc859cc9 26 crc ^= (crc << 8) << 4;
rgrover1 103:138bdc859cc9 27 crc ^= ((crc & 0xff) << 4) << 1;
rgrover1 103:138bdc859cc9 28 }
rgrover1 103:138bdc859cc9 29
rgrover1 103:138bdc859cc9 30 return crc;
rgrover1 103:138bdc859cc9 31 }