Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
466e235
wire
soburi Feb 23, 2026
1db1fd3
Revert "x"
soburi Feb 23, 2026
656adfb
Revert "x"
soburi Feb 23, 2026
7a4e60e
x
soburi Feb 21, 2026
68db9ed
x
soburi Feb 23, 2026
04c1aec
x
soburi Feb 23, 2026
eaba0dc
x
soburi Feb 24, 2026
767b98e
x
soburi Feb 24, 2026
d5d4dfe
x
soburi Feb 24, 2026
97d242a
x
soburi Feb 24, 2026
3ecbfb1
x
soburi Feb 24, 2026
d801c36
x
soburi Feb 24, 2026
a7d2c9a
x
soburi Feb 24, 2026
9dae731
x
soburi Feb 24, 2026
6d129d6
x
soburi Feb 24, 2026
a58608c
x
soburi Feb 24, 2026
727b8a7
x
soburi Feb 24, 2026
2526a17
x
soburi Feb 24, 2026
1fa2641
x
soburi Feb 24, 2026
3a87736
x
soburi Feb 24, 2026
d0b96e7
x
soburi Feb 24, 2026
9f2a8bc
x
soburi Feb 24, 2026
99fb903
x
soburi Feb 24, 2026
94bbe02
x
soburi Feb 24, 2026
80bc31c
x
soburi Feb 24, 2026
85629e9
x
soburi Feb 24, 2026
cbe0ba1
x
soburi Feb 24, 2026
ee85991
x
soburi Feb 24, 2026
67516a6
x
soburi Feb 24, 2026
6769f7e
x
soburi Feb 24, 2026
eb4bf71
x
soburi Feb 24, 2026
20b2c45
x
soburi Feb 24, 2026
c21537f
x
soburi Feb 24, 2026
882b16e
x
soburi Feb 24, 2026
de2e36b
x
soburi Feb 24, 2026
92452bf
x
soburi Feb 24, 2026
b32b779
x
soburi Feb 24, 2026
67cf8de
x
soburi Feb 24, 2026
c9b9d11
x
soburi Feb 24, 2026
084aa8a
x
soburi Feb 24, 2026
3759945
x
soburi Feb 24, 2026
4034f46
x
soburi Feb 24, 2026
83c3ade
x
soburi Feb 24, 2026
4c2345e
x
soburi Feb 24, 2026
0e7b6ac
x
soburi Feb 24, 2026
7bb4552
x
soburi Feb 24, 2026
c47e18a
x
soburi Feb 25, 2026
55327a3
x
soburi Feb 25, 2026
969e633
x
soburi Feb 25, 2026
db3ac80
x
soburi Feb 25, 2026
faa9d1d
x
soburi Feb 25, 2026
c3e9e77
x
soburi Feb 25, 2026
00ca28f
x
soburi Feb 25, 2026
d908a9b
x
soburi Feb 25, 2026
a16d4dc
x
soburi Feb 25, 2026
e0953ae
x
soburi Feb 25, 2026
6da82c1
x
soburi Feb 25, 2026
3d2adab
x
soburi Feb 25, 2026
2c47873
x
soburi Feb 25, 2026
42b9c85
x
soburi Feb 25, 2026
92a766d
x
soburi Feb 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 2 additions & 69 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,75 +18,8 @@ if (CONFIG_ARDUINO_API)
zephyr_include_directories(${variant_dir})

