Skip to content

Commit

Permalink
flash_stm32f4: bits were badly unset in erase and write functions
Browse files Browse the repository at this point in the history
A typo was present ion the erase and write function were bit were
uncorrectly unset but all other bit except the mask were unset.
The code still worked because the two typos fixed themselves.

Signed-off-by: Neil Armstrong <[email protected]>
  • Loading branch information
superna9999 authored and galak committed May 19, 2017
1 parent 375c362 commit ad9cca0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/flash/flash_stm32f4x.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static int write_byte(off_t offset, u8_t val, struct stm32f4x_flash *regs)
return rc;
}

regs->ctrl &= CR_PSIZE_MASK;
regs->ctrl &= ~CR_PSIZE_MASK;
regs->ctrl |= FLASH_PSIZE_BYTE;
regs->ctrl |= FLASH_CR_PG;

Expand Down Expand Up @@ -117,7 +117,7 @@ static int erase_sector(u16_t sector, struct stm32f4x_flash *regs)
tmp = regs->ctrl;

rc = wait_flash_idle(regs);
regs->ctrl &= (FLASH_CR_SER | FLASH_CR_SNB);
regs->ctrl &= ~(FLASH_CR_SER | FLASH_CR_SNB);

return rc;
}
Expand Down

0 comments on commit ad9cca0

Please sign in to comment.