/teensy-x86-stubs

stub classes to allow certain teensy code to be compiled and run on a desktop PC

Primary LanguageCMIT LicenseMIT

teensy x86 stubs

MIT license CMake CMake

installable cmake package with stub classes to allow basic teensy code and libraries to be compiled and debugged on your x86/x64 architecture

eco-system

sd | audio | st7735 | midi | bounce2 | encoder

quick example

  • to initialize the arduino timing library so that millis() will return the duration in milliseconds since the test app has been runnning
    initialize_mock_arduino()
    char *buffer = "blah blah blah blah blah";
    SD.setSDCardFileData(buffer, strlen(buffer));
main.cpp
#include <Arduino.h>
#include <SD.h>

using namespace std;

int main(int argc, char **argv){
    std::cout << "starting app...\n";
    initialize_mock_arduino();

    char *buffer = "blah blah blah blah blah";
    SD.setSDCardFileData(buffer, strlen(buffer));

    File f = SD.open("abcdefg.123");

    char *output = new char[1000];
    int bytesRead = f.read(output, 1000);

    std::cout << bytesRead << " bytes read: \n" << output;
}
output
starting app...
24 bytes read: 
blah blah blah blah blah
CMakelists.txt
project(thing C CXX)

find_package(teensy_x86_stubs)
include_directories(${teensy_x86_stubs_INCLUDE_DIR})

add_executable(thing main.cpp)

target_link_libraries(thing ${teensy_x86_stubs_LIBS})

package installation:

git clone https://github.com/newdigate/teensy-x86-stubs.git
cd teensy-x86-stubs
mkdir cmake-build-debug
cd cmake-build-debug
cmake ..
sudo make install

uninstall:

sudo make uninstall

credits

license

Unless specified in source code file, all code is MIT license.