From 90d8bd67537358709cd3c062a96b3777575de7dd Mon Sep 17 00:00:00 2001 From: Jordi Pakey-Rodriguez Date: Mon, 6 Mar 2017 16:10:02 -0600 Subject: [PATCH] stm32f234: flash: Add FLASH_ACR_LATENCY_MASK --- include/libopencm3/stm32/common/flash_common_f234.h | 1 + lib/stm32/common/flash_common_f234.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/libopencm3/stm32/common/flash_common_f234.h b/include/libopencm3/stm32/common/flash_common_f234.h index a012cf6e..19247c4e 100644 --- a/include/libopencm3/stm32/common/flash_common_f234.h +++ b/include/libopencm3/stm32/common/flash_common_f234.h @@ -50,6 +50,7 @@ /* --- FLASH_ACR values ---------------------------------------------------- */ +#define FLASH_ACR_LATENCY_MASK 0x07 #define FLASH_ACR_LATENCY_0WS 0x00 #define FLASH_ACR_LATENCY_1WS 0x01 #define FLASH_ACR_LATENCY_2WS 0x02 diff --git a/lib/stm32/common/flash_common_f234.c b/lib/stm32/common/flash_common_f234.c index 33ca226b..1977fbbe 100644 --- a/lib/stm32/common/flash_common_f234.c +++ b/lib/stm32/common/flash_common_f234.c @@ -41,7 +41,7 @@ void flash_set_ws(uint32_t ws) uint32_t reg32; reg32 = FLASH_ACR; - reg32 &= ~((1 << 0) | (1 << 1) | (1 << 2)); + reg32 &= ~(FLASH_ACR_LATENCY_MASK); reg32 |= ws; FLASH_ACR = reg32; }