@@ -8,7 +8,7 @@ The Flash on the nRF52840 has 256 pages of 1024 words, each word is 4 bytes.
Each page is individually erasable; each word is individually writable.
This library defines 2 functions:
int flashErasePage(int page);
int flashErasePage(int page);
void flashMode(_flashModeEnum mode);
where mode is one of
FLASH_READONLY
...
...
@@ -56,7 +56,7 @@ such as
double *arrayInFlash;
to declare an array of doubles named "arrayInFlash".
The asterisk ( * ) before the array name is important.
The scope of the array is determined by where the declaration is made.
The scope of the array is determined by where the declaration is made.
If outside of any function, the scope is global (all functions can see the array), while if it is inside a function, it will be seen only within that function , and others to which it is passed in the function argument list.
The second step is to specify where and how big the array is.
...
...
@@ -76,6 +76,7 @@ The array macro NANO33BLE_PUT_ARRAY_IN_FLASH must be inside a function, because
The array macro NANO33BLE_PUT_ARRAY_IN_FLASH does not initialize or otherwise modify the contents of the array. It just makes the sketch look in the correct place in flash memory when it encounters future references to the array.
The macro sequentially packs the arrays in from the top of the available flash memory, reaching down as far as it needs to go.
It does not check for any collisions with the sketch or bootloader, which start at the bottom of flash, but it'd have to be a pretty big array and/or sketch for a collision to occur.
The lowest flash page that is partially or fully occupied with your arrays is given by the macro NANO33BLE_FLASH_LOWEST_PAGE.
Thus, if you need to erase all the pages your sketch is using in order to initialize them, loop with a for loop from NANO33BLE_FLASH_LOWEST_PAGE to flashNumberOfPages, erasing each page as you go.
...
...
@@ -87,15 +88,17 @@ If you want more control over the details of the declarations in flash,