Skip to content
This repository was archived by the owner on Apr 24, 2019. It is now read-only.

Commit 598bdf0

Browse files
author
Antti Yli-Tokola
committed
Merge pull request #65 from ARMmbed/traces
Add support to get traces from mbed client library
2 parents b159337 + 2b29207 commit 598bdf0

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

module.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"license": "Apache-2.0",
1010
"extraIncludes": [],
1111
"dependencies": {
12-
"mbed-client": "^1.0.0"
12+
"mbed-client": "^1.0.0",
13+
"mbed-trace": "^1.0.0"
1314
},
1415
"targetDependencies": {},
1516
"bin": "./source/"

source/main.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <string>
2222
#include <sstream>
2323
#include <vector>
24+
#include "mbed-trace/mbed_trace.h"
2425

2526
using namespace mbed::util;
2627

@@ -43,6 +44,11 @@ MbedClient mbed_client(device);
4344
InterruptIn obs_button(SW2);
4445
InterruptIn unreg_button(SW3);
4546

47+
// debug printf function
48+
void trace_printer(const char* str) {
49+
printf("%s\r\n", str);
50+
}
51+
4652
// LED Output
4753
DigitalOut led1(LED1);
4854

@@ -196,7 +202,8 @@ void app_start(int /*argc*/, char* /*argv*/[]) {
196202
}
197203
output.printf("IP address %s\r\n", eth.getIPAddress());
198204
output.printf("Device name %s\r\n", MBED_ENDPOINT_NAME);
199-
205+
mbed_trace_init();
206+
mbed_trace_print_function_set(trace_printer);
200207
// we create our button and LED resources
201208
auto button_resource = new ButtonResource();
202209
auto led_resource = new LedResource();

0 commit comments

Comments
 (0)