stm32: f24: flash: Make code match documentation

This removes the shift from the defines, and includes them in the helper
function, making the code match the documentation, and following how the
rest of the library commonly operates.

Code using the existing defines will continue to work.
This commit is contained in:
Karl Palsson
2014-12-17 15:54:03 +00:00
committed by Karl Palsson
parent 07ee71cf23
commit ec15c1ca64
2 changed files with 8 additions and 6 deletions

View File

@@ -38,8 +38,8 @@ programming manual for more information.
static inline void flash_set_program_size(uint32_t psize)
{
FLASH_CR &= ~(((1 << 0) | (1 << 1)) << 8);
FLASH_CR |= psize;
FLASH_CR &= ~(FLASH_CR_PROGRAM_MASK << FLASH_CR_PROGRAM_SHIFT);
FLASH_CR |= psize << FLASH_CR_PROGRAM_SHIFT;
}
/*---------------------------------------------------------------------------*/