Skip to content

Commit

Permalink
zephyrSerial: Fix misdetection arduino_serial1
Browse files Browse the repository at this point in the history
DT_NODE_EXISTS value is true even if the status is disabled,
so it caused misdetection.
Use DT_NODE_HAS_STATUS to detect the status of
the arduino_serial1 node is ok.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
  • Loading branch information
soburi authored and DhruvaG2000 committed Sep 11, 2023
1 parent b252469 commit aa2150b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cores/arduino/zephyrSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ arduino::ZephyrSerial Serial(DEVICE_DT_GET(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user

DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), serials, DECLARE_SERIAL_N)
#endif // PROP_LEN(serials) > 1
#elif DT_NODE_EXISTS(DT_NODELABEL(arduino_serial))
#elif DT_NODE_HAS_STATUS(DT_NODELABEL(arduino_serial), okay)
/* If serials node is not defined, tries to use arduino_serial */
arduino::ZephyrSerial Serial(DEVICE_DT_GET(DT_NODELABEL(arduino_serial)));
#else
Expand Down
2 changes: 1 addition & 1 deletion cores/arduino/zephyrSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), serials, DECLARE_EXTERN_SERIAL_N)
#undef EXTERN_SERIAL_N
#undef SERIAL_DEFINED_0
#endif
#elif DT_NODE_EXISTS(DT_NODELABEL(arduino_serial))
#elif DT_NODE_HAS_STATUS(DT_NODELABEL(arduino_serial), okay)
extern arduino::ZephyrSerial Serial;
#else
extern arduino::ZephyrSerialStub Serial;
Expand Down

0 comments on commit aa2150b

Please sign in to comment.