Hi to everyone. I have a project where I need to save different IR codes in the EEPROM to use them later. The EEPROM is not my problem right now. I'm using the IR library.
This is my function:
decode_results results;
//setup, void, etc.
void getCode(decode_results *results)
{
int posicion = (datoTv-1)*8;
codeByte4=EEPROM.read(posicion);
codeByte3=EEPROM.read(posicion+1);
codeByte2=EEPROM.read(posicion+2);
codeByte1=EEPROM.read(posicion+3);
typeByte2=EEPROM.read(posicion+4);
typeByte1=EEPROM.read(posicion+5);
lenByte2 =EEPROM.read(posicion+6);
lenByte1 =EEPROM.read(posicion+7);
results->value = (((codeByte1 << 0) & 0xFF) + ((codeByte2 << 8) & 0xFFFF) + ((codeByte3 << 16) & 0xFFFFFF) + ((codeByte4 << 24) & 0xFFFFFFFF));
results->bits = (((lenByte1 << 0) & 0xFF) + (lenByte2 << 8));
results->decode_type = (((typeByte1 << 0) & 0xFF) + (typeByte2 << 8));
}
Nevermind the bit operations, that's ok. My problem is that I can't modify the struct values (value, bits, and decode_type). Those values are only modified when I recieve a new code, so the struct only holds the last code I recieve.
On the library example I have:
if (irrecv.decode(&results))
storeCode(&results);
So I believe the struct values are modified when I call irrecv.decode(&results).
How can I modify the struct, like writing the data I hold in the EEPROM to the fields value, bits and decode_type?? I think I'm messing with the & and *
Thank you veery much