Hey there! Making this post separately from my other post so it's easier to find in search.
I'm working on a project that stores an array of 572-byte-long Uint8Arrays in RAM, like so:
var arrays = ;
These sub-arrays are then read and written on the individual byte level. They're also not supposed to be read or written to extremely often, just maybe a couple dozen times a day.
It's my understanding that this nested array is stored in RAM. However, I have a lot more free flash storage space on my Puck than I have free RAM. Is there any way to implement this same functionality (reading and writing individual bytes) while using the much larger flash storage?
Well, you can't create an array that way that you can write to, but you can make it so you can read from it and store it on flash. This should work:
So then all you have to do is write a function that'll handle writing the array. However it's worth noting that when you write the array (unless it was all 0xFF and you're setting individual bytes) it'll need to be re-allocated so will be at a different address, so you'd have to update it with the line above again
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem