mirror of
https://github.com/newdigate/teensy-x86-stubs.git
synced 2026-07-04 14:46:42 +00:00
main
Support multiple concurrent IntervalTimers (Teensy parity)
teensy x86 stubs
stub classes implementing basic arduino/teensy functions for compiling and debugging on your x86/x64 architecture (Linux, macOS, Windows/MSVC)
eco-system
sd | audio | st7735 | midi | bounce2 | encoder
quick example
main.cpp
#include <Arduino.h>
IntervalTimer myTimer;
void blinkLED() {
Serial.printf("BLINK %d\n", 1000);
}
int main(int argc, char **argv){
initialize_mock_arduino();
myTimer.begin(blinkLED, 250000);
delay(1000000);
}
CMakelists.txt reference
- the
DeclareAndFetchmacro comes from cmake-declare-and-fetch — copy itscmake_declare_and_fetch.cmake.innext to yourCMakeLists.txt(seetest/in this repo for an example)
cmake_minimum_required(VERSION 3.10)
project(thing C CXX)
set(CMAKE_CXX_STANDARD 17)
include(cmake_declare_and_fetch.cmake.in)
DeclareAndFetch(teensy_x86_stubs https://github.com/newdigate/teensy-x86-stubs.git main src)
add_executable(thing main.cpp)
target_link_libraries(thing teensy_x86_stubs)
build instructions:
git clone https://github.com/newdigate/teensy-x86-stubs.git
cd teensy-x86-stubs
mkdir cmake-build-debug
cd cmake-build-debug
cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake --build .
- this builds only the
teensy_x86_stubslibrary. To actually run something, build one of the standalone test apps (e.g.test/blinkortest/first), each of which has its ownCMakeLists.txt.
timing emulation
- to initialize the arduino timing library so that millis() will return the duration in milliseconds since the test app has been running
initialize_mock_arduino()
credits
- similar to maniacbug/ncore
- Don't Run Unit Tests on the Arduino Device or Emulator
- stackoverflow 11437456
- includes code from IronSavior/dsm2_tx
- cmake uninstaller
license
Unless specified in source code file, all code is MIT license.
Languages
C
78.2%
C++
21.3%
CMake
0.5%