Skip to content

Commit cb5de7d

Browse files
committed
fixup! Add RIOT examples
Fix examples to build for all boards
1 parent ebff6cf commit cb5de7d

File tree

3 files changed

+20
-2
lines changed
  • examples/riot

3 files changed

+20
-2
lines changed

examples/riot/blinky/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,18 @@ DEVELHELP ?= 1
1212
# Change this to 0 show compiler invocation lines by default:
1313
QUIET ?= 1
1414

15+
# Enable networking
16+
USEMODULE += netdev_default
17+
USEMODULE += auto_init_gnrc_netif
18+
19+
# Enable sockets
20+
USEMODULE += gnrc_ipv6_default
21+
USEMODULE += sock_tcp
22+
USEMODULE += posix_sockets
23+
USEMODULE += posix_sleep
24+
USEMODULE += posix_inet
25+
26+
# Enable posix threads
27+
USEMODULE += pthread
28+
1529
include $(CURDIR)/../../../make/riot/riot.mk

examples/riot/testing_posix_tcp_ip_channel_server/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "reactor-uc/reactor-uc.h"
33
#include <sys/socket.h>
44
#include <unistd.h>
5+
#include <inttypes.h>
56

67
#define NUM_ITER 10
78

@@ -26,7 +27,7 @@ int main(void) {
2627
for (int i = 0; i < NUM_ITER; i++) {
2728
// waiting for messages from client
2829
TaggedMessage *message = channel.super.receive(&channel.super);
29-
printf("Received message with connection number %i and content %s\n", message->conn_id,
30+
printf("Received message with connection number %" PRIi32 " and content %s\n", message->conn_id,
3031
(char *)message->payload.bytes);
3132

3233
channel.super.send(&channel.super, message);

examples/riot/testing_tcp_ip_channel_server_callback/main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#include "reactor-uc/federated.h"
22
#include "reactor-uc/platform/posix/tcp_ip_channel.h"
33
#include "reactor-uc/reactor-uc.h"
4+
#include <inttypes.h>
45
#include <sys/socket.h>
56
#include <unistd.h>
7+
68
TcpIpChannel channel;
79

810
void callback_handler(FederatedConnectionBundle *self, TaggedMessage *msg) {
911
(void)self;
10-
printf("Received message with connection number %i and content %s\n", msg->conn_id, (char *)msg->payload.bytes);
12+
printf("Received message with connection number %" PRIi32 " and content %s\n", msg->conn_id,
13+
(char *)msg->payload.bytes);
1114
channel.super.send(&channel.super, msg);
1215
}
1316

0 commit comments

Comments
 (0)