From 96e4883081e253287d18c93118399f39b71551ea Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sat, 22 Aug 2020 16:56:47 -0400 Subject: [PATCH] adc/dac passthrough --- cfg/mcuconf.h | 4 ++-- source/adc.cpp | 2 +- source/dac.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cfg/mcuconf.h b/cfg/mcuconf.h index e1e50c3..d346e02 100644 --- a/cfg/mcuconf.h +++ b/cfg/mcuconf.h @@ -177,8 +177,8 @@ #define STM32_GPT_USE_TIM2 FALSE #define STM32_GPT_USE_TIM3 FALSE #define STM32_GPT_USE_TIM4 TRUE -#define STM32_GPT_USE_TIM5 TRUE -#define STM32_GPT_USE_TIM6 FALSE +#define STM32_GPT_USE_TIM5 FALSE +#define STM32_GPT_USE_TIM6 TRUE #define STM32_GPT_USE_TIM7 FALSE #define STM32_GPT_USE_TIM8 FALSE #define STM32_GPT_USE_TIM15 FALSE diff --git a/source/adc.cpp b/source/adc.cpp index 9e0491e..1f65e68 100644 --- a/source/adc.cpp +++ b/source/adc.cpp @@ -77,7 +77,7 @@ namespace adc adc_operation_func = operation_func; adc_group_config.circular = true; adcStartConversion(adcd, &adc_group_config, buffer, count); - gptStartContinuous(gptd, 1000); // 10kHz + gptStartContinuous(gptd, 100); // 10kHz } void read_stop() diff --git a/source/dac.cpp b/source/dac.cpp index 6096d8e..644689e 100644 --- a/source/dac.cpp +++ b/source/dac.cpp @@ -12,7 +12,7 @@ #include "dac.hpp" constexpr static const auto dacd = &DACD1; -constexpr static const auto gptd = &GPTD5; +constexpr static const auto gptd = &GPTD6; constexpr static const DACConfig dac_config = { .init = 0, @@ -24,11 +24,11 @@ constexpr static const DACConversionGroup dac_group_config = { .num_channels = 1, .end_cb = nullptr, .error_cb = nullptr, - .trigger = DAC_TRG(3) + .trigger = DAC_TRG(0) }; constexpr static const GPTConfig gpt_config = { - .frequency = 500000, + .frequency = 1000000, .callback = nullptr, .cr2 = TIM_CR2_MMS_1, /* TRGO */ .dier = 0 @@ -48,7 +48,7 @@ namespace dac void write_start(dacsample_t *buffer, size_t count) { dacStartConversion(dacd, &dac_group_config, buffer, count); - gptStartContinuous(gptd, 1); + gptStartContinuous(gptd, 100); } void write_stop()