aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/rcc.c
diff options
context:
space:
mode:
authorPerry Hung <iperry@alum.mit.edu>2010-03-30 21:40:06 -0400
committerPerry Hung <iperry@alum.mit.edu>2010-03-30 21:40:06 -0400
commit23149e9706ff0a6a338e13804456dff4c655e34b (patch)
tree78e5040df7633b77cca990c8d7c9c3e5b5d6c513 /src/lib/rcc.c
parentf2f32c52c3aa44f34448523c60520df1cad36351 (diff)
downloadlibrambutan-23149e9706ff0a6a338e13804456dff4c655e34b.tar.gz
librambutan-23149e9706ff0a6a338e13804456dff4c655e34b.zip
Re-enabled ADC1 without STM32 RCC library.
There shouldn't be any STM32 rcc code anymore.
Diffstat (limited to 'src/lib/rcc.c')
-rw-r--r--src/lib/rcc.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/lib/rcc.c b/src/lib/rcc.c
index c08f1cd..bf76eb0 100644
--- a/src/lib/rcc.c
+++ b/src/lib/rcc.c
@@ -1,3 +1,10 @@
+/**
+ * @file rcc.c
+ *
+ * @brief Implements pretty much only the basic clock setup on the maple,
+ * exposes a handful of clock enable/disable and peripheral reset commands.
+ */
+
#include "libmaple.h"
#include "rcc.h"
#include "stm32f10x_flash.h"
@@ -83,15 +90,6 @@ static void hse_init(void) {
}
}
-
-void rcc_enable_clock(uint32 p) {
- switch(p) {
- default:
- ASSERT(0);
- break;
- }
-}
-
void rcc_init(void) {
hse_init();
@@ -105,6 +103,11 @@ void rcc_init(void) {
set_ahb_prescaler(SYSCLK_DIV_1);
set_apb1_prescaler(HCLK_DIV_2);
set_apb2_prescaler(HCLK_DIV_1);
-
pll_init();
}
+
+void rcc_set_adc_prescaler(uint32_t divider) {
+ uint32_t cfgr = __read(RCC_CFGR);
+ cfgr &= ~ADCPRE;
+ __write(RCC_CFGR, cfgr | PCLK2_DIV_2);
+}