allow output recording

pull/3/head
Clyne 4 years ago
parent f588214307
commit 1b5ca39ba7

@ -118,8 +118,6 @@ int main()
static unsigned int dac_sample_count = MAX_SAMPLE_BUFFER_SIZE;
static unsigned int dac2_sample_count = MAX_SAMPLE_BUFFER_SIZE;
static unsigned int adc_sample_count = MAX_SAMPLE_BUFFER_SIZE;
//static bool adc_preloaded = false;
//static bool dac_preloaded = false;
void main_loop()
{
@ -223,9 +221,7 @@ void main_loop()
if (run_status == RunStatus::Idle) {
run_status = RunStatus::Running;
dac_samples.fill(0);
//if (!adc_preloaded)
adc::read_start(signal_operate_measure, &adc_samples[0], adc_sample_count);
//if (!dac_preloaded)
dac::write_start(0, &dac_samples[0], dac_sample_count);
} else {
error_queue_add(Error::NotIdle);
@ -244,9 +240,7 @@ void main_loop()
if (run_status == RunStatus::Idle) {
run_status = RunStatus::Running;
dac_samples.fill(0);
//if (!adc_preloaded)
adc::read_start(signal_operate, &adc_samples[0], adc_sample_count);
//if (!dac_preloaded)
dac::write_start(0, &dac_samples[0], dac_sample_count);
} else {
error_queue_add(Error::NotIdle);
@ -254,26 +248,25 @@ void main_loop()
break;
case 'r':
if (usbserial::read(&cmd[1], 1) == 1) {
if (usbserial::read(&cmd[1], 1) == 1)
adc::set_rate(static_cast<adc::rate>(cmd[1]));
// adc_preloaded = cmd[1] & (1 << 0);
// dac_preloaded = cmd[1] & (1 << 1);
} else {
else
error_queue_add(Error::BadParamSize);
}
break;
// 'S' - Stops the continuous sampling/conversion.
case 'S':
if (run_status == RunStatus::Running) {
//if (!dac_preloaded)
dac::write_stop(0);
//if (!adc_preloaded)
adc::read_stop();
run_status = RunStatus::Idle;
}
break;
case 's':
usbserial::write(dac_samples.data(), dac_sample_count * sizeof(dacsample_t));
break;
case 'W':
dac::write_start(1, &dac2_samples[0], dac2_sample_count);
break;
@ -294,9 +287,7 @@ void main_loop()
void conversion_abort()
{
elf_entry = nullptr;
//if (!dac_preloaded)
dac::write_stop(0);
//if (!adc_preloaded)
adc::read_stop();
error_queue_add(Error::ConversionAborted);
}

Loading…
Cancel
Save