auto button = dynamic_cast<wxButton *>(ce.GetEventObject());
if (!m_render_timer->IsRunning()) {
- m_device = new stmdsp::device(m_device_combo->GetStringSelection().ToStdString());
+ if (m_device == nullptr)
+ m_device = new stmdsp::device(m_device_combo->GetStringSelection().ToStdString());
if (m_device->connected()) {
m_device->continuous_start();
m_device_samples_future = std::async(std::launch::async,
m_device->continuous_stop();
button->SetLabel("Single");
- delete m_device;
- m_device = nullptr;
+ //delete m_device;
+ //m_device = nullptr;
}
}
if (wxFileInputStream file_stream (/*dialog.GetPath()*/file); file_stream.IsOk()) {
auto size = file_stream.GetSize();
auto buffer = new unsigned char[size];
- auto device = new stmdsp::device(m_device_combo->GetStringSelection().ToStdString());
- if (device->connected()) {
+ if (m_device == nullptr)
+ m_device = new stmdsp::device(m_device_combo->GetStringSelection().ToStdString());
+ if (m_device->connected()) {
file_stream.ReadAll(buffer, size);
- device->upload_filter(buffer, size);
+ m_device->upload_filter(buffer, size);
}
}
}
.cfgr2 = 0,
.tr1 = ADC_TR(0, 4095),
.smpr = {
- ADC_SMPR1_SMP_AN5(ADC_SMPR_SMP_247P5), 0
+ ADC_SMPR1_SMP_AN5(ADC_SMPR_SMP_2P5), 0
},
.sqr = {
ADC_SQR1_SQ1_N(ADC_CHANNEL_IN5),
};
constexpr static const GPTConfig gpt_config = {
- .frequency = 1000000,
+ .frequency = 4000000,
.callback = nullptr,
.cr2 = TIM_CR2_MMS_1, /* TRGO */
.dier = 0
adc_is_read_finished = false;
adc_group_config.circular = false;
adcStartConversion(adcd, &adc_group_config, buffer, count);
- gptStartContinuous(gptd, 100); // 10kHz
+ gptStartContinuous(gptd, 2);
while (!adc_is_read_finished);
return buffer;
}
adc_operation_func = operation_func;
adc_group_config.circular = true;
adcStartConversion(adcd, &adc_group_config, buffer, count);
- gptStartContinuous(gptd, 100); // 10kHz
+ gptStartContinuous(gptd, 2);
}
void read_stop()
};
constexpr static const GPTConfig gpt_config = {
- .frequency = 1000000,
+ .frequency = 4000000,
.callback = nullptr,
.cr2 = TIM_CR2_MMS_1, /* TRGO */
.dier = 0
void write_start(dacsample_t *buffer, size_t count)
{
dacStartConversion(dacd, &dac_group_config, buffer, count);
- gptStartContinuous(gptd, 100);
+ gptStartContinuous(gptd, 2);
}
void write_stop()