Skip to content

Latest commit

 

History

History
109 lines (88 loc) · 3.03 KB

README.md

File metadata and controls

109 lines (88 loc) · 3.03 KB

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.