eeprom-read-uint

gst/ee-prom-read-write-uint16bit/eeprom-read-uint

No description
eeprom-read-uint
@/eeprom-read-uint
ADDRnumber
Address in EEPROM where the value should be read
UPDpulse
Trigger the read function
eeprom-read-uint
VAL
OK
ADDR
UPD
OKpulse
Pulses after each read
VALnumber
unsignd integer value read from adress
To use the node in your project you should have the gst/ee-prom-read-write-uint16bit 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/dancojocaru2000/ArduinoEEPROM"

{{#global}}
#include <EEPROM.h>
{{/global}}

struct State {
    uint16_t cache = 0;
    
};


{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    auto state = getState(ctx);

    if (isInputDirty<input_UPD>(ctx)) {
         
        
        auto addr = getValue<input_ADDR>(ctx);
        
        uint16_t addresse = addr; 
        auto result = EEPROM.read(addresse);
     
        byte lowbyte = result;
        addresse = addresse +1;
        result = EEPROM.read(addresse);
        byte highbyte = result;  
        
        
        state->cache = ((lowbyte << 0) & 0x00FF) + ((highbyte << 8) & 0xFF00); 
        emitValue<output_OK>(ctx, true);
    }

    emitValue<output_VAL>(ctx, state->cache);
}
/*This function will read a 2 byte integer from the eeprom at the specified address and address + 1
   
*/