I have an array of 16x16 matrices of uint32_t values: const uint32_t sprites[][16][16] PROGMEM = { ... };
I'm trying to read out the values with pgm_read_dword(sprites + (submode * 256 + row * 16 + column) * sizeof(uint32_t))
, but am getting turned around and confused about how the address math works. In this, submode
maps to the matrix index. submode
, row
, and column
are all declared as uint8_t
, in case it helps at all.
How do I correctly calculate the address for pgm_read_dword
?
Is pgm_read_dword
even how I want to try to read out uint32_t
values? I'm immediately passing the output to a method that expects that type.
根据评论中的 datafiddler,它就像调用pgm_read_dword(&sprites[submode][row][column])
并让编译器处理偏移计算一样简单。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.