Skip to content

Commit a144e1e

Browse files
committed
lib: at_host: refactor find at_host_uart device
Use preprocessor macro to get the uart device to use. Signed-off-by: Andreas Moltumyr <[email protected]>
1 parent ba4a37e commit a144e1e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/at_host/at_host.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ enum term_modes {
3333
MODE_COUNT /* Counter of term_modes */
3434
};
3535

36+
#define AT_HOST_UART_DEV_GET() \
37+
DEVICE_DT_GET(COND_CODE_1(DT_HAS_CHOSEN(ncs_at_host_uart), \
38+
(DT_CHOSEN(ncs_at_host_uart)), (DT_NODELABEL(uart0))))
39+
3640
static enum term_modes term_mode;
37-
#if DT_HAS_CHOSEN(ncs_at_host_uart)
38-
static const struct device *const uart_dev = DEVICE_DT_GET(DT_CHOSEN(ncs_at_host_uart));
39-
#else
40-
static const struct device *const uart_dev = DEVICE_DT_GET(DT_NODELABEL(uart0));
41-
#endif
41+
static const struct device *const uart_dev = AT_HOST_UART_DEV_GET();
4242
static bool at_buf_busy; /* Guards at_buf while processing a command */
4343
static char at_buf[AT_BUF_SIZE]; /* AT command and modem response buffer */
4444
static struct k_work_q at_host_work_q;

0 commit comments

Comments
 (0)