adc/dac passthrough

pull/3/head
Clyne 4 years ago
parent b3eccbc1b9
commit 96e4883081

@ -177,8 +177,8 @@
#define STM32_GPT_USE_TIM2 FALSE #define STM32_GPT_USE_TIM2 FALSE
#define STM32_GPT_USE_TIM3 FALSE #define STM32_GPT_USE_TIM3 FALSE
#define STM32_GPT_USE_TIM4 TRUE #define STM32_GPT_USE_TIM4 TRUE
#define STM32_GPT_USE_TIM5 TRUE #define STM32_GPT_USE_TIM5 FALSE
#define STM32_GPT_USE_TIM6 FALSE #define STM32_GPT_USE_TIM6 TRUE
#define STM32_GPT_USE_TIM7 FALSE #define STM32_GPT_USE_TIM7 FALSE
#define STM32_GPT_USE_TIM8 FALSE #define STM32_GPT_USE_TIM8 FALSE
#define STM32_GPT_USE_TIM15 FALSE #define STM32_GPT_USE_TIM15 FALSE

@ -77,7 +77,7 @@ namespace adc
adc_operation_func = operation_func; adc_operation_func = operation_func;
adc_group_config.circular = true; adc_group_config.circular = true;
adcStartConversion(adcd, &adc_group_config, buffer, count); adcStartConversion(adcd, &adc_group_config, buffer, count);
gptStartContinuous(gptd, 1000); // 10kHz gptStartContinuous(gptd, 100); // 10kHz
} }
void read_stop() void read_stop()

@ -12,7 +12,7 @@
#include "dac.hpp" #include "dac.hpp"
constexpr static const auto dacd = &DACD1; constexpr static const auto dacd = &DACD1;
constexpr static const auto gptd = &GPTD5; constexpr static const auto gptd = &GPTD6;
constexpr static const DACConfig dac_config = { constexpr static const DACConfig dac_config = {
.init = 0, .init = 0,
@ -24,11 +24,11 @@ constexpr static const DACConversionGroup dac_group_config = {
.num_channels = 1, .num_channels = 1,
.end_cb = nullptr, .end_cb = nullptr,
.error_cb = nullptr, .error_cb = nullptr,
.trigger = DAC_TRG(3) .trigger = DAC_TRG(0)
}; };
constexpr static const GPTConfig gpt_config = { constexpr static const GPTConfig gpt_config = {
.frequency = 500000, .frequency = 1000000,
.callback = nullptr, .callback = nullptr,
.cr2 = TIM_CR2_MMS_1, /* TRGO */ .cr2 = TIM_CR2_MMS_1, /* TRGO */
.dier = 0 .dier = 0
@ -48,7 +48,7 @@ namespace dac
void write_start(dacsample_t *buffer, size_t count) void write_start(dacsample_t *buffer, size_t count)
{ {
dacStartConversion(dacd, &dac_group_config, buffer, count); dacStartConversion(dacd, &dac_group_config, buffer, count);
gptStartContinuous(gptd, 1); gptStartContinuous(gptd, 100);
} }
void write_stop() void write_stop()

Loading…
Cancel
Save