To use the node in your project you should have the bradzilla84/74hc595 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/Simsso/ShiftRegister74HC595"
{{#global}}
#include <ShiftRegister74HC595.h>
{{/global}}
struct State {
uint8_t mem[sizeof(ShiftRegister74HC595)];
};
// Define our custom type as a pointer on the class instance.
using Type = ShiftRegister74HC595*;
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
if (!isSettingUp())
return;
auto state = getState(ctx);
// Create a new object in the memory area reserved previously.
Type sr = new (state->mem) ShiftRegister74HC595(getValue<input_SRn>(ctx),getValue<input_DS>(ctx), getValue<input_CLK>(ctx), getValue<input_LT>(ctx));
emitValue<output_DEV>(ctx, sr);
}