Skip to content

Commit 7f14710

Browse files
committed
Merge branch 'master' of https://github.com/mbedmicro/mbed
2 parents 88fa03a + 47b9612 commit 7f14710

File tree

151 files changed

+108794
-119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+108794
-119
lines changed

libraries/ble/nordic_native/hw/GattServer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class GattServer
3838
/* These functions must be defined in the sub-class */
3939
virtual ble_error_t addService(GattService &) = 0;
4040
virtual ble_error_t readValue(uint16_t, uint8_t[], uint16_t) = 0;
41-
virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t) = 0;
41+
virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t, bool localOnly = false) = 0;
4242

4343
// ToDo: For updateValue, check the CCCD to see if the value we are
4444
// updating has the notify or indicate bits sent, and if BOTH are set

libraries/ble/nordic_native/hw/nRF51822n/nRF51Gap.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ ble_error_t nRF51Gap::startAdvertising(GapAdvertisingParams & params)
162162
return BLE_ERROR_PARAM_OUT_OF_RANGE;
163163
}
164164

165-
/* ToDo: Start Advertising */
165+
/* Start Advertising */
166166
ble_gap_adv_params_t adv_para = { 0 };
167167

168168
adv_para.type = params.getAdvertisingType() ;
@@ -174,7 +174,7 @@ ble_error_t nRF51Gap::startAdvertising(GapAdvertisingParams & params)
174174

175175
ASSERT( ERROR_NONE == sd_ble_gap_adv_start(&adv_para), BLE_ERROR_PARAM_OUT_OF_RANGE);
176176

177-
state.advertising = 1;
177+
state.advertising = 1;
178178

179179
return BLE_ERROR_NONE;
180180
}
@@ -197,12 +197,10 @@ ble_error_t nRF51Gap::startAdvertising(GapAdvertisingParams & params)
197197
/**************************************************************************/
198198
ble_error_t nRF51Gap::stopAdvertising(void)
199199
{
200-
/* ToDo: Stop Advertising */
200+
/* Stop Advertising */
201+
ASSERT( ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE);
201202

202-
/* ToDo: Check response */
203-
wait(0.1);
204-
205-
state.advertising = 0;
203+
state.advertising = 0;
206204

207205
return BLE_ERROR_NONE;
208206
}
@@ -225,10 +223,11 @@ ble_error_t nRF51Gap::stopAdvertising(void)
225223
/**************************************************************************/
226224
ble_error_t nRF51Gap::disconnect(void)
227225
{
228-
/* ToDo: Disconnect if we are connected to a central device */
229-
230-
state.advertising = 0;
231-
state.connected = 0;
226+
/* Disconnect if we are connected to a central device */
227+
// ASSERT( ERROR_NONE == sd_ble_gap_disconnect(), BLE_ERROR_PARAM_OUT_OF_RANGE);
228+
229+
state.advertising = 0;
230+
state.connected = 0;
232231

233232
return BLE_ERROR_NONE;
234233
}