if (CONFIG_USE_ARDUINO_API_RUST_IMPLEMENTATION)
# quote from https://github.com/zephyrproject-rtos/zephyr-lang-rust/blob/main/CMakeLists.txt
function (rust_target_arch RUST_TARGET)
# Map Zephyr targets to LLVM targets.
if(CONFIG_CPU_CORTEX_M)
if(CONFIG_CPU_CORTEX_M0 OR CONFIG_CPU_CORTEX_M0PLUS OR CONFIG_CPU_CORTEX_M1)
set(${RUST_TARGET} "thumbv6m-none-eabi" PARENT_SCOPE)
elseif(CONFIG_CPU_CORTEX_M3)
set(${RUST_TARGET} "thumbv7m-none-eabi" PARENT_SCOPE)
elseif(CONFIG_CPU_CORTEX_M4 OR CONFIG_CPU_CORTEX_M7)
if(CONFIG_FP_HARDABI OR FORCE_FP_HARDABI)
set(${RUST_TARGET} "thumbv7em-none-eabihf" PARENT_SCOPE)
else()
set(${RUST_TARGET} "thumbv7em-none-eabi" PARENT_SCOPE)
endif()
elseif(CONFIG_CPU_CORTEX_M23)
set(${RUST_TARGET} "thumbv8m.base-none-eabi" PARENT_SCOPE)
elseif(CONFIG_CPU_CORTEX_M33 OR CONFIG_CPU_CORTEX_M55)
# Not a typo, Zephyr, uses ARMV7_M_ARMV8_M_FP to select the FP even on v8m.
if(CONFIG_FP_HARDABI OR FORCE_FP_HARDABI)
set(${RUST_TARGET} "thumbv8m.main-none-eabihf" PARENT_SCOPE)
else()
set(${RUST_TARGET} "thumbv8m.main-none-eabi" PARENT_SCOPE)
endif()

# Todo: The M55 is thumbv8.1m.main-none-eabi, which can be added when Rust
# gain support for this target.
else()
message(FATAL_ERROR "Unknown Cortex-M target.")
endif()
elseif(CONFIG_RISCV)
if(CONFIG_RISCV_ISA_RV64I)
# TODO: Should fail if the extensions don't match.
set(${RUST_TARGET} "riscv64imac-unknown-none-elf" PARENT_SCOPE)
elseif(CONFIG_RISCV_ISA_RV32I)
# TODO: We have multiple choices, try to pick the best.
set(${RUST_TARGET} "riscv32i-unknown-none-elf" PARENT_SCOPE)
else()
message(FATAL_ERROR "Rust: Unsupported riscv ISA")
endif()
elseif(CONFIG_ARCH_POSIX AND CONFIG_64BIT AND (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "x86_64"))
set(${RUST_TARGET} "x86_64-unknown-none" PARENT_SCOPE)
elseif(CONFIG_ARCH_POSIX AND CONFIG_64BIT AND (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "aarch64"))
set(${RUST_TARGET} "aarch64-unknown-none" PARENT_SCOPE)
else()
message(FATAL_ERROR "Rust: Add support for other target")
endif()
endfunction()

rust_target_arch(RUST_TARGET_TRIPLE)

set(RUST_CRATE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rust)
set(RUST_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/rust)
set(RUST_LIB ${RUST_OUT_DIR}/target/${RUST_TARGET_TRIPLE}/release/libarduinocore_api_rust.a)

add_custom_command(
OUTPUT ${RUST_LIB}
COMMAND ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${RUST_OUT_DIR}/target
cargo build --manifest-path ${RUST_CRATE_DIR}/Cargo.toml
--target ${RUST_TARGET_TRIPLE} --release
WORKING_DIRECTORY ${RUST_CRATE_DIR}
COMMENT "Building Rust staticlib for ${RUST_TARGET}"
VERBATIM
)

add_custom_target(arduinocore_api_rust_build ALL DEPENDS ${RUST_LIB})
add_library(arduinocore_api_rust STATIC IMPORTED GLOBAL)
set_target_properties(arduinocore_api_rust PROPERTIES IMPORTED_LOCATION ${RUST_LIB})
zephyr_link_libraries(arduinocore_api_rust)
zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/zephyr/blobs/ArduinoCore-API/)
zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/alt_core_api)
add_subdirectory(alt_core_api)
else()
zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/zephyr/blobs/ArduinoCore-API/)
zephyr_sources(${CMAKE_CURRENT_SOURCE_DIR}/zephyr/blobs/ArduinoCore-API/api/CanMsg.cpp)
Expand Down
1 change: 1 addition & 0 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ if ARDUINO_API
config USE_ARDUINO_API_RUST_IMPLEMENTATION
bool "Use Rust implementation API core"
select RUST
select NANOPB

