Skip to content

Commit 28d0789

Browse files
ananglcarlescufi
authored andcommitted
tests: uart_mix_fifo_poll: Use "counter_dev" node label
This test needs a counter device. Introduce a node label that allows selecting one in dts overlays instead of using hard-coded `timer0`. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 7c6f2d7 commit 28d0789

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

tests/drivers/uart/uart_mix_fifo_poll/boards/nrf52840dk_nrf52840.overlay

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@
6464
interrupts = <17 2>;
6565
};
6666

67-
&timer0 {
67+
counter_dev: &timer0 {
6868
status = "okay";
6969
};

tests/drivers/uart/uart_mix_fifo_poll/boards/nrf5340dk_nrf5340_cpuapp.overlay

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@
3535
interrupts = <21 2>;
3636
};
3737

38-
&timer0 {
38+
counter_dev: &timer0 {
3939
status = "okay";
4040
};

tests/drivers/uart/uart_mix_fifo_poll/boards/nrf9160dk_nrf9160.overlay

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@
3535
interrupts = <21 2>;
3636
};
3737

38-
&timer0 {
38+
counter_dev: &timer0 {
3939
status = "okay";
4040
};

tests/drivers/uart/uart_mix_fifo_poll/src/main.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
#define UART_DEVICE_DEV DT_CHOSEN(zephyr_console)
3434
#endif
3535

36+
#if DT_NODE_EXISTS(DT_NODELABEL(counter_dev))
37+
#define COUNTER_NODE DT_NODELABEL(counter_dev)
38+
#else
39+
#define COUNTER_NODE DT_NODELABEL(timer0)
40+
#endif
41+
3642
struct rx_source {
3743
int cnt;
3844
uint8_t prev;
@@ -63,7 +69,7 @@ static struct test_data test_data[3];
6369
static struct test_data int_async_data;
6470

6571
static const struct device *const counter_dev =
66-
DEVICE_DT_GET(DT_NODELABEL(timer0));
72+
DEVICE_DT_GET(COUNTER_NODE);
6773
static const struct device *const uart_dev =
6874
DEVICE_DT_GET(UART_DEVICE_DEV);
6975

0 commit comments

Comments
 (0)