BLE FOTA APP

Dependencies:   BLE_API mbed

It doesn't work with the default FOTA bootloader. It use NVIC_SystemReset() to enter a bootloader.

Committer:
yihui
Date:
Fri Oct 10 03:36:28 2014 +0000
Revision:
1:a607cd9655d7
use NVIC_SystemReset() to run bootloader

Who changed what in which revision?

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