Skip to content

Commit 3408b9a

Browse files
authored
Merge pull request #2 from ARMmbed/mbed_cli_update
mbed OS 5 update
2 parents 2d6b114 + 3115556 commit 3408b9a

Some content is hidden

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

60 files changed

+417
-142
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*.lai
2121
*.la
2222
*.a
23-
*.lib
2423

2524
# Executables
2625
*.exe

BLE_BatteryLevel/.mbed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ROOT=.

BLE_BatteryLevel/.mbedignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
mbed-os/net/*
2+
mbed-os/uvisor-mbed-lib/*
3+
mbed-os/frameworks/*
4+
mbed-os/mbedtls/*

BLE_BatteryLevel/mbed-events.lib

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/ARMmbed/mbed-events.git#c621d7f80bb282ab1814e727f9c4f81a8538bf6f

BLE_BatteryLevel/mbed-os.lib

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/ARMmbed/mbed-os#b7b6dd2c8769251c66d68911f116ec899c7054f7

BLE_BatteryLevel/source/main.cpp

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
#include <mbed-events/events.h>
1718
#include "mbed-drivers/mbed.h"
1819
#include "ble/BLE.h"
1920
#include "ble/Gap.h"
@@ -27,6 +28,10 @@ static const uint16_t uuid16_list[] = {GattService::UUID_BATTERY_SERVICE};
2728
static uint8_t batteryLevel = 50;
2829
static BatteryService* batteryServicePtr;
2930

31+
static EventQueue eventQueue(
32+
/* event count */ 16 * /* event size */ 32
33+
);
34+
3035
void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params)
3136
{
3237
BLE::Instance().gap().startAdvertising();
@@ -47,7 +52,7 @@ void blinkCallback(void)
4752

4853
BLE &ble = BLE::Instance();
4954
if (ble.gap().getState().connected) {
50-
minar::Scheduler::postCallback(updateSensorValue);
55+
eventQueue.post(updateSensorValue);
5156
}
5257
}
5358

@@ -92,10 +97,22 @@ void bleInitComplete(BLE::InitializationCompleteCallbackContext *params)
9297
ble.gap().startAdvertising();
9398
}
9499

95-
void app_start(int, char**)
100+
void scheduleBleEventsProcessing(BLE::OnEventsToProcessCallbackContext* context) {
101+
BLE &ble = BLE::Instance();
102+
eventQueue.post(Callback<void()>(&ble, &BLE::processEvents));
103+
}
104+
105+
int main()
96106
{
97-
minar::Scheduler::postCallback(blinkCallback).period(minar::milliseconds(500));
107+
eventQueue.post_every(blinkCallback, 500);
98108

99109
BLE &ble = BLE::Instance();
110+
ble.onEventsToProcess(scheduleBleEventsProcessing);
100111
ble.init(bleInitComplete);
112+
113+
while (true) {
114+
eventQueue.dispatch();
115+
}
116+
117+
return 0;
101118
}

BLE_Beacon/.mbed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ROOT=.

BLE_Beacon/.mbedignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
mbed-os/net/*
2+
mbed-os/uvisor-mbed-lib/*
3+
mbed-os/frameworks/*
4+
mbed-os/mbedtls/*

BLE_Beacon/mbed-events.lib

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/ARMmbed/mbed-events.git#c621d7f80bb282ab1814e727f9c4f81a8538bf6f

BLE_Beacon/mbed-os.lib

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/ARMmbed/mbed-os#b7b6dd2c8769251c66d68911f116ec899c7054f7

0 commit comments

Comments
 (0)