#include <zephyr.h>
#include <device.h>
#include <drivers/uart.h>
#include <logging/log.h>
LOG_MODULE_REGISTER(main);
#define GPS_UART DT_NODELABEL(gps)
void main(void) {
const struct device *uart_dev = DEVICE_DT_GET(GPS_UART);
if (!device_is_ready(uart_dev)) {
LOG_ERR("UART device not ready");
return;
}
uint8_t data;
while (1) {
if (uart_poll_in(uart_dev, &data) == 0) {
LOG_INF("Received: %c", data);
}
}
}
#include <zephyr.h>
#include <device.h>
#include <drivers/uart.h>
#include <logging/log.h>
LOG_MODULE_REGISTER(main);
#define GPS_UART DT_NODELABEL(gps)
void main(void) {
const struct device *uart_dev = DEVICE_DT_GET(GPS_UART);
if (!device_is_ready(uart_dev)) {
LOG_ERR("UART device not ready");
return;
}
uint8_t data;
while (1) {
if (uart_poll_in(uart_dev, &data) == 0) {
LOG_INF("Received: %c", data);
}
}
}