From 4a4601e5e70f1f7ed305a92dd131a91ae676665f Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 24 Sep 2022 10:43:18 +0900 Subject: [PATCH] zephyrCommon: Add Print::write(uint8_t*, size_t) default implementation When compile with enabling CONFIG_DEBUG option, the Print::write virtual function failed to link. This implementation is usually not used. Because the override implementation that implements by the subclass will be used. Signed-off-by: TOKITA Hiroshi --- cores/arduino/CMakeLists.txt | 1 + cores/arduino/zephyrPrint.cpp | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 cores/arduino/zephyrPrint.cpp diff --git a/cores/arduino/CMakeLists.txt b/cores/arduino/CMakeLists.txt index e113d8de..b3b1af15 100644 --- a/cores/arduino/CMakeLists.txt +++ b/cores/arduino/CMakeLists.txt @@ -4,6 +4,7 @@ zephyr_include_directories(../../variants) if(NOT DEFINED ARDUINO_BUILD_PATH) +zephyr_sources(zephyrPrint.cpp) zephyr_sources(zephyrSerial.cpp) zephyr_sources(zephyrCommon.cpp) zephyr_sources(main.cpp) diff --git a/cores/arduino/zephyrPrint.cpp b/cores/arduino/zephyrPrint.cpp new file mode 100644 index 00000000..979f5ce5 --- /dev/null +++ b/cores/arduino/zephyrPrint.cpp @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/* + * This is the default implementation. + * It will be overridden by subclassese. + */ +size_t arduino::Print::write(const uint8_t *buffer, size_t size) +{ + size_t i; + for (i=0; i