Martin Cottrell / nRF51822

Dependencies:   nrf51-sdk

Dependents:   microbit-dal

Fork of nRF51822 by Lancaster University

Committer:
rgrover1
Date:
Mon Jul 06 10:13:26 2015 +0100
Revision:
370:295f76db798e
Parent:
362:6fa0d4d555f6
Child:
371:8f7d2137727a
Synchronized with git rev 9f72c4ba
Author: Rohit Grover
Release 0.3.7
=============

This is a minor set of enhancements mostly around reduce our global static
memory footprint.

Enhancements
~~~~~~~~~~~~

* Reduce the maximum number of CHARACTERISTICS and DESCRIPTORS that can be
handled. This has memory implications for static global memory. It should
be possible to re-architect our solution for add_characteristic() to not
require these limits; hopefully we'll get there soon.

* Move nRF51GattServer::getInstance() into a .cpp file; same for nRF51Gap::getInstance().

* Reduce max bonds to managed by device-manager to 4; this has memory implications for static global memory.

* Reduce pStorage command queue size to 2; this has memory implications for static global memory.

* Replace uses of deprecated Gap::addr_type_t with Gap::AddressType_t.

* Some UUID-related types have moved into UUID class. Minor changes were needed to work around build errors.

Bugfixes
~~~~~~~~

* None.

Who changed what in which revision?

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