aboutsummaryrefslogtreecommitdiff
path: root/02-usart/src/arch/stm32l4xxx/peripherals/clock.c
diff options
context:
space:
mode:
Diffstat (limited to '02-usart/src/arch/stm32l4xxx/peripherals/clock.c')
-rw-r--r--02-usart/src/arch/stm32l4xxx/peripherals/clock.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/02-usart/src/arch/stm32l4xxx/peripherals/clock.c b/02-usart/src/arch/stm32l4xxx/peripherals/clock.c
index 1029d39..9051572 100644
--- a/02-usart/src/arch/stm32l4xxx/peripherals/clock.c
+++ b/02-usart/src/arch/stm32l4xxx/peripherals/clock.c
@@ -5,10 +5,13 @@
#include "arch/stm32l4xxx/peripherals/clock.h"
#include "arch/stm32l4xxx/peripherals/flash.h"
+#include "kern/init.h"
+
#include <stdint.h>
#define TIMEOUT 10000
+
int pll_off()
{
uint32_t c;
@@ -66,8 +69,16 @@ int configure_pll(
return 0;
}
+static _no_init uint8_t clock_mHz;
+uint8_t get_clock_mhz()
+{
+ return clock_mHz;
+}
+
int set_system_clock_MHz(uint8_t mhz)
{
+ clock_mHz = mhz;
+
/* Set the source of the system colck to MSI temporarily. */
set_system_clock_src(SYSTEM_CLOCK_SRC_MSI);