config QEMU_ICOUNT
bool "QEMU icount mode"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The **Arduino Core API** module for zephyr leverages the power of Zephyr under a

* [Using external Arduino Libraries](/documentation/arduino_libs.md)
* [Adding custom boards/ variants](/documentation/variants.md)
* [Arduino IDL code generation](/documentation/idl_codegen.md)

## Adding Arduino Core API to Zephyr

Expand Down
79 changes: 79 additions & 0 deletions alt_core_api/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# SPDX-License-Identifier: Apache-2.0

function(rust_target_arch RUST_TARGET)
# Map Zephyr targets to LLVM targets.
if(CONFIG_CPU_CORTEX_M)
if(CONFIG_CPU_CORTEX_M0 OR CONFIG_CPU_CORTEX_M0PLUS OR CONFIG_CPU_CORTEX_M1)
set(${RUST_TARGET} "thumbv6m-none-eabi" PARENT_SCOPE)
elseif(CONFIG_CPU_CORTEX_M3)
set(${RUST_TARGET} "thumbv7m-none-eabi" PARENT_SCOPE)
elseif(CONFIG_CPU_CORTEX_M4 OR CONFIG_CPU_CORTEX_M7)
if(CONFIG_FP_HARDABI OR FORCE_FP_HARDABI)
set(${RUST_TARGET} "thumbv7em-none-eabihf" PARENT_SCOPE)
else()
set(${RUST_TARGET} "thumbv7em-none-eabi" PARENT_SCOPE)
endif()
elseif(CONFIG_CPU_CORTEX_M23)
set(${RUST_TARGET} "thumbv8m.base-none-eabi" PARENT_SCOPE)
elseif(CONFIG_CPU_CORTEX_M33 OR CONFIG_CPU_CORTEX_M55)
if(CONFIG_FP_HARDABI OR FORCE_FP_HARDABI)
set(${RUST_TARGET} "thumbv8m.main-none-eabihf" PARENT_SCOPE)
else()
set(${RUST_TARGET} "thumbv8m.main-none-eabi" PARENT_SCOPE)
endif()
else()
message(FATAL_ERROR "Unknown Cortex-M target.")
endif()
elseif(CONFIG_RISCV)
if(CONFIG_RISCV_ISA_RV64I)
set(${RUST_TARGET} "riscv64imac-unknown-none-elf" PARENT_SCOPE)
elseif(CONFIG_RISCV_ISA_RV32I)
set(${RUST_TARGET} "riscv32i-unknown-none-elf" PARENT_SCOPE)
else()
message(FATAL_ERROR "Rust: Unsupported riscv ISA")
endif()
elseif(CONFIG_ARCH_POSIX AND CONFIG_64BIT AND (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "x86_64"))
set(${RUST_TARGET} "x86_64-unknown-none" PARENT_SCOPE)
elseif(CONFIG_ARCH_POSIX AND CONFIG_64BIT AND (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "aarch64"))
set(${RUST_TARGET} "aarch64-unknown-none" PARENT_SCOPE)
else()
message(FATAL_ERROR "Rust: Add support for other target")
endif()
endfunction()

rust_target_arch(RUST_TARGET_TRIPLE)

if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/rust/Cargo.toml)
set(RUST_CRATE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rust)
else()
set(RUST_CRATE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../rust)
endif()
set(RUST_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/rust)
set(RUST_LIB ${RUST_OUT_DIR}/target/${RUST_TARGET_TRIPLE}/release/libarduinocore_api_rust.a)
set(RUST_SRCS
${RUST_CRATE_DIR}/src/lib.rs
${RUST_CRATE_DIR}/src/common.rs
)

