The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Anna Bridge 160:5571c4ff569f 1 /*
AnnaBridge 143:86740a56073b 2 * Copyright (c) 2013 Nordic Semiconductor ASA
AnnaBridge 143:86740a56073b 3 * All rights reserved.
Anna Bridge 160:5571c4ff569f 4 *
AnnaBridge 143:86740a56073b 5 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 143:86740a56073b 6 * are permitted provided that the following conditions are met:
Anna Bridge 160:5571c4ff569f 7 *
Anna Bridge 160:5571c4ff569f 8 * 1. Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 143:86740a56073b 9 * of conditions and the following disclaimer.
AnnaBridge 143:86740a56073b 10 *
Anna Bridge 160:5571c4ff569f 11 * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
Anna Bridge 160:5571c4ff569f 12 * integrated circuit in a product or a software update for such product, must reproduce
Anna Bridge 160:5571c4ff569f 13 * the above copyright notice, this list of conditions and the following disclaimer in
AnnaBridge 143:86740a56073b 14 * the documentation and/or other materials provided with the distribution.
AnnaBridge 143:86740a56073b 15 *
Anna Bridge 160:5571c4ff569f 16 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
Anna Bridge 160:5571c4ff569f 17 * used to endorse or promote products derived from this software without specific prior
AnnaBridge 143:86740a56073b 18 * written permission.
AnnaBridge 143:86740a56073b 19 *
Anna Bridge 160:5571c4ff569f 20 * 4. This software, with or without modification, must only be used with a
AnnaBridge 143:86740a56073b 21 * Nordic Semiconductor ASA integrated circuit.
AnnaBridge 143:86740a56073b 22 *
Anna Bridge 160:5571c4ff569f 23 * 5. Any software provided in binary or object form under this license must not be reverse
Anna Bridge 160:5571c4ff569f 24 * engineered, decompiled, modified and/or disassembled.
Anna Bridge 160:5571c4ff569f 25 *
AnnaBridge 143:86740a56073b 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 143:86740a56073b 27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 143:86740a56073b 28 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 143:86740a56073b 29 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 143:86740a56073b 30 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 143:86740a56073b 31 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 143:86740a56073b 32 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 143:86740a56073b 33 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 143:86740a56073b 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 143:86740a56073b 35 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Anna Bridge 160:5571c4ff569f 36 *
AnnaBridge 143:86740a56073b 37 */
AnnaBridge 143:86740a56073b 38
AnnaBridge 143:86740a56073b 39
AnnaBridge 143:86740a56073b 40 /**@file
AnnaBridge 143:86740a56073b 41 *
AnnaBridge 143:86740a56073b 42 * @defgroup ble_stack_handler_types Types definitions for BLE support in SoftDevice handler.
AnnaBridge 143:86740a56073b 43 * @{
AnnaBridge 143:86740a56073b 44 * @ingroup softdevice_handler
AnnaBridge 143:86740a56073b 45 * @brief This file contains the declarations of types required for BLE stack support. These
AnnaBridge 143:86740a56073b 46 * types will be defined when the preprocessor define BLE_STACK_SUPPORT_REQD is defined.
AnnaBridge 143:86740a56073b 47 */
AnnaBridge 143:86740a56073b 48
AnnaBridge 143:86740a56073b 49 #ifndef BLE_STACK_HANDLER_TYPES_H__
AnnaBridge 143:86740a56073b 50 #define BLE_STACK_HANDLER_TYPES_H__
AnnaBridge 143:86740a56073b 51
AnnaBridge 143:86740a56073b 52 #ifdef BLE_STACK_SUPPORT_REQD
AnnaBridge 143:86740a56073b 53
AnnaBridge 143:86740a56073b 54 #include <stdlib.h>
AnnaBridge 143:86740a56073b 55 #include "nrf_ble.h"
AnnaBridge 143:86740a56073b 56 #include "nrf_sdm.h"
AnnaBridge 143:86740a56073b 57 #include "app_error.h"
AnnaBridge 143:86740a56073b 58 #include "app_util.h"
AnnaBridge 143:86740a56073b 59
Anna Bridge 160:5571c4ff569f 60 #define BLE_STACK_EVT_MSG_BUF_SIZE (sizeof(ble_evt_t) + (3 * sizeof(ble_gattc_attr_info_t)) + (GATT_MTU_SIZE_DEFAULT)) /**< Size of BLE event message buffer. This will be provided to the SoftDevice while fetching an event. */
AnnaBridge 143:86740a56073b 61 #define BLE_STACK_HANDLER_SCHED_EVT_SIZE 0 /**< The size of the scheduler event used by SoftDevice handler when passing BLE events using the @ref app_scheduler. */
AnnaBridge 143:86740a56073b 62
AnnaBridge 143:86740a56073b 63 /**@brief Application stack event handler type. */
AnnaBridge 143:86740a56073b 64 typedef void (*ble_evt_handler_t) (ble_evt_t * p_ble_evt);
AnnaBridge 143:86740a56073b 65
AnnaBridge 143:86740a56073b 66 /**@brief Function for registering for BLE events.
AnnaBridge 143:86740a56073b 67 *
AnnaBridge 143:86740a56073b 68 * @details The application should use this function to register for receiving BLE events from
AnnaBridge 143:86740a56073b 69 * the SoftDevice. If the application does not call this function, then any BLE event
AnnaBridge 143:86740a56073b 70 * that may be generated by the SoftDevice will NOT be fetched. Once the application has
AnnaBridge 143:86740a56073b 71 * registered for the events, it is not possible to cancel the registration.
AnnaBridge 143:86740a56073b 72 * However, it is possible to register a different function for handling the events at
AnnaBridge 143:86740a56073b 73 * any point of time.
AnnaBridge 143:86740a56073b 74 *
AnnaBridge 143:86740a56073b 75 * @param[in] ble_evt_handler Function to be called for each received BLE event.
AnnaBridge 143:86740a56073b 76 *
AnnaBridge 143:86740a56073b 77 * @retval NRF_SUCCESS Successful registration.
AnnaBridge 143:86740a56073b 78 * @retval NRF_ERROR_NULL Null pointer provided as input.
AnnaBridge 143:86740a56073b 79 */
AnnaBridge 143:86740a56073b 80 uint32_t softdevice_ble_evt_handler_set(ble_evt_handler_t ble_evt_handler);
AnnaBridge 143:86740a56073b 81
AnnaBridge 143:86740a56073b 82 #else
AnnaBridge 143:86740a56073b 83
AnnaBridge 143:86740a56073b 84 #define BLE_STACK_EVT_MSG_BUF_SIZE 0 /**< Since the BLE stack support is not required, this is equated to 0, so that the @ref softdevice_handler.h can compute the internal event buffer size without having to care for BLE events.*/
AnnaBridge 143:86740a56073b 85 #define BLE_STACK_HANDLER_SCHED_EVT_SIZE 0
AnnaBridge 143:86740a56073b 86
AnnaBridge 143:86740a56073b 87 #endif // BLE_STACK_SUPPORT_REQD
AnnaBridge 143:86740a56073b 88
AnnaBridge 143:86740a56073b 89 #endif // BLE_STACK_HANDLER_TYPES_H__
AnnaBridge 143:86740a56073b 90
AnnaBridge 143:86740a56073b 91 /** @} */