bugfix for duplicate symbol
Fork of nRF51822 by
projectconfig.h@56:a1071b629aa3, 2014-09-02 (annotated)
- Committer:
- Rohit Grover
- Date:
- Tue Sep 02 15:50:05 2014 +0100
- Revision:
- 56:a1071b629aa3
- Parent:
- 53:1e5c300cec7f
- Child:
- 90:0c883639fbd2
Release 0.1.0
=============
We've achieved significant gains in power consumption: the BLE_Beacon demo now
runs at around 35uA of average current broadcasting once a second at 0dB; when
not using the radio, this demo consumes around 7uA.
Features
~~~~~~~~
- Replace initialization of high-frequency external crystal clock-source with
the use of low-frequency clock. This brings in significant gains in power
consumption.
- Re-implement the micro-second timer on nRF51 using the app_timer module
(which internally uses RTC). This limits the precision of the us_Timer to
30uS; but brings in significant gains in power consumption.
- Reduce the number of available app_timers and the event depths for app-timer
events; this will reduce memory consumption for zero-initialized data by
around 1K.
- Remove the call to conn_params_init() at startup. This is not mandatory; and
was causing an unnecessary re-negotiation of connection parameters a few
seconds into every connection.
- Reduce default transmission power level to 0dbB (was 4dbB before).
- Reduce min connection interval to 50ms and max to 500ms (previous values
were much larger).
- Replace a few instances of use of wait() with nrf_delay_us().
- onConnection() callback now receives connection-parameters applicable to the
new connection.
- onDataSent() callback now receives a count parameter containing the number of
times notifications were sent out since the last callback.
- A 'reason' parameter has been added to Gap::disconnect() to indicate the
reason for disconnection; and also to the onDisconnection callback to
receive a reason from the remote host.
- disable the app_gpiote module by default.
Bugfixes
~~~~~~~~
- onDataWritten() callback now passes an additional parameter
(GattServer::WriteEventCallback_t) encapsulating the update. This avoids
having to re-fetch the updated characteristic's value attribute. It also
fixes a bug where multiple updates to the characteristic's value-attribute
could get clobbered if they occurred in quick succession before the
callbacks could be processed.
Compatibility
~~~~~~~~~~~~~
Compatible with revision 0.1.0 of the BLE_API.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:eff01767de02 | 1 | /* mbed Microcontroller Library |
bogdanm | 0:eff01767de02 | 2 | * Copyright (c) 2006-2013 ARM Limited |
bogdanm | 0:eff01767de02 | 3 | * |
bogdanm | 0:eff01767de02 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
bogdanm | 0:eff01767de02 | 5 | * you may not use this file except in compliance with the License. |
bogdanm | 0:eff01767de02 | 6 | * You may obtain a copy of the License at |
bogdanm | 0:eff01767de02 | 7 | * |
bogdanm | 0:eff01767de02 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
bogdanm | 0:eff01767de02 | 9 | * |
bogdanm | 0:eff01767de02 | 10 | * Unless required by applicable law or agreed to in writing, software |
bogdanm | 0:eff01767de02 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
bogdanm | 0:eff01767de02 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
bogdanm | 0:eff01767de02 | 13 | * See the License for the specific language governing permissions and |
bogdanm | 0:eff01767de02 | 14 | * limitations under the License. |
bogdanm | 0:eff01767de02 | 15 | */ |
bogdanm | 0:eff01767de02 | 16 | |
bogdanm | 0:eff01767de02 | 17 | #ifndef _PROJECTCONFIG_H_ |
bogdanm | 0:eff01767de02 | 18 | #define _PROJECTCONFIG_H_ |
bogdanm | 0:eff01767de02 | 19 | |
Rohit Grover |
53:1e5c300cec7f | 20 | #include "blecommon.h" |
Rohit Grover |
53:1e5c300cec7f | 21 | |
bogdanm | 0:eff01767de02 | 22 | /*========================================================================= |
bogdanm | 0:eff01767de02 | 23 | MCU & BOARD SELCTION |
bogdanm | 0:eff01767de02 | 24 | |
bogdanm | 0:eff01767de02 | 25 | CFG_BOARD is one of the value defined in board.h |
bogdanm | 0:eff01767de02 | 26 | -----------------------------------------------------------------------*/ |
bogdanm | 0:eff01767de02 | 27 | #define CFG_BOARD BOARD_PCA10001 |
bogdanm | 0:eff01767de02 | 28 | #define CFG_MCU_STRING "nRF51822" |
bogdanm | 0:eff01767de02 | 29 | /*=========================================================================*/ |
bogdanm | 0:eff01767de02 | 30 | |
bogdanm | 0:eff01767de02 | 31 | |
bogdanm | 0:eff01767de02 | 32 | /*========================================================================= |
bogdanm | 0:eff01767de02 | 33 | CODE BASE VERSION SETTINGS |
bogdanm | 0:eff01767de02 | 34 | |
bogdanm | 0:eff01767de02 | 35 | Please do not modify this version number. To set a version number |
bogdanm | 0:eff01767de02 | 36 | for your project or firmware, change the values in your 'boards/' |
bogdanm | 0:eff01767de02 | 37 | config file. |
bogdanm | 0:eff01767de02 | 38 | -----------------------------------------------------------------------*/ |
bogdanm | 0:eff01767de02 | 39 | #define CFG_CODEBASE_VERSION_MAJOR 0 |
bogdanm | 0:eff01767de02 | 40 | #define CFG_CODEBASE_VERSION_MINOR 1 |
bogdanm | 0:eff01767de02 | 41 | #define CFG_CODEBASE_VERSION_REVISION 0 |
bogdanm | 0:eff01767de02 | 42 | /*=========================================================================*/ |
bogdanm | 0:eff01767de02 | 43 | |
bogdanm | 0:eff01767de02 | 44 | |
bogdanm | 0:eff01767de02 | 45 | /*========================================================================= |
bogdanm | 0:eff01767de02 | 46 | FIRMWARE VERSION SETTINGS |
bogdanm | 0:eff01767de02 | 47 | -----------------------------------------------------------------------*/ |
bogdanm | 0:eff01767de02 | 48 | #define CFG_FIRMWARE_VERSION_MAJOR 0 |
bogdanm | 0:eff01767de02 | 49 | #define CFG_FIRMWARE_VERSION_MINOR 0 |
bogdanm | 0:eff01767de02 | 50 | #define CFG_FIRMWARE_VERSION_REVISION 0 |
bogdanm | 0:eff01767de02 | 51 | /*=========================================================================*/ |
bogdanm | 0:eff01767de02 | 52 | |
bogdanm | 0:eff01767de02 | 53 | |
bogdanm | 0:eff01767de02 | 54 | /*========================================================================= |
bogdanm | 0:eff01767de02 | 55 | DEBUG LEVEL |
bogdanm | 0:eff01767de02 | 56 | ----------------------------------------------------------------------- |
bogdanm | 0:eff01767de02 | 57 | |
bogdanm | 0:eff01767de02 | 58 | CFG_DEBUG Level 3: Full debug output, any failed assert |
bogdanm | 0:eff01767de02 | 59 | will produce a breakpoint for the |
bogdanm | 0:eff01767de02 | 60 | debugger |
bogdanm | 0:eff01767de02 | 61 | Level 2: ATTR_ALWAYS_INLINE is null, ASSERT |
bogdanm | 0:eff01767de02 | 62 | has text |
bogdanm | 0:eff01767de02 | 63 | Level 1: ATTR_ALWAYS_INLINE is an attribute, |
bogdanm | 0:eff01767de02 | 64 | ASSERT has no text |
bogdanm | 0:eff01767de02 | 65 | Level 0: No debug information generated |
bogdanm | 0:eff01767de02 | 66 | |
bogdanm | 0:eff01767de02 | 67 | -----------------------------------------------------------------------*/ |
Rohit Grover |
26:dade7d2857b4 | 68 | #define CFG_DEBUG (1) |
bogdanm | 0:eff01767de02 | 69 | |
bogdanm | 0:eff01767de02 | 70 | #if (CFG_DEBUG > 3) || (CFG_DEBUG < 0) |
bogdanm | 0:eff01767de02 | 71 | #error "CFG_DEBUG must be a value between 0 (no debug) and 3" |
bogdanm | 0:eff01767de02 | 72 | #endif |
bogdanm | 0:eff01767de02 | 73 | /*=========================================================================*/ |
bogdanm | 0:eff01767de02 | 74 | |
bogdanm | 0:eff01767de02 | 75 | |
bogdanm | 0:eff01767de02 | 76 | /*========================================================================= |
bogdanm | 0:eff01767de02 | 77 | GENERAL NRF51 PERIPHERAL SETTINGS |
bogdanm | 0:eff01767de02 | 78 | ----------------------------------------------------------------------- |
bogdanm | 0:eff01767de02 | 79 | |
bogdanm | 0:eff01767de02 | 80 | CFG_SCHEDULER_ENABLE Set this to 'true' or 'false' depending on |
bogdanm | 0:eff01767de02 | 81 | if you use the event scheduler or not |
bogdanm | 0:eff01767de02 | 82 | |
bogdanm | 0:eff01767de02 | 83 | -----------------------------------------------------------------------*/ |
bogdanm | 0:eff01767de02 | 84 | #define CFG_SCHEDULER_ENABLE false |
bogdanm | 0:eff01767de02 | 85 | |
bogdanm | 0:eff01767de02 | 86 | /*------------------------------- GPIOTE ------------------------------*/ |
bogdanm | 0:eff01767de02 | 87 | #define CFG_GPIOTE_MAX_USERS 1 /**< Maximum number of users of the GPIOTE handler. */ |
bogdanm | 0:eff01767de02 | 88 | |
bogdanm | 0:eff01767de02 | 89 | /*-------------------------------- TIMER ------------------------------*/ |
bogdanm | 0:eff01767de02 | 90 | #define CFG_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. freq = (32768/(PRESCALER+1)) */ |
Rohit Grover |
56:a1071b629aa3 | 91 | #define CFG_TIMER_MAX_INSTANCE 1 /**< Maximum number of simultaneously created timers. */ |
Rohit Grover |
56:a1071b629aa3 | 92 | #define CFG_TIMER_OPERATION_QUEUE_SIZE 1 /**< Size of timer operation queues. */ |
bogdanm | 0:eff01767de02 | 93 | /*=========================================================================*/ |
bogdanm | 0:eff01767de02 | 94 | |
bogdanm | 0:eff01767de02 | 95 | |
bogdanm | 0:eff01767de02 | 96 | /*========================================================================= |
bogdanm | 0:eff01767de02 | 97 | BTLE SETTINGS |
bogdanm | 0:eff01767de02 | 98 | -----------------------------------------------------------------------*/ |
bogdanm | 0:eff01767de02 | 99 | |
Rohit Grover |
56:a1071b629aa3 | 100 | #define CFG_BLE_TX_POWER_LEVEL 0 /**< in dBm (Valid values are -40, -20, -16, -12, -8, -4, 0, 4) */ |
bogdanm | 0:eff01767de02 | 101 | |
bogdanm | 0:eff01767de02 | 102 | /*---------------------------- BOND MANAGER ---------------------------*/ |
bogdanm | 0:eff01767de02 | 103 | #define CFG_BLE_BOND_FLASH_PAGE_BOND (BLE_FLASH_PAGE_END-1) /**< Flash page used for bond manager bonding information.*/ |
bogdanm | 0:eff01767de02 | 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*/ |
bogdanm | 0:eff01767de02 | 105 | #define CFG_BLE_BOND_DELETE_BUTTON_NUM 0 /**< Button to press to delete bond details during init */ |
bogdanm | 0:eff01767de02 | 106 | |
bogdanm | 0:eff01767de02 | 107 | /*------------------------------ SECURITY -----------------------------*/ |
bogdanm | 0:eff01767de02 | 108 | #define CFG_BLE_SEC_PARAM_MITM 0 /**< Man In The Middle protection not required. */ |
bogdanm | 0:eff01767de02 | 109 | #define CFG_BLE_SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_NONE /**< No I/O capabilities. */ |
bogdanm | 0:eff01767de02 | 110 | #define CFG_BLE_SEC_PARAM_OOB 0 /**< Out Of Band data not available. */ |
bogdanm | 0:eff01767de02 | 111 | #define CFG_BLE_SEC_PARAM_MIN_KEY_SIZE 7 /**< Minimum encryption key size. */ |
bogdanm | 0:eff01767de02 | 112 | #define CFG_BLE_SEC_PARAM_MAX_KEY_SIZE 16 |
bogdanm | 0:eff01767de02 | 113 | |
bogdanm | 0:eff01767de02 | 114 | /*--------------------------------- GAP -------------------------------*/ |
bogdanm | 0:eff01767de02 | 115 | #define CFG_GAP_APPEARANCE BLE_APPEARANCE_GENERIC_TAG |
bogdanm | 0:eff01767de02 | 116 | #define CFG_GAP_LOCAL_NAME "nRF5x" |
bogdanm | 0:eff01767de02 | 117 | |
Rohit Grover |
56:a1071b629aa3 | 118 | #define CFG_GAP_CONNECTION_MIN_INTERVAL_MS 50 /**< Minimum acceptable connection interval */ |
Rohit Grover |
56:a1071b629aa3 | 119 | #define CFG_GAP_CONNECTION_MAX_INTERVAL_MS 500 /**< Maximum acceptable connection interval */ |
bogdanm | 0:eff01767de02 | 120 | #define CFG_GAP_CONNECTION_SUPERVISION_TIMEOUT_MS 4000 /**< Connection supervisory timeout */ |
bogdanm | 0:eff01767de02 | 121 | #define CFG_GAP_CONNECTION_SLAVE_LATENCY 0 /**< Slave Latency in number of connection events. */ |
bogdanm | 0:eff01767de02 | 122 | |
bogdanm | 0:eff01767de02 | 123 | #define CFG_GAP_ADV_INTERVAL_MS 25 /**< The advertising interval in miliseconds, should be multiply of 0.625 */ |
bogdanm | 0:eff01767de02 | 124 | #define CFG_GAP_ADV_TIMEOUT_S 180 /**< The advertising timeout in units of seconds. */ |
bogdanm | 0:eff01767de02 | 125 | /*=========================================================================*/ |
bogdanm | 0:eff01767de02 | 126 | |
bogdanm | 0:eff01767de02 | 127 | |
bogdanm | 0:eff01767de02 | 128 | /*========================================================================= |
bogdanm | 0:eff01767de02 | 129 | VALIDATION |
bogdanm | 0:eff01767de02 | 130 | -----------------------------------------------------------------------*/ |
bogdanm | 0:eff01767de02 | 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 |
bogdanm | 0:eff01767de02 | 132 | #error "CFG_BLE_TX_POWER_LEVEL must be -40, -20, -16, -12, -8, -4, 0 or 4" |
bogdanm | 0:eff01767de02 | 133 | #endif |
bogdanm | 0:eff01767de02 | 134 | /*=========================================================================*/ |
bogdanm | 0:eff01767de02 | 135 | |
bogdanm | 0:eff01767de02 | 136 | #endif /* _PROJECTCONFIG_H_ */ |