iOSのBLEコントローラアプリ「RCBController」と接続し、コントローラの操作を取得するサンプルプログラムです。 mbed HRM1017で動作を確認しています。

Dependencies:   BLE_API_Native_IRC BLE_API mbed

Committer:
jksoft
Date:
Wed Aug 20 13:30:11 2014 +0000
Revision:
2:dd85fdc18224
Parent:
1:48f6e08a3ac2
???

Who changed what in which revision?

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