Go Down

Topic: [SOLVED for Maple Mini Stm32duino] How to access PROGMEM array dynamically (Read 463 times) previous topic - next topic


[EDIT: I just found out the solution for the maple mini I use in my project. I just had to write this instead
Code: [Select]
uint16_t gammaTable[94] [256] __FLASH__ = {...}; then i could just access it as it would be stored in ram... ]
Hey there,
I ve got a problem I could sadly not solve yet...
I want to store a big one dimensional array of uint16_t values and access it dynamically from a function.

This is how i create it
Code: [Select]
const uint16_t gammaTable[] PROGMEM = {
0, 15200, 0,0};

Now the problem is that i cannot not get a specific value dynamically with a variable as array index or so. I can get the variable with a static number as index like this:
Code: [Select]


But if i want to access it like this it does not work any more.
Code: [Select]

void displayFrame() {
  for (int i = 0; i < 192; i++) {
    uint16_t result = pgm_read_word(&gammaTable[i]);

I dont know what i can do to read it that way. Does any know it?

Go Up