mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/nrf5x_common: update periph_flashpage for nRF9160 support
This commit is contained in:
parent
aa8608eff5
commit
b734622944
@ -23,6 +23,10 @@
|
||||
#include "assert.h"
|
||||
#include "periph/flashpage.h"
|
||||
|
||||
#ifndef NRF_NVMC
|
||||
#define NRF_NVMC NRF_NVMC_S
|
||||
#endif
|
||||
|
||||
void flashpage_erase(unsigned page)
|
||||
{
|
||||
assert(page < (int)FLASHPAGE_NUMOF);
|
||||
@ -31,7 +35,14 @@ void flashpage_erase(unsigned page)
|
||||
|
||||
/* erase given page */
|
||||
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een;
|
||||
#ifndef NRF_NVMC_S
|
||||
NRF_NVMC->ERASEPAGE = (uint32_t)page_addr;
|
||||
#else
|
||||
/* NRF_NVMC->ERASEPAGE doesn't exist on nRF9160 family, the proper
|
||||
way to erase a page is to write 0xFFFFFFFF in the first 32-bit
|
||||
word of the page to erase it (see Chap 4.4.2 from nRF9160 datasheet ) */
|
||||
*page_addr = UINT32_MAX;
|
||||
#endif
|
||||
while (NRF_NVMC->READY == 0) {}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user