Nordic stack and drivers for the mbed BLE API

Dependents:   BLE_ANCS_SDAPI BLE_temperature BLE_HeartRate writable_gatt ... more

Committer:
Vincent Coubard
Date:
Wed Sep 14 14:39:43 2016 +0100
Revision:
638:c90ae1400bf2
Sync with bdab10dc0f90748b6989c8b577771bb403ca6bd8 from ARMmbed/mbed-os.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Vincent Coubard 638:c90ae1400bf2 1 /* mbed Microcontroller Library
Vincent Coubard 638:c90ae1400bf2 2 * Copyright (c) 2006-2013 ARM Limited
Vincent Coubard 638:c90ae1400bf2 3 *
Vincent Coubard 638:c90ae1400bf2 4 * Licensed under the Apache License, Version 2.0 (the "License");
Vincent Coubard 638:c90ae1400bf2 5 * you may not use this file except in compliance with the License.
Vincent Coubard 638:c90ae1400bf2 6 * You may obtain a copy of the License at
Vincent Coubard 638:c90ae1400bf2 7 *
Vincent Coubard 638:c90ae1400bf2 8 * http://www.apache.org/licenses/LICENSE-2.0
Vincent Coubard 638:c90ae1400bf2 9 *
Vincent Coubard 638:c90ae1400bf2 10 * Unless required by applicable law or agreed to in writing, software
Vincent Coubard 638:c90ae1400bf2 11 * distributed under the License is distributed on an "AS IS" BASIS,
Vincent Coubard 638:c90ae1400bf2 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Vincent Coubard 638:c90ae1400bf2 13 * See the License for the specific language governing permissions and
Vincent Coubard 638:c90ae1400bf2 14 * limitations under the License.
Vincent Coubard 638:c90ae1400bf2 15 */
Vincent Coubard 638:c90ae1400bf2 16
Vincent Coubard 638:c90ae1400bf2 17 #ifndef _PROJECTCONFIG_H_
Vincent Coubard 638:c90ae1400bf2 18 #define _PROJECTCONFIG_H_
Vincent Coubard 638:c90ae1400bf2 19
Vincent Coubard 638:c90ae1400bf2 20 #include "ble/GapAdvertisingData.h"
Vincent Coubard 638:c90ae1400bf2 21
Vincent Coubard 638:c90ae1400bf2 22 /*=========================================================================
Vincent Coubard 638:c90ae1400bf2 23 MCU & BOARD SELCTION
Vincent Coubard 638:c90ae1400bf2 24
Vincent Coubard 638:c90ae1400bf2 25 CFG_BOARD is one of the value defined in board.h
Vincent Coubard 638:c90ae1400bf2 26 -----------------------------------------------------------------------*/
Vincent Coubard 638:c90ae1400bf2 27 #define CFG_BOARD BOARD_PCA10001
Vincent Coubard 638:c90ae1400bf2 28 #define CFG_MCU_STRING "nRF51822"
Vincent Coubard 638:c90ae1400bf2 29 /*=========================================================================*/
Vincent Coubard 638:c90ae1400bf2 30
Vincent Coubard 638:c90ae1400bf2 31
Vincent Coubard 638:c90ae1400bf2 32 /*=========================================================================
Vincent Coubard 638:c90ae1400bf2 33 CODE BASE VERSION SETTINGS
Vincent Coubard 638:c90ae1400bf2 34
Vincent Coubard 638:c90ae1400bf2 35 Please do not modify this version number. To set a version number
Vincent Coubard 638:c90ae1400bf2 36 for your project or firmware, change the values in your 'boards/'
Vincent Coubard 638:c90ae1400bf2 37 config file.
Vincent Coubard 638:c90ae1400bf2 38 -----------------------------------------------------------------------*/
Vincent Coubard 638:c90ae1400bf2 39 #define CFG_CODEBASE_VERSION_MAJOR 0
Vincent Coubard 638:c90ae1400bf2 40 #define CFG_CODEBASE_VERSION_MINOR 1
Vincent Coubard 638:c90ae1400bf2 41 #define CFG_CODEBASE_VERSION_REVISION 0
Vincent Coubard 638:c90ae1400bf2 42 /*=========================================================================*/
Vincent Coubard 638:c90ae1400bf2 43
Vincent Coubard 638:c90ae1400bf2 44
Vincent Coubard 638:c90ae1400bf2 45 /*=========================================================================
Vincent Coubard 638:c90ae1400bf2 46 FIRMWARE VERSION SETTINGS
Vincent Coubard 638:c90ae1400bf2 47 -----------------------------------------------------------------------*/
Vincent Coubard 638:c90ae1400bf2 48 #define CFG_FIRMWARE_VERSION_MAJOR 0
Vincent Coubard 638:c90ae1400bf2 49 #define CFG_FIRMWARE_VERSION_MINOR 0
Vincent Coubard 638:c90ae1400bf2 50 #define CFG_FIRMWARE_VERSION_REVISION 0
Vincent Coubard 638:c90ae1400bf2 51 /*=========================================================================*/
Vincent Coubard 638:c90ae1400bf2 52
Vincent Coubard 638:c90ae1400bf2 53
Vincent Coubard 638:c90ae1400bf2 54 /*=========================================================================
Vincent Coubard 638:c90ae1400bf2 55 DEBUG LEVEL
Vincent Coubard 638:c90ae1400bf2 56 -----------------------------------------------------------------------
Vincent Coubard 638:c90ae1400bf2 57
Vincent Coubard 638:c90ae1400bf2 58 CFG_DEBUG Level 3: Full debug output, any failed assert
Vincent Coubard 638:c90ae1400bf2 59 will produce a breakpoint for the
Vincent Coubard 638:c90ae1400bf2 60 debugger
Vincent Coubard 638:c90ae1400bf2 61 Level 2: ATTR_ALWAYS_INLINE is null, ASSERT
Vincent Coubard 638:c90ae1400bf2 62 has text
Vincent Coubard 638:c90ae1400bf2 63 Level 1: ATTR_ALWAYS_INLINE is an attribute,
Vincent Coubard 638:c90ae1400bf2 64 ASSERT has no text
Vincent Coubard 638:c90ae1400bf2 65 Level 0: No debug information generated
Vincent Coubard 638:c90ae1400bf2 66
Vincent Coubard 638:c90ae1400bf2 67 -----------------------------------------------------------------------*/
Vincent Coubard 638:c90ae1400bf2 68 #define CFG_DEBUG (1)
Vincent Coubard 638:c90ae1400bf2 69
Vincent Coubard 638:c90ae1400bf2 70 #if (CFG_DEBUG > 3) || (CFG_DEBUG < 0)
Vincent Coubard 638:c90ae1400bf2 71 #error "CFG_DEBUG must be a value between 0 (no debug) and 3"
Vincent Coubard 638:c90ae1400bf2 72 #endif
Vincent Coubard 638:c90ae1400bf2 73 /*=========================================================================*/
Vincent Coubard 638:c90ae1400bf2 74
Vincent Coubard 638:c90ae1400bf2 75
Vincent Coubard 638:c90ae1400bf2 76 /*=========================================================================
Vincent Coubard 638:c90ae1400bf2 77 GENERAL NRF51 PERIPHERAL SETTINGS
Vincent Coubard 638:c90ae1400bf2 78 -----------------------------------------------------------------------
Vincent Coubard 638:c90ae1400bf2 79
Vincent Coubard 638:c90ae1400bf2 80 CFG_SCHEDULER_ENABLE Set this to 'true' or 'false' depending on
Vincent Coubard 638:c90ae1400bf2 81 if you use the event scheduler or not
Vincent Coubard 638:c90ae1400bf2 82
Vincent Coubard 638:c90ae1400bf2 83 -----------------------------------------------------------------------*/
Vincent Coubard 638:c90ae1400bf2 84 #define CFG_SCHEDULER_ENABLE false
Vincent Coubard 638:c90ae1400bf2 85
Vincent Coubard 638:c90ae1400bf2 86 /*------------------------------- GPIOTE ------------------------------*/
Vincent Coubard 638:c90ae1400bf2 87 #define CFG_GPIOTE_MAX_USERS 1 /**< Maximum number of users of the GPIOTE handler. */
Vincent Coubard 638:c90ae1400bf2 88
Vincent Coubard 638:c90ae1400bf2 89 /*-------------------------------- TIMER ------------------------------*/
Vincent Coubard 638:c90ae1400bf2 90 #define CFG_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. freq = (32768/(PRESCALER+1)) */
Vincent Coubard 638:c90ae1400bf2 91 #define CFG_TIMER_MAX_INSTANCE 1 /**< Maximum number of simultaneously created timers. */
Vincent Coubard 638:c90ae1400bf2 92 #define CFG_TIMER_OPERATION_QUEUE_SIZE 2 /**< Size of timer operation queues. */
Vincent Coubard 638:c90ae1400bf2 93 /*=========================================================================*/
Vincent Coubard 638:c90ae1400bf2 94
Vincent Coubard 638:c90ae1400bf2 95
Vincent Coubard 638:c90ae1400bf2 96 /*=========================================================================
Vincent Coubard 638:c90ae1400bf2 97 BTLE SETTINGS
Vincent Coubard 638:c90ae1400bf2 98 -----------------------------------------------------------------------*/
Vincent Coubard 638:c90ae1400bf2 99
Vincent Coubard 638:c90ae1400bf2 100 #define CFG_BLE_TX_POWER_LEVEL 0 /**< in dBm (Valid values are -40, -20, -16, -12, -8, -4, 0, 4) */
Vincent Coubard 638:c90ae1400bf2 101
Vincent Coubard 638:c90ae1400bf2 102 /*---------------------------- BOND MANAGER ---------------------------*/
Vincent Coubard 638:c90ae1400bf2 103 #define CFG_BLE_BOND_FLASH_PAGE_BOND (BLE_FLASH_PAGE_END-1) /**< Flash page used for bond manager bonding information.*/
Vincent Coubard 638:c90ae1400bf2 104 #define CFG_BLE_BOND_FLASH_PAGE_SYS_ATTR (BLE_FLASH_PAGE_END-3) /**< Flash page used for bond manager system attribute information. TODO check if we can use BLE_FLASH_PAGE_END-2*/
Vincent Coubard 638:c90ae1400bf2 105 #define CFG_BLE_BOND_DELETE_BUTTON_NUM 0 /**< Button to press to delete bond details during init */
Vincent Coubard 638:c90ae1400bf2 106
Vincent Coubard 638:c90ae1400bf2 107 /*------------------------------ SECURITY -----------------------------*/
Vincent Coubard 638:c90ae1400bf2 108 #define CFG_BLE_SEC_PARAM_MITM 0 /**< Man In The Middle protection not required. */
Vincent Coubard 638:c90ae1400bf2 109 #define CFG_BLE_SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_NONE /**< No I/O capabilities. */
Vincent Coubard 638:c90ae1400bf2 110 #define CFG_BLE_SEC_PARAM_OOB 0 /**< Out Of Band data not available. */
Vincent Coubard 638:c90ae1400bf2 111 #define CFG_BLE_SEC_PARAM_MIN_KEY_SIZE 7 /**< Minimum encryption key size. */
Vincent Coubard 638:c90ae1400bf2 112 #define CFG_BLE_SEC_PARAM_MAX_KEY_SIZE 16
Vincent Coubard 638:c90ae1400bf2 113
Vincent Coubard 638:c90ae1400bf2 114 /*--------------------------------- GAP -------------------------------*/
Vincent Coubard 638:c90ae1400bf2 115 #define CFG_GAP_APPEARANCE GapAdvertisingData::GENERIC_TAG
Vincent Coubard 638:c90ae1400bf2 116 #define CFG_GAP_LOCAL_NAME "nRF5x"
Vincent Coubard 638:c90ae1400bf2 117
Vincent Coubard 638:c90ae1400bf2 118 #define CFG_GAP_CONNECTION_MIN_INTERVAL_MS 50 /**< Minimum acceptable connection interval */
Vincent Coubard 638:c90ae1400bf2 119 #define CFG_GAP_CONNECTION_MAX_INTERVAL_MS 500 /**< Maximum acceptable connection interval */
Vincent Coubard 638:c90ae1400bf2 120 #define CFG_GAP_CONNECTION_SUPERVISION_TIMEOUT_MS 4000 /**< Connection supervisory timeout */
Vincent Coubard 638:c90ae1400bf2 121 #define CFG_GAP_CONNECTION_SLAVE_LATENCY 0 /**< Slave Latency in number of connection events. */
Vincent Coubard 638:c90ae1400bf2 122
Vincent Coubard 638:c90ae1400bf2 123 #define CFG_GAP_ADV_INTERVAL_MS 25 /**< The advertising interval in miliseconds, should be multiply of 0.625 */
Vincent Coubard 638:c90ae1400bf2 124 #define CFG_GAP_ADV_TIMEOUT_S 180 /**< The advertising timeout in units of seconds. */
Vincent Coubard 638:c90ae1400bf2 125 /*=========================================================================*/
Vincent Coubard 638:c90ae1400bf2 126
Vincent Coubard 638:c90ae1400bf2 127
Vincent Coubard 638:c90ae1400bf2 128 /*=========================================================================
Vincent Coubard 638:c90ae1400bf2 129 VALIDATION
Vincent Coubard 638:c90ae1400bf2 130 -----------------------------------------------------------------------*/
Vincent Coubard 638:c90ae1400bf2 131 #if CFG_BLE_TX_POWER_LEVEL != -40 && CFG_BLE_TX_POWER_LEVEL != -20 && CFG_BLE_TX_POWER_LEVEL != -16 && CFG_BLE_TX_POWER_LEVEL != -12 && CFG_BLE_TX_POWER_LEVEL != -8 && CFG_BLE_TX_POWER_LEVEL != -4 && CFG_BLE_TX_POWER_LEVEL != 0 && CFG_BLE_TX_POWER_LEVEL != 4
Vincent Coubard 638:c90ae1400bf2 132 #error "CFG_BLE_TX_POWER_LEVEL must be -40, -20, -16, -12, -8, -4, 0 or 4"
Vincent Coubard 638:c90ae1400bf2 133 #endif
Vincent Coubard 638:c90ae1400bf2 134 /*=========================================================================*/
Vincent Coubard 638:c90ae1400bf2 135
Vincent Coubard 638:c90ae1400bf2 136 #endif /* _PROJECTCONFIG_H_ */