Skip to content

Commit

Permalink
cpu/stm32_common/periph: don't lock if flash is already locked
Browse files Browse the repository at this point in the history
  • Loading branch information
aabadie committed May 16, 2018
1 parent 9c09a21 commit 6e0871d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cpu/stm32_common/periph/flashpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ static void _unlock(void)

static void _lock(void)
{
DEBUG("[flashpage] locking the flash module\n");
CNTRL_REG |= CNTRL_REG_LOCK;
if (!(CNTRL_REG & CNTRL_REG_LOCK)) {
DEBUG("[flashpage] locking the flash module\n");
CNTRL_REG |= CNTRL_REG_LOCK;
}
}

static void _erase_page(void *page_addr)
Expand Down

0 comments on commit 6e0871d

Please sign in to comment.