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 evaluate_on_pin enable input_SET
node {
void evaluate(Context ctx) {
emitValue<output_1302U0027>(ctx, getValue<input_1302>(ctx));
auto rtc = getValue<input_1302>(ctx);
if (!isInputDirty<input_SET>(ctx)) return;
DS1302::DateTime dt;
dt.year = (uint8_t)getValue<input_Year>(ctx);
dt.month = (uint8_t)getValue<input_Month>(ctx);
dt.day = (uint8_t)getValue<input_Day>(ctx);
dt.dow = (uint8_t)getValue<input_WeekDay>(ctx);
dt.hour = (uint8_t)getValue<input_Hour>(ctx);
dt.minute = (uint8_t)getValue<input_Minute>(ctx);
dt.second = (uint8_t)getValue<input_Second>(ctx);
// set the date and time
rtc->setDateTime(&dt);
emitValue<output_DONE>(ctx, 1);
}
}