Set write permission for 'write without response' characteristics.
Fork of nRF51822 by
nordic/app_common/crc16.cpp@85:17fe69405098, 2014-12-12 (annotated)
- Committer:
- marcuschang
- Date:
- Fri Dec 12 17:12:35 2014 +0000
- Revision:
- 85:17fe69405098
- Parent:
- 65:98215c4f3a25
Write permission was not set for 'write without response' characteristics.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:eff01767de02 | 1 | /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. |
bogdanm | 0:eff01767de02 | 2 | * |
bogdanm | 0:eff01767de02 | 3 | * The information contained herein is property of Nordic Semiconductor ASA. |
bogdanm | 0:eff01767de02 | 4 | * Terms and conditions of usage are described in detail in NORDIC |
bogdanm | 0:eff01767de02 | 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. |
bogdanm | 0:eff01767de02 | 6 | * |
bogdanm | 0:eff01767de02 | 7 | * Licensees are granted free, non-transferable use of the information. NO |
bogdanm | 0:eff01767de02 | 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from |
bogdanm | 0:eff01767de02 | 9 | * the file. |
bogdanm | 0:eff01767de02 | 10 | * |
bogdanm | 0:eff01767de02 | 11 | */ |
bogdanm | 0:eff01767de02 | 12 | |
bogdanm | 0:eff01767de02 | 13 | #include "crc16.h" |
bogdanm | 0:eff01767de02 | 14 | #include <stdio.h> |
bogdanm | 0:eff01767de02 | 15 | |
bogdanm | 0:eff01767de02 | 16 | uint16_t crc16_compute(const uint8_t * p_data, uint32_t size, const uint16_t * p_crc) |
bogdanm | 0:eff01767de02 | 17 | { |
bogdanm | 0:eff01767de02 | 18 | uint32_t i; |
bogdanm | 0:eff01767de02 | 19 | uint16_t crc = (p_crc == NULL) ? 0xffff : *p_crc; |
bogdanm | 0:eff01767de02 | 20 | |
bogdanm | 0:eff01767de02 | 21 | for (i = 0; i < size; i++) |
bogdanm | 0:eff01767de02 | 22 | { |
Rohit Grover |
65:98215c4f3a25 | 23 | crc = (unsigned char)(crc >> 8) | (crc << 8); |
bogdanm | 0:eff01767de02 | 24 | crc ^= p_data[i]; |
bogdanm | 0:eff01767de02 | 25 | crc ^= (unsigned char)(crc & 0xff) >> 4; |
bogdanm | 0:eff01767de02 | 26 | crc ^= (crc << 8) << 4; |
bogdanm | 0:eff01767de02 | 27 | crc ^= ((crc & 0xff) << 4) << 1; |
bogdanm | 0:eff01767de02 | 28 | } |
Rohit Grover |
65:98215c4f3a25 | 29 | |
bogdanm | 0:eff01767de02 | 30 | return crc; |
bogdanm | 0:eff01767de02 | 31 | } |