From 229fd5405eef950e60cae3b6f446c146f38a2e13 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 3 Dec 2011 19:47:07 +0100 Subject: Moved FLASH and RCC register definitions into own headers. --- hal/flash.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 hal/flash.cpp (limited to 'hal/flash.cpp') diff --git a/hal/flash.cpp b/hal/flash.cpp new file mode 100644 index 0000000..2b0fb69 --- /dev/null +++ b/hal/flash.cpp @@ -0,0 +1,17 @@ +#include "flash.h" + +void flash_init() { + #if defined(STM32F1) + + // Set flash latency. + FLASH.ACR = 0x12; + + #elif defined(STM32F4) + + // Set flash latency. + FLASH.ACR = 0x105; + + while(FLASH.ACR != 0x105); + + #endif +} -- cgit v1.2.3