add_custom_command(
OUTPUT ${RUST_LIB}
COMMAND ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${RUST_OUT_DIR}/target
cargo build --manifest-path ${RUST_CRATE_DIR}/Cargo.toml
--target ${RUST_TARGET_TRIPLE} --release
WORKING_DIRECTORY ${RUST_CRATE_DIR}
DEPENDS ${RUST_CRATE_DIR}/Cargo.toml ${RUST_SRCS}
COMMENT "Building Rust staticlib for ${RUST_TARGET_TRIPLE}"
VERBATIM
)

add_custom_target(arduinocore_api_rust_build ALL DEPENDS ${RUST_LIB})
add_library(arduinocore_api_rust STATIC IMPORTED GLOBAL)
set_target_properties(arduinocore_api_rust PROPERTIES IMPORTED_LOCATION ${RUST_LIB})
zephyr_link_libraries(arduinocore_api_rust)

add_subdirectory(idl)
add_subdirectory(api)

if(TARGET arduinocore_idl_generate_interfaces)
add_dependencies(app arduinocore_idl_generate_interfaces)
endif()
139 changes: 139 additions & 0 deletions alt_core_api/api/ArduinoAPI.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#pragma once

#ifdef __cplusplus
#include <cstdint>
#include <cstddef>
#else
#include <stdint.h>
#include <stddef.h>
#endif
#include <stdlib.h>

#include <zephyr/drivers/gpio.h>
#include <zephyr/sys/util.h>

#include "common_types.h"

//#ifdef __cplusplus
//extern "C" {
//#endif

typedef gpio_port_pins_t pin_size_t;

typedef void (*voidFuncPtr)(void);
typedef void (*voidFuncPtrParam)(void*);

void setup(void);
void loop(void);

void delay(unsigned long);

namespace arduino {
}

using namespace arduino;

template <class T> constexpr const T &max(const T &a, const T &b) {
return (a < b) ? b : a;
}

template <class T> constexpr const T &min(const T &a, const T &b) {
return (a < b) ? a : b;
}

#if 0
void yield(void);

void init(void);
void initVariant(void);
Comment on lines +44 to +48
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost the entire Arduino API surface is currently disabled by #if 0 (starting here), including core declarations like pinMode, digitalWrite, interrupt APIs, and the map/makeWord helpers. With the Rust implementation enabled, sketches including <Arduino.h> will not see these declarations and will fail to compile (e.g., the blinky sample calls pinMode/digitalWrite). Replace #if 0 with the intended feature guard or remove it so these APIs are declared.

Copilot uses AI. Check for mistakes.

int main() __attribute__((weak));

void pinMode(pin_size_t pinNumber, PinMode pinMode);
void digitalWrite(pin_size_t pinNumber, PinStatus status);
PinStatus digitalRead(pin_size_t pinNumber);
int analogRead(pin_size_t pinNumber);
void analogReference(uint8_t mode);
void analogWrite(pin_size_t pinNumber, int value);

unsigned long millis(void);
unsigned long micros(void);
void delay(unsigned long);
void delayMicroseconds(unsigned int us);
unsigned long pulseIn(pin_size_t pin, uint8_t state, unsigned long timeout);
unsigned long pulseInLong(pin_size_t pin, uint8_t state, unsigned long timeout);

void shiftOut(pin_size_t dataPin, pin_size_t clockPin, BitOrder bitOrder, uint8_t val);
uint8_t shiftIn(pin_size_t dataPin, pin_size_t clockPin, BitOrder bitOrder);

void attachInterrupt(pin_size_t interruptNumber, voidFuncPtr callback, PinStatus mode);
void attachInterruptParam(pin_size_t interruptNumber, voidFuncPtrParam callback, PinStatus mode, void* param);
void detachInterrupt(pin_size_t interruptNumber);

