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 /** @file
yihui 1:a607cd9655d7 14 *
yihui 1:a607cd9655d7 15 * @defgroup ble_sdk_lib_sensorsim Sensor Data Simulator
yihui 1:a607cd9655d7 16 * @{
yihui 1:a607cd9655d7 17 * @ingroup ble_sdk_lib
yihui 1:a607cd9655d7 18 * @brief Functions for simulating sensor data.
yihui 1:a607cd9655d7 19 *
yihui 1:a607cd9655d7 20 * @details Currently only a triangular waveform simulator is implemented.
yihui 1:a607cd9655d7 21 */
yihui 1:a607cd9655d7 22
yihui 1:a607cd9655d7 23 #ifndef BLE_SENSORSIM_H__
yihui 1:a607cd9655d7 24 #define BLE_SENSORSIM_H__
yihui 1:a607cd9655d7 25
yihui 1:a607cd9655d7 26 #include <stdint.h>
yihui 1:a607cd9655d7 27 #include <stdbool.h>
yihui 1:a607cd9655d7 28
yihui 1:a607cd9655d7 29 /**@brief Triangular waveform sensor simulator configuration. */
yihui 1:a607cd9655d7 30 typedef struct
yihui 1:a607cd9655d7 31 {
yihui 1:a607cd9655d7 32 uint32_t min; /**< Minimum simulated value. */
yihui 1:a607cd9655d7 33 uint32_t max; /**< Maximum simulated value. */
yihui 1:a607cd9655d7 34 uint32_t incr; /**< Increment between each measurement. */
yihui 1:a607cd9655d7 35 bool start_at_max; /**< TRUE is measurement is to start at the maximum value, FALSE if it is to start at the minimum. */
yihui 1:a607cd9655d7 36 } ble_sensorsim_cfg_t;
yihui 1:a607cd9655d7 37
yihui 1:a607cd9655d7 38 /**@brief Triangular waveform sensor simulator state. */
yihui 1:a607cd9655d7 39 typedef struct
yihui 1:a607cd9655d7 40 {
yihui 1:a607cd9655d7 41 uint32_t current_val; /**< Current sensor value. */
yihui 1:a607cd9655d7 42 bool is_increasing; /**< TRUE if the simulator is in increasing state, FALSE otherwise. */
yihui 1:a607cd9655d7 43 } ble_sensorsim_state_t;
yihui 1:a607cd9655d7 44
yihui 1:a607cd9655d7 45 /**@brief Function for initializing a triangular waveform sensor simulator.
yihui 1:a607cd9655d7 46 *
yihui 1:a607cd9655d7 47 * @param[out] p_state Current state of simulator.
yihui 1:a607cd9655d7 48 * @param[in] p_cfg Simulator configuration.
yihui 1:a607cd9655d7 49 */
yihui 1:a607cd9655d7 50 void ble_sensorsim_init(ble_sensorsim_state_t * p_state,
yihui 1:a607cd9655d7 51 const ble_sensorsim_cfg_t * p_cfg);
yihui 1:a607cd9655d7 52
yihui 1:a607cd9655d7 53 /**@brief Function for generating a simulated sensor measurement using a triangular waveform generator.
yihui 1:a607cd9655d7 54 *
yihui 1:a607cd9655d7 55 * @param[in,out] p_state Current state of simulator.
yihui 1:a607cd9655d7 56 * @param[in] p_cfg Simulator configuration.
yihui 1:a607cd9655d7 57 *
yihui 1:a607cd9655d7 58 * @return Simulator output.
yihui 1:a607cd9655d7 59 */
yihui 1:a607cd9655d7 60 uint32_t ble_sensorsim_measure(ble_sensorsim_state_t * p_state,
yihui 1:a607cd9655d7 61 const ble_sensorsim_cfg_t * p_cfg);
yihui 1:a607cd9655d7 62
yihui 1:a607cd9655d7 63 #endif // BLE_SENSORSIM_H__
yihui 1:a607cd9655d7 64
yihui 1:a607cd9655d7 65 /** @} */