BLE FOTA APP
It doesn't work with the default FOTA bootloader. It use NVIC_SystemReset() to enter a bootloader.
nRF51822/nordic/nrf-sdk/bootloader_dfu/dfu_app_handler.h@1:a607cd9655d7, 2014-10-10 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
yihui | 1:a607cd9655d7 | 1 | /* Copyright (c) 2014 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 nrf_dfu_app_handler DFU BLE packet handling in Application |
yihui | 1:a607cd9655d7 | 16 | * @{ |
yihui | 1:a607cd9655d7 | 17 | * |
yihui | 1:a607cd9655d7 | 18 | * @brief DFU BLE packet handling for application. |
yihui | 1:a607cd9655d7 | 19 | * |
yihui | 1:a607cd9655d7 | 20 | * @details This module implements handling of DFU packets transmitted over BLE for switching from |
yihui | 1:a607cd9655d7 | 21 | * application mode to Bootloader running full DFU service. |
yihui | 1:a607cd9655d7 | 22 | * This module only handles the StartDFU packet allowing for any BLE application to expose |
yihui | 1:a607cd9655d7 | 23 | * support for the DFU service. |
yihui | 1:a607cd9655d7 | 24 | * Actual DFU service will execute in dedicated environment after a BLE disconnect and |
yihui | 1:a607cd9655d7 | 25 | * reset of the nRF51 chip. |
yihui | 1:a607cd9655d7 | 26 | * The host must then reconnect and can continue the update procedure with access to full |
yihui | 1:a607cd9655d7 | 27 | * DFU service. |
yihui | 1:a607cd9655d7 | 28 | * |
yihui | 1:a607cd9655d7 | 29 | * @note The application must propagate dfu events to the DFU App handler module by calling |
yihui | 1:a607cd9655d7 | 30 | * dfu_app_on_dfu_evt() from the from the @ref ble_dfu_evt_handler_t callback. |
yihui | 1:a607cd9655d7 | 31 | */ |
yihui | 1:a607cd9655d7 | 32 | |
yihui | 1:a607cd9655d7 | 33 | #ifndef DFU_APP_HANDLER_H__ |
yihui | 1:a607cd9655d7 | 34 | #define DFU_APP_HANDLER_H__ |
yihui | 1:a607cd9655d7 | 35 | |
yihui | 1:a607cd9655d7 | 36 | #include "dfu_app_handler.h" |
yihui | 1:a607cd9655d7 | 37 | #include "ble_dfu.h" |
yihui | 1:a607cd9655d7 | 38 | |
yihui | 1:a607cd9655d7 | 39 | /**@brief DFU Application reset prepare function. This function is a callback which allows the |
yihui | 1:a607cd9655d7 | 40 | * application to prepare for an upcoming application reset. |
yihui | 1:a607cd9655d7 | 41 | */ |
yihui | 1:a607cd9655d7 | 42 | typedef void (*dfu_app_reset_prepare_t)(void); |
yihui | 1:a607cd9655d7 | 43 | |
yihui | 1:a607cd9655d7 | 44 | |
yihui | 1:a607cd9655d7 | 45 | /**@brief Function for handling of \ref ble_dfu_evt_t from DFU Service. |
yihui | 1:a607cd9655d7 | 46 | * |
yihui | 1:a607cd9655d7 | 47 | * @details The application must inject this function into the DFU service or propagate DFU events |
yihui | 1:a607cd9655d7 | 48 | * to dfu_app_handler module by calling this function in application specific DFU event |
yihui | 1:a607cd9655d7 | 49 | * handler. |
yihui | 1:a607cd9655d7 | 50 | * |
yihui | 1:a607cd9655d7 | 51 | * @param[in] p_dfu Pointer to the DFU Service structure for which the include event relates. |
yihui | 1:a607cd9655d7 | 52 | * @param[in] p_evt Pointer to the DFU event. |
yihui | 1:a607cd9655d7 | 53 | */ |
yihui | 1:a607cd9655d7 | 54 | void dfu_app_on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt); |
yihui | 1:a607cd9655d7 | 55 | |
yihui | 1:a607cd9655d7 | 56 | |
yihui | 1:a607cd9655d7 | 57 | /**@brief Function for registering for reset prepare calls. |
yihui | 1:a607cd9655d7 | 58 | * |
yihui | 1:a607cd9655d7 | 59 | * @details The function provided will be executed before reseting the system into Bootloader/DFU |
yihui | 1:a607cd9655d7 | 60 | * mode. By setting this function the caller will be notified prior to the reset and can |
yihui | 1:a607cd9655d7 | 61 | * thus prepare the application for reset. As example the application can gracefully |
yihui | 1:a607cd9655d7 | 62 | * disconnect any peers on BLE, turning of LEDS, ensure all pending flash operations |
yihui | 1:a607cd9655d7 | 63 | * has completed, etc. |
yihui | 1:a607cd9655d7 | 64 | * |
yihui | 1:a607cd9655d7 | 65 | * @param[in] reset_prepare_func Function to be execute prior to a reset. |
yihui | 1:a607cd9655d7 | 66 | */ |
yihui | 1:a607cd9655d7 | 67 | void dfu_app_reset_prepare_set(dfu_app_reset_prepare_t reset_prepare_func); |
yihui | 1:a607cd9655d7 | 68 | |
yihui | 1:a607cd9655d7 | 69 | |
yihui | 1:a607cd9655d7 | 70 | #endif // DFU_APP_HANDLER_H__ |
yihui | 1:a607cd9655d7 | 71 | |
yihui | 1:a607cd9655d7 | 72 | /** @} */ |