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) 2012 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 /* Attention!
yihui 1:a607cd9655d7 14 * To maintain compliance with Nordic Semiconductor ASA’s Bluetooth profile
yihui 1:a607cd9655d7 15 * qualification listings, this section of source code must not be modified.
yihui 1:a607cd9655d7 16 */
yihui 1:a607cd9655d7 17
yihui 1:a607cd9655d7 18 #include "ble_srv_common.h"
yihui 1:a607cd9655d7 19 #include <string.h>
yihui 1:a607cd9655d7 20 #include "nordic_common.h"
yihui 1:a607cd9655d7 21 #include "app_error.h"
yihui 1:a607cd9655d7 22
yihui 1:a607cd9655d7 23
yihui 1:a607cd9655d7 24 uint8_t ble_srv_report_ref_encode(uint8_t * p_encoded_buffer,
yihui 1:a607cd9655d7 25 const ble_srv_report_ref_t * p_report_ref)
yihui 1:a607cd9655d7 26 {
yihui 1:a607cd9655d7 27 uint8_t len = 0;
yihui 1:a607cd9655d7 28
yihui 1:a607cd9655d7 29 p_encoded_buffer[len++] = p_report_ref->report_id;
yihui 1:a607cd9655d7 30 p_encoded_buffer[len++] = p_report_ref->report_type;
yihui 1:a607cd9655d7 31
yihui 1:a607cd9655d7 32 APP_ERROR_CHECK_BOOL(len == BLE_SRV_ENCODED_REPORT_REF_LEN);
yihui 1:a607cd9655d7 33 return len;
yihui 1:a607cd9655d7 34 }
yihui 1:a607cd9655d7 35
yihui 1:a607cd9655d7 36
yihui 1:a607cd9655d7 37 void ble_srv_ascii_to_utf8(ble_srv_utf8_str_t * p_utf8, char * p_ascii)
yihui 1:a607cd9655d7 38 {
yihui 1:a607cd9655d7 39 p_utf8->length = (uint16_t)strlen(p_ascii);
yihui 1:a607cd9655d7 40 p_utf8->p_str = (uint8_t *)p_ascii;
yihui 1:a607cd9655d7 41 }