summaryrefslogtreecommitdiff
path: root/tests/adc-power/adc-power.c
diff options
context:
space:
mode:
authorKarl Palsson <karlp@tweak.net.au>2015-11-03 23:53:42 +0000
committerKarl Palsson <karlp@tweak.net.au>2015-11-03 23:53:42 +0000
commitc522c29dcab2be8c8ee629e22a3f632d8c614282 (patch)
tree3782a8b6a46f07cde92bcfff2793bb028726cb7e /tests/adc-power/adc-power.c
parent73e12bd0fdfc0f58212dbd248f7582f923240b62 (diff)
downloadolsndot-c522c29dcab2be8c8ee629e22a3f632d8c614282.tar.gz
olsndot-c522c29dcab2be8c8ee629e22a3f632d8c614282.tar.bz2
olsndot-c522c29dcab2be8c8ee629e22a3f632d8c614282.zip
WIP: f0 adc build
Diffstat (limited to 'tests/adc-power/adc-power.c')
-rw-r--r--tests/adc-power/adc-power.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/adc-power/adc-power.c b/tests/adc-power/adc-power.c
index db72a8e..734e3af 100644
--- a/tests/adc-power/adc-power.c
+++ b/tests/adc-power/adc-power.c
@@ -20,7 +20,10 @@
#define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0]))
// Still have some bad shit to deal with...
-#if defined(STM32F3)
+#if defined(STM32F0)
+#define SEPARATE_ADC_SAMPLING 0
+#define SAMPLE_TIME_BASIC ADC_SMPR_SMP_239DOT5
+#elif defined(STM32F3)
#define SAMPLE_TIME_BASIC ADC_SMPR1_SMP_181DOT5CYC
#define SAMPLE_TIME_TEMP ADC_SMPR1_SMP_601DOT5CYC // 2.2usecs or more
#define SAMPLE_TIME_VREF SAMPLE_TIME_TEMP
@@ -42,6 +45,9 @@
#ifndef SEPARATE_VREF
#define SEPARATE_VREF 1
#endif
+#ifndef SEPARATE_ADC_SAMPLING
+#define SEPARATE_ADC_SAMPLING 1
+#endif
void adc_power_init(void)
@@ -65,9 +71,13 @@ void adc_power_init(void)
#endif
#endif
+#if (SEPARATE_ADC_SAMPLING == 1)
adc_set_sample_time_on_all_channels(ADC1, SAMPLE_TIME_BASIC);
adc_set_sample_time(ADC1, ADC_CHANNEL_TEMP, SAMPLE_TIME_TEMP);
adc_set_sample_time(ADC1, ADC_CHANNEL_TEMP, SAMPLE_TIME_VREF);
+#else
+ adc_set_sample_time_on_all_channels(ADC1, SAMPLE_TIME_BASIC);
+#endif
adc_enable_temperature_sensor();
#if (SEPARATE_VREF == 1)
adc_enable_vrefint();