aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32')
-rw-r--r--testhal/STM32/STM32L4xx/GPT-ADC/debug/STM32L4xx-GPT-ADC (OpenOCD, Flash and Run).launch2
-rw-r--r--testhal/STM32/STM32L4xx/GPT-ADC/main.c17
2 files changed, 11 insertions, 8 deletions
diff --git a/testhal/STM32/STM32L4xx/GPT-ADC/debug/STM32L4xx-GPT-ADC (OpenOCD, Flash and Run).launch b/testhal/STM32/STM32L4xx/GPT-ADC/debug/STM32L4xx-GPT-ADC (OpenOCD, Flash and Run).launch
index e3e42c0d6..77d012aa4 100644
--- a/testhal/STM32/STM32L4xx/GPT-ADC/debug/STM32L4xx-GPT-ADC (OpenOCD, Flash and Run).launch
+++ b/testhal/STM32/STM32L4xx/GPT-ADC/debug/STM32L4xx-GPT-ADC (OpenOCD, Flash and Run).launch
@@ -33,7 +33,7 @@
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
-<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList/&gt;"/>
+<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;null-adc_lld_start_conversion-(format)&quot; val=&quot;2&quot;/&gt;&lt;/contentList&gt;"/>
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;globalVariableList/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="./build/ch.elf"/>
diff --git a/testhal/STM32/STM32L4xx/GPT-ADC/main.c b/testhal/STM32/STM32L4xx/GPT-ADC/main.c
index bf843263c..80ad44189 100644
--- a/testhal/STM32/STM32L4xx/GPT-ADC/main.c
+++ b/testhal/STM32/STM32L4xx/GPT-ADC/main.c
@@ -68,23 +68,24 @@ static void adcerrorcallback(ADCDriver *adcp, adcerror_t err) {
/*
* ADC conversion group.
- * Mode: Continuous, 16 samples of 2 channels, HS triggered by
+ * Mode: Continuous, 16 samples of 2 channels, HW triggered by
* GPT4-TRGO.
- * Channels: VRef, PC1.
+ * Channels: VRef, PA0.
*/
static const ADCConversionGroup adcgrpcfg1 = {
true,
ADC_GRP1_NUM_CHANNELS,
adccallback,
adcerrorcallback,
- ADC_CFGR_CONT | ADC_CFGR_EXTEN_RISING | ADC_CFGR_EXTSEL_SRC(12), /* CFGR */
+ ADC_CFGR_EXTEN_RISING | ADC_CFGR_EXTSEL_SRC(12), /* CFGR */
ADC_TR(0, 4095), /* TR1 */
{ /* SMPR[2]*/
- ADC_SMPR1_SMP_AN0(ADC_SMPR_SMP_247P5),
- ADC_SMPR1_SMP_AN2(ADC_SMPR_SMP_247P5)
+ ADC_SMPR1_SMP_AN0(ADC_SMPR_SMP_247P5) |
+ ADC_SMPR1_SMP_AN5(ADC_SMPR_SMP_247P5),
+ 0
},
{ /* SQR[4] */
- ADC_SQR1_SQ1_N(ADC_CHANNEL_IN0) | ADC_SQR1_SQ2_N(ADC_CHANNEL_IN2),
+ ADC_SQR1_SQ1_N(ADC_CHANNEL_IN0) | ADC_SQR1_SQ2_N(ADC_CHANNEL_IN5),
0,
0,
0
@@ -145,9 +146,11 @@ int main(void) {
adcSTM32EnableVREF(&ADCD1);
adcSTM32EnableTS(&ADCD1);
+ palSetLineMode(LINE_ARD_A0, PAL_MODE_INPUT_ANALOG);
+
/*
* Starts an ADC continuous conversion triggered with a period of
- * 1/1000000 second.
+ * 1/10000 second.
*/
adcStartConversion(&ADCD1, &adcgrpcfg1, samples1, ADC_GRP1_BUF_DEPTH);
gptStartContinuous(&GPTD4, 100);