diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/adc.cpp | 8 | ||||
-rw-r--r-- | source/dac.cpp | 4 | ||||
-rw-r--r-- | source/main.cpp | 16 |
3 files changed, 14 insertions, 14 deletions
diff --git a/source/adc.cpp b/source/adc.cpp index 6e02dde..744dbc0 100644 --- a/source/adc.cpp +++ b/source/adc.cpp @@ -38,7 +38,7 @@ static ADCConversionGroup adc_group_config = { }; constexpr static const GPTConfig gpt_config = { - .frequency = 8000000, + .frequency = 2400000, .callback = nullptr, .cr2 = TIM_CR2_MMS_1, /* TRGO */ .dier = 0 @@ -65,7 +65,7 @@ namespace adc adc_is_read_finished = false; adc_group_config.circular = false; adcStartConversion(adcd, &adc_group_config, buffer, count); - gptStartContinuous(gptd, 2); + gptStartContinuous(gptd, 25); while (!adc_is_read_finished); return buffer; } @@ -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, 2); + gptStartContinuous(gptd, 25); } void read_set_operation_func(operation_t operation_func) @@ -113,7 +113,7 @@ namespace adc val = ADC_SMPR1_SMP_AN5(ADC_SMPR_SMP_24P5); break; case rate::R47P5: - val = ADC_SMPR1_SMP_AN5(ADC_SMPR_SMP_47P5);//// + val = ADC_SMPR1_SMP_AN5(ADC_SMPR_SMP_47P5); break; case rate::R92P5: val = ADC_SMPR1_SMP_AN5(ADC_SMPR_SMP_92P5); diff --git a/source/dac.cpp b/source/dac.cpp index e0f62a5..74b69e3 100644 --- a/source/dac.cpp +++ b/source/dac.cpp @@ -28,7 +28,7 @@ constexpr static const DACConversionGroup dac_group_config = { }; constexpr static const GPTConfig gpt_config = { - .frequency = 440000, + .frequency = 2400000, .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, 5); + gptStartContinuous(gptd, 25); } void write_stop() diff --git a/source/main.cpp b/source/main.cpp index 9dcd72f..1e3c5fb 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -19,7 +19,7 @@ #include <array> -constexpr unsigned int MAX_SAMPLE_BUFFER_SIZE = 8000;//2048; +constexpr unsigned int MAX_SAMPLE_BUFFER_SIZE = 8000; enum class RunStatus : char { @@ -240,25 +240,25 @@ THD_FUNCTION(conversionThread, arg) std::copy(samples, samples + halfsize, &dac_samples[0]); } else if (message == MSG_CONVSECOND) { if (elf_entry) - samples = elf_entry(&adc_samples[adc_samples.size() / 2], halfsize); + samples = elf_entry(&adc_samples[halfsize], halfsize); if (!samples) - samples = &adc_samples[adc_samples.size() / 2]; + samples = &adc_samples[halfsize]; std::copy(samples, samples + halfsize, &dac_samples[dac_samples.size() / 2]); } else if (message == MSG_CONVFIRST_MEASURE) { chTMStartMeasurementX(&conversion_time_measurement); if (elf_entry) - samples = elf_entry(&adc_samples[adc_samples.size() / 2], halfsize); + samples = elf_entry(&adc_samples[0], halfsize); chTMStopMeasurementX(&conversion_time_measurement); if (!samples) - samples = &adc_samples[adc_samples.size() / 2]; - std::copy(samples, samples + halfsize, &dac_samples[dac_samples.size() / 2]); + samples = &adc_samples[0]; + std::copy(samples, samples + halfsize, &dac_samples[0]); } else if (message == MSG_CONVSECOND_MEASURE) { chTMStartMeasurementX(&conversion_time_measurement); if (elf_entry) - samples = elf_entry(&adc_samples[adc_samples.size() / 2], halfsize); + samples = elf_entry(&adc_samples[halfsize], halfsize); chTMStopMeasurementX(&conversion_time_measurement); if (!samples) - samples = &adc_samples[adc_samples.size() / 2]; + samples = &adc_samples[halfsize]; std::copy(samples, samples + halfsize, &dac_samples[dac_samples.size() / 2]); } } |