EDIT: I have finished the port. It will be available on my GitHub soon.
const char ** is a weird thing to have been passing to pgm_read_word(). It would normally take a const char * or some other pointer to a memory. Your value of x is a pointer to a pointer to memory, which is a not how pgm_read_word works on Arduino.
Can you move the #define
to the top of your file and post your whole code?
I’d expect these lines to cause the trouble
PGM_P data_ptr;
...
if (region == NA) {
data_ptr = (PGM_P)pgm_read_word(NApowerCodes+i);
}
else {
data_ptr = (PGM_P)pgm_read_word(EUpowerCodes+i);
}
...
PGM_P time_ptr = (PGM_P)pgm_read_word(data_ptr);
data_ptr+=2;
code_ptr = (PGM_P)pgm_read_word(data_ptr);
Just for the sake of testing try this instead
#define pgm_read_word(x) (*(x))
Also this comment in the lib makes me think
Subsequent reads from the powerCode are n bits (same as the packing size)
that index into another table in ROM that actually stores the on/off times
const PGM_P time_ptr = (PGM_P)pgm_read_word(code_ptr);
We are dealing with a packing size of 32bit, while Arduino uses 8 or 16bits.
So you might need to redo more than just the pgm_
macros in void sendAllCodes()
.