summaryrefslogtreecommitdiff
path: root/src/stm/ao_adc_stm.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-04-07 20:33:27 -0700
committerKeith Packard <keithp@keithp.com>2012-04-07 20:33:27 -0700
commit98aa481741b8fbc617545beda3d295b53de90716 (patch)
tree750b36242c5b22f3d4bbf896c2c48c04d51da437 /src/stm/ao_adc_stm.c
parent0bce68e6a0abc19f49c573331164d13643c9bee5 (diff)
altos: Use 384 cycle ADC sample time
This is plenty fast, and provides nice stable readings. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm/ao_adc_stm.c')
-rw-r--r--src/stm/ao_adc_stm.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/stm/ao_adc_stm.c b/src/stm/ao_adc_stm.c
index 1722a9ec..d758e629 100644
--- a/src/stm/ao_adc_stm.c
+++ b/src/stm/ao_adc_stm.c
@@ -28,11 +28,11 @@ static uint8_t ao_adc_ready;
(0 << STM_ADC_CR2_JWSTART) | \
(STM_ADC_CR2_JEXTEN_DISABLE << STM_ADC_CR2_JEXTEN) | \
(0 << STM_ADC_CR2_JEXTSEL) | \
- (1 << STM_ADC_CR2_ALIGN) | \
+ (0 << STM_ADC_CR2_ALIGN) | \
(0 << STM_ADC_CR2_EOCS) | \
(1 << STM_ADC_CR2_DDS) | \
(1 << STM_ADC_CR2_DMA) | \
- (STM_ADC_CR2_DELS_NONE << STM_ADC_CR2_DELS) | \
+ (STM_ADC_CR2_DELS_UNTIL_READ << STM_ADC_CR2_DELS) | \
(0 << STM_ADC_CR2_CONT) | \
(1 << STM_ADC_CR2_ADON))
@@ -168,10 +168,10 @@ ao_adc_init(void)
(0 << STM_ADC_CR1_EOCIE ) |
(0 << STM_ADC_CR1_AWDCH ));
- /* 4 cycle sample time for everyone */
- stm_adc.smpr1 = 0;
- stm_adc.smpr2 = 0;
- stm_adc.smpr3 = 0;
+ /* 384 cycle sample time for everyone */
+ stm_adc.smpr1 = 0x3ffff;
+ stm_adc.smpr2 = 0x3fffffff;
+ stm_adc.smpr3 = 0x3fffffff;
stm_adc.sqr1 = ((AO_NUM_ADC - 1) << 20);
stm_adc.sqr2 = 0;