summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2015-02-28 06:29:07 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2015-02-28 06:29:07 +0100
commitcd8a8277bc31148673f9094cd0c64fd75778d989 (patch)
treef0d0c4ac1663499e8ec52b57855e0bd14fbabdd3
parentee44eb71b2d2366fa9928d3c754e4a1acd4a9922 (diff)
Lower ADC sample rate.
-rw-r--r--arcin/main.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/arcin/main.cpp b/arcin/main.cpp
index 549ea35..538b6c1 100644
--- a/arcin/main.cpp
+++ b/arcin/main.cpp
@@ -210,6 +210,7 @@ class AnalogAxis : public Axis {
// Configure continous capture on one channel.
adc.CFGR = (1 << 13) | (1 << 12) | (1 << 5); // CONT, OVRMOD, ALIGN
adc.SQR1 = (ch << 6);
+ adc.SMPR1 = (7 << (ch * 3)); // 72 MHz / 64 / 614 = apx. 1.8 kHz
// Enable ADC.
adc.CR |= 1 << 0; // ADEN
@@ -231,8 +232,8 @@ AnalogAxis axis_ana2(ADC2, 4);
int main() {
rcc_init();
- // Set ADC12PRES to /1.
- RCC.CFGR2 |= (0x10 << 4);
+ // Set ADC12PRES to /64.
+ RCC.CFGR2 |= (0x19 << 4);
// Initialize system timer.
STK.LOAD = 72000000 / 8 / 1000; // 1000 Hz.