diff options
Diffstat (limited to 'source/main.cpp')
-rw-r--r-- | source/main.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/source/main.cpp b/source/main.cpp index 07c73ba..f1170a6 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -35,45 +35,45 @@ int main() palSetPadMode(GPIOA, 5, PAL_MODE_OUTPUT_PUSHPULL); // LED - adc_init(); - dac_init(); - usbserial_init(); + adc::init(); + dac::init(); + usbserial::init(); static unsigned int dac_sample_count = 2048; while (true) { - if (usbserial_is_active()) { + if (usbserial::is_active()) { // Expect to receive a byte command 'packet'. - if (char cmd[3]; usbserial_read(&cmd, 1) > 0) { + if (char cmd[3]; usbserial::read(&cmd, 1) > 0) { switch (cmd[0]) { case 'r': // Read in analog signal - if (usbserial_read(&cmd[1], 2) < 2) + if (usbserial::read(&cmd[1], 2) < 2) break; if (auto count = std::min(static_cast<unsigned int>(cmd[1] | (cmd[2] << 8)), adc_samples.size()); count > 0) { - adc_read(&adc_samples[0], count); - usbserial_write(adc_samples.data(), count * sizeof(adcsample_t)); + adc::read(&adc_samples[0], count); + usbserial::write(adc_samples.data(), count * sizeof(adcsample_t)); } break; case 'R': - adc_read_start(signal_operate, &adc_samples[0], adc_samples.size() * sizeof(adcsample_t)); + adc::read_start(signal_operate, &adc_samples[0], adc_samples.size() * sizeof(adcsample_t)); break; case 'S': - adc_read_stop(); + adc::read_stop(); break; case 'W': - if (usbserial_read(&cmd[1], 2) < 2) + if (usbserial::read(&cmd[1], 2) < 2) break; if (auto count = std::min(static_cast<unsigned int>(cmd[1] | (cmd[2] << 8)), dac_samples.size()); count > 0) dac_sample_count = count; else - dac_write_stop(); + dac::write_stop(); break; case 'w': - if (usbserial_read(&dac_samples[0], 2 * dac_sample_count) != 2 * dac_sample_count) + if (usbserial::read(&dac_samples[0], 2 * dac_sample_count) != 2 * dac_sample_count) break; - dac_write_start(&dac_samples[0], dac_sample_count); + dac::write_start(&dac_samples[0], dac_sample_count); break; case 'i': // Identify ourself as an stmdsp device - usbserial_write("stmdsp", 6); + usbserial::write("stmdsp", 6); break; default: break; |