libraries/ble/nordic_native/hw/nRF51822n/nRF51GattServer.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,13 @@ ble_error_t nRF51GattServer::readValue(uint16_t charHandle, uint8_t buffer[], ui
136136
@endcode
137137
*/
138138
/**************************************************************************/
139-
ble_error_t nRF51GattServer::updateValue(uint16_t charHandle, uint8_t buffer[], uint16_t len)
139+
ble_error_t nRF51GattServer::updateValue(uint16_t charHandle, uint8_t buffer[], uint16_t len, bool localOnly)
140140
{
141+
if (localOnly)
142+
{
143+
/* Only update locally regardless of notify/indicate */
144+
ASSERT_INT( ERROR_NONE, sd_ble_gatts_value_set(nrfCharacteristicHandles[charHandle].value_handle, 0, &len, buffer), BLE_ERROR_PARAM_OUT_OF_RANGE );
145+
}
141146
if ((p_characteristics[charHandle]->properties & (GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_INDICATE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY)) &&
142147
(m_connectionHandle != BLE_CONN_HANDLE_INVALID) )
143148
{

libraries/ble/nordic_native/hw/nRF51822n/nRF51GattServer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class nRF51GattServer : public GattServer
4343
/* Functions that must be implemented from GattServer */
4444
virtual ble_error_t addService(GattService &);
4545
virtual ble_error_t readValue(uint16_t, uint8_t[], uint16_t);
46-
virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t);
46+
virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t, bool localOnly = false);
4747

4848
/* nRF51 Functions */
4949
void eventCallback(void);

libraries/ble/nordic_native/hw/nRF51822n/nordic/nordic_global.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
116
#ifndef _NORDIC_GLOBAL_H_
217
#define _NORDIC_GLOBAL_H_
318

libraries/ble/nordic_native/hw/nRF51822n/nordic/softdevice_handler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
1+
/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
22
*
33
* The information contained herein is property of Nordic Semiconductor ASA.
44
* Terms and conditions of usage are described in detail in NORDIC
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
/* Linker script for STM32F407 */
2+
3+
/* Linker script to configure memory regions. */
4+
MEMORY
5+
{
6+
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
7+
CCM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
8+
RAM (rwx) : ORIGIN = 0x20000188, LENGTH = 128k - 0x188
9+
}
10+
11+
/* Linker script to place sections and symbol values. Should be used together
12+
* with other linker script that defines memory regions FLASH and RAM.
13+
* It references following symbols, which must be defined in code:
14+
* Reset_Handler : Entry of reset handler
15+
*
16+
* It defines following symbols, which code can use without definition:
17+
* __exidx_start
18+
* __exidx_end
19+
* __etext
20+
* __data_start__
21+
* __preinit_array_start
22+
* __preinit_array_end
23+
* __init_array_start
24+
* __init_array_end
25+
* __fini_array_start
26+
* __fini_array_end
27+
* __data_end__
28+
* __bss_start__
29+
* __bss_end__
30+
* __end__
31+
* end
32+
* __HeapLimit
33+
* __StackLimit
34+
* __StackTop
35+
* __stack
36+
*/
37+
ENTRY(Reset_Handler)
38+
39+
SECTIONS
40+
{
41+
.text :
42+
{
43+
KEEP(*(.isr_vector))
44+
*(.text*)
45+
/* KEEP(.ioview) */
46+
KEEP(*(.init))
47+
KEEP(*(.fini))
48+
49+
/* .ctors */
50+
*crtbegin.o(.ctors)
51+
*crtbegin?.o(.ctors)
52+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
53+
*(SORT(.ctors.*))
54+
*(.ctors)
55+
56+
/* .dtors */
57+
*crtbegin.o(.dtors)
58+
*crtbegin?.o(.dtors)
59+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
60+
*(SORT(.dtors.*))
61+
*(.dtors)
62+
63+
*(.rodata*)
64+
65+
KEEP(*(.eh_frame*))
66+
} > FLASH
67+
68+
.ARM.extab :
69+
{
70+
*(.ARM.extab* .gnu.linkonce.armextab.*)
71+
} > FLASH
72+
73+
__exidx_start = .;
74+
.ARM.exidx :
75+
{
76+
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
77+
} > FLASH
78+
__exidx_end = .;
79+
80+
__etext = .;
81+
_sidata = .;
82+
83+
.data : AT (__etext)
84+
{
85+
__data_start__ = .;
86+
_sdata = .;
87+
*(vtable)
88+
*(.data*)
89+
90+
. = ALIGN(4);
91+
/* preinit data */
92+
PROVIDE_HIDDEN (__preinit_array_start = .);
93+
KEEP(*(.preinit_array))
94+
PROVIDE_HIDDEN (__preinit_array_end = .);
95+
96+
. = ALIGN(4);
97+
/* init data */
98+
PROVIDE_HIDDEN (__init_array_start = .);
99+
KEEP(*(SORT(.init_array.*)))
100+
KEEP(*(.init_array))
101+
PROVIDE_HIDDEN (__init_array_end = .);
102+
103+
104+
. = ALIGN(4);
105+
/* finit data */
106+
PROVIDE_HIDDEN (__fini_array_start = .);
107+
KEEP(*(SORT(.fini_array.*)))
108+
KEEP(*(.fini_array))
109+
PROVIDE_HIDDEN (__fini_array_end = .);
110+
111+
KEEP(*(.jcr*))
112+
. = ALIGN(4);
113+
/* All data end */
114+
__data_end__ = .;
115+
_edata = .;
116+
117+
} > RAM
118+
119+
.bss :
120+
{
121+
. = ALIGN(4);
122+
__bss_start__ = .;
123+
_sbss = .;
124+
*(.bss*)
125+
*(COMMON)
126+
. = ALIGN(4);
127+
__bss_end__ = .;
128+
_ebss = .;
129+
} > RAM
130+
131+
.heap (COPY):
132+
{
133+
__end__ = .;
134+
end = __end__;
135+
*(.heap*)
136+
__HeapLimit = .;
137+
} > RAM
138+
139+
/* .stack_dummy section doesn't contains any symbols. It is only
140+
* used for linker to calculate size of stack sections, and assign
141+
* values to stack symbols later */
142+
.stack_dummy (COPY):
143+
{
144+
*(.stack*)
145+
} > RAM
146+
147+
/* Set stack top to end of RAM, and stack limit move down by
148+
* size of stack_dummy section */
149+
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
150+
_estack = __StackTop;
151+
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
152+
PROVIDE(__stack = __StackTop);
153+
154+
/* Check if data + heap + stack exceeds RAM limit */
155+
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
156+
}
157+

0 commit comments

Comments
 (0)