1/*
2 * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230)
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#include <camkes.h>
8#include <string.h>
9#include <stdio.h>
10
11static size_t uart_write(void *buf, size_t count)
12{
13	char *data = buf;
14
15	for (size_t i = 0; i < count; ++i) {
16		uart_put_char(data[i]);
17	}
18
19	return count;
20}
21
22int run(void) {
23    char c;
24    char *str = "This message is sent via UART.\n";
25
26
27    uart_write(str, strlen(str));
28
29    while (1) {
30	c = uart_get_char();
31	printf("Input from UART: %c\n", c);
32
33	if (c == 'q') {
34		break;
35	}
36
37    }
38
39    printf("UART client exit...\n");
40    return 0;
41}
42