To use the node in your project you should have the ivanmason/gps-receiver library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.
C++ implementation
#pragma XOD require "https://github.com/mikalhart/TinyGPSPlus"
// Include C++ library:
{{#global}}
#include <TinyGPS++.h>
{{/global}}
struct State {
uint8_t mem[sizeof(TinyGPSPlus)];
};
using Type = TinyGPSPlus*;
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
// It should be evaluated only once on the first (setup) transaction
if (!isSettingUp())
return;
auto state = getState(ctx);
// Create a new object in the memory area reserved previously.
Type gps = new (state->mem) TinyGPSPlus();
emitValue<output_DEV>(ctx, gps);
}