blob: 18e45641866b880083234133fd0e8afebde1b8fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include <stdbool.h>
#include <zephyr/device.h>
#include <zephyr/drivers/uart.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/util.h>
#include "data_link.h"
#define UART_DEVICE_NODE DT_CHOSEN(zephyr_shell_uart)
static const struct device *const uart_dev = DEVICE_DT_GET(UART_DEVICE_NODE);
int main(void)
{
if (!device_is_ready(uart_dev)) {
printk("UART device not found!");
return 0;
}
uint8_t frame[] = {0xDE, DL_SLIP_END, DL_SLIP_ESC, 0xAD};
while (true) {
k_sleep(K_MSEC(1000));
dl_send_frame(uart_dev, frame, ARRAY_SIZE(frame));
}
return 0;
}
|