void setup(void);
void loop(void);

#ifdef __cplusplus
} // extern "C"
#endif

unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);

void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
void noTone(uint8_t _pin);

// WMath prototypes
long random(long);
long random(long, long);
void randomSeed(unsigned long);


extern "C" {
int32_t map_i32(int32_t x, int32_t in_min, int32_t in_max, int32_t out_min, int32_t out_max);
uint16_t makeWord_w(uint16_t w);
uint16_t makeWord_hl(uint8_t h, uint8_t l);
}

inline long map(long x, long in_min, long in_max, long out_min, long out_max)
{
return map_i32(x, in_min, in_max, out_min, out_max);
}

inline uint16_t makeWord(uint16_t w) {
return makeWord_w(w);
}

inline uint16_t makeWord(uint8_t h, uint8_t l) {
return makeWord_hl(h, l);
}

#define word(...) makeWord(__VA_ARGS__)

#ifdef __cplusplus
template<class T, class L>
auto min(const T& a, const L& b) -> decltype((b < a) ? b : a)
{
return (b < a) ? b : a;
}

template<class T, class L>
auto max(const T& a, const L& b) -> decltype((b < a) ? b : a)
{
return (a < b) ? b : a;
}
#else
#ifndef min
#define min(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; })
#endif
#ifndef max
#define max(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; })
#endif
#endif
#endif
3 changes: 3 additions & 0 deletions alt_core_api/api/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_sources(zephyrPrint.cpp)
7 changes: 7 additions & 0 deletions alt_core_api/api/Common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2026 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/

/* stub file for compat */
64 changes: 64 additions & 0 deletions alt_core_api/api/HardwareSerial.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2026 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include "Stream.h"
#include <hardware_serial_interface.hpp>

