Store the wiper position to the non-volatile register.
FROM NV_Mpulse
Update the wiper position from the non-volatile register.
UPDATEpulse
Feed a pulse signal to update the wipe positon based on the value applied to WIPER pin.
DONEpulse
Spits a pulse when done.
To use the node in your project you should have the hussainfawzi/max548x-10bit-pot 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/hussainfawzi/MAX548X"
{{#global}}
#include "MAX548X.h"
{{/global}}
struct State {
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
Number CS = getValue<input_CS>(ctx);
MAX548X MAX5482(CS);
if (isInputDirty<input_FROM_NV_M>(ctx)){MAX5482.fromNV(); emitValue<output_DONE>(ctx, 1);}
if (isInputDirty<input_TO_NV_M>(ctx)){MAX5482.toNV(); emitValue<output_DONE>(ctx, 1);}
if (!isInputDirty<input_UPDATE>(ctx))
return;
Number buff = getValue<input_WIPER>(ctx);
MAX5482.setPOT(buff);
emitValue<output_DONE>(ctx, 1);
};