I would like to use the flashwrite function to store some data in the flash. There is an example in SDK 11.0/peripheral.
But I have a few questions about the example:
EREASE
The erease seems to be easy. Just call flash_page_erase() with the page adress as parameter and this is it.
But when do I need to use erease?
Do I need to erease the page, if I just want to update one value?
Or can I just flash the new value over the old?
WRITE
Flash_word_write() with adress and value as parameter.
The adress is a combination of pg_size and pg_num.
pg_size = NRF_FICR->CODEPAGESIZE;
pg_num = NRF_FICR->CODESIZE - 1; // Use last page in flash
Now if I want to store as example 3 values. They will all need an own adress. Do I have to give each of them a page_num?
Or how I have to store them?
I do not understand that from the example...
READ
For read there is no function?
This is for read in the example:
// Read from flash the last written data and send it back:
patrd = (uint8_t)*(addr - 1);
printf("'%c' was read from flash\n\r\n\r", patrd);
But how do I read?
Can I just take it from the adress and put it in the variable?
Help me to understand all this