To use the node in your project you should have the cesars/ds1302 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/Cesar-S/DS1302"
#include <DS1302.h>
node {
static_assert(isValidDigitalPort(constant_input_RST), "must be a valid digital port");
static_assert(isValidDigitalPort(constant_input_SCLK), "must be a valid digital port");
static_assert(isValidDigitalPort(constant_input_IO), "must be a valid digital port");
meta {
using Type = DS1302*;
}
uint8_t mem[sizeof(DS1302)];
void evaluate(Context ctx) {
if (!isSettingUp())return;
Type rtc = new (mem) DS1302(constant_input_RST, constant_input_SCLK, constant_input_IO);
rtc->init();
emitValue<output_1302U0027>(ctx, rtc);
}
}