namespace arduino {

enum SerialConfig {
SERIAL_5E1 = (SERIAL_DATA_5 | SERIAL_PARITY_EVEN | SERIAL_STOP_BIT_1),
SERIAL_5E2 = (SERIAL_DATA_5 | SERIAL_PARITY_EVEN | SERIAL_STOP_BIT_2),
SERIAL_5O1 = (SERIAL_DATA_5 | SERIAL_PARITY_ODD | SERIAL_STOP_BIT_1),
SERIAL_5O2 = (SERIAL_DATA_5 | SERIAL_PARITY_ODD | SERIAL_STOP_BIT_2),
SERIAL_5N1 = (SERIAL_DATA_5 | SERIAL_PARITY_NONE | SERIAL_STOP_BIT_1),
SERIAL_5N2 = (SERIAL_DATA_5 | SERIAL_PARITY_NONE | SERIAL_STOP_BIT_2),
SERIAL_5M1 = (SERIAL_DATA_5 | SERIAL_PARITY_MARK | SERIAL_STOP_BIT_1),
SERIAL_5M2 = (SERIAL_DATA_5 | SERIAL_PARITY_MARK | SERIAL_STOP_BIT_2),
SERIAL_5S1 = (SERIAL_DATA_5 | SERIAL_PARITY_SPACE | SERIAL_STOP_BIT_1),
SERIAL_5S2 = (SERIAL_DATA_5 | SERIAL_PARITY_SPACE | SERIAL_STOP_BIT_2),
SERIAL_6E1 = (SERIAL_DATA_6 | SERIAL_PARITY_EVEN | SERIAL_STOP_BIT_1),
SERIAL_6E2 = (SERIAL_DATA_6 | SERIAL_PARITY_EVEN | SERIAL_STOP_BIT_2),
SERIAL_6O1 = (SERIAL_DATA_6 | SERIAL_PARITY_ODD | SERIAL_STOP_BIT_1),
SERIAL_6O2 = (SERIAL_DATA_6 | SERIAL_PARITY_ODD | SERIAL_STOP_BIT_2),
SERIAL_6N1 = (SERIAL_DATA_6 | SERIAL_PARITY_NONE | SERIAL_STOP_BIT_1),
SERIAL_6N2 = (SERIAL_DATA_6 | SERIAL_PARITY_NONE | SERIAL_STOP_BIT_2),
SERIAL_6M1 = (SERIAL_DATA_6 | SERIAL_PARITY_MARK | SERIAL_STOP_BIT_1),
SERIAL_6M2 = (SERIAL_DATA_6 | SERIAL_PARITY_MARK | SERIAL_STOP_BIT_2),
SERIAL_6S1 = (SERIAL_DATA_6 | SERIAL_PARITY_SPACE | SERIAL_STOP_BIT_1),
SERIAL_6S2 = (SERIAL_DATA_6 | SERIAL_PARITY_SPACE | SERIAL_STOP_BIT_2),
SERIAL_7E1 = (SERIAL_DATA_7 | SERIAL_PARITY_EVEN | SERIAL_STOP_BIT_1),
SERIAL_7E2 = (SERIAL_DATA_7 | SERIAL_PARITY_EVEN | SERIAL_STOP_BIT_2),
SERIAL_7O1 = (SERIAL_DATA_7 | SERIAL_PARITY_ODD | SERIAL_STOP_BIT_1),
SERIAL_7O2 = (SERIAL_DATA_7 | SERIAL_PARITY_ODD | SERIAL_STOP_BIT_2),
SERIAL_7N1 = (SERIAL_DATA_7 | SERIAL_PARITY_NONE | SERIAL_STOP_BIT_1),
SERIAL_7N2 = (SERIAL_DATA_7 | SERIAL_PARITY_NONE | SERIAL_STOP_BIT_2),
SERIAL_7M1 = (SERIAL_DATA_7 | SERIAL_PARITY_MARK | SERIAL_STOP_BIT_1),
SERIAL_7M2 = (SERIAL_DATA_7 | SERIAL_PARITY_MARK | SERIAL_STOP_BIT_2),
SERIAL_7S1 = (SERIAL_DATA_7 | SERIAL_PARITY_SPACE | SERIAL_STOP_BIT_1),
SERIAL_7S2 = (SERIAL_DATA_7 | SERIAL_PARITY_SPACE | SERIAL_STOP_BIT_2),
SERIAL_8E1 = (SERIAL_DATA_8 | SERIAL_PARITY_EVEN | SERIAL_STOP_BIT_1),
SERIAL_8E2 = (SERIAL_DATA_8 | SERIAL_PARITY_EVEN | SERIAL_STOP_BIT_2),
SERIAL_8O1 = (SERIAL_DATA_8 | SERIAL_PARITY_ODD | SERIAL_STOP_BIT_1),
SERIAL_8O2 = (SERIAL_DATA_8 | SERIAL_PARITY_ODD | SERIAL_STOP_BIT_2),
SERIAL_8N1 = (SERIAL_DATA_8 | SERIAL_PARITY_NONE | SERIAL_STOP_BIT_1),
SERIAL_8N2 = (SERIAL_DATA_8 | SERIAL_PARITY_NONE | SERIAL_STOP_BIT_2),
SERIAL_8M1 = (SERIAL_DATA_8 | SERIAL_PARITY_MARK | SERIAL_STOP_BIT_1),
SERIAL_8M2 = (SERIAL_DATA_8 | SERIAL_PARITY_MARK | SERIAL_STOP_BIT_2),
SERIAL_8S1 = (SERIAL_DATA_8 | SERIAL_PARITY_SPACE | SERIAL_STOP_BIT_1),
SERIAL_8S2 = (SERIAL_DATA_8 | SERIAL_PARITY_SPACE | SERIAL_STOP_BIT_2),
};

class HardwareSerial : virtual public Stream, virtual public HardwareSerialInterface {
public:
using Print::write;
};

extern void __weak serialEventRun(void);

} // namespace arduino
Loading
Loading