aboutsummaryrefslogtreecommitdiffstats
path: root/gui/stmdsp.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2021-02-21 08:59:15 -0500
committerClyne Sullivan <clyne@bitgloo.com>2021-02-21 08:59:15 -0500
commit5f6181bb3c6ab4274a8068aaf14b278fa65e443e (patch)
treeb10df50b06378e8efb869ea1998f07de100b19ea /gui/stmdsp.cpp
parente8f312f881d555e9bb92ecd245c398d7c23c33fa (diff)
signal monitoring support
Diffstat (limited to 'gui/stmdsp.cpp')
-rw-r--r--gui/stmdsp.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/gui/stmdsp.cpp b/gui/stmdsp.cpp
index 1b4bba6..5ea18af 100644
--- a/gui/stmdsp.cpp
+++ b/gui/stmdsp.cpp
@@ -120,6 +120,33 @@ namespace stmdsp
return {};
}
+ std::vector<adcsample_t> device::continuous_read_input() {
+ if (connected()) {
+ m_serial.write("t");
+ unsigned char sizebytes[2];
+ m_serial.read(sizebytes, 2);
+ unsigned int size = sizebytes[0] | (sizebytes[1] << 8);
+ if (size > 0) {
+ std::vector<adcsample_t> data (size);
+ unsigned int total = size * sizeof(adcsample_t);
+ unsigned int offset = 0;
+
+ while (total > 512) {
+ m_serial.read(reinterpret_cast<uint8_t *>(&data[0]) + offset, 512);
+ m_serial.write("n");
+ offset += 512;
+ total -= 512;
+ }
+ m_serial.read(reinterpret_cast<uint8_t *>(&data[0]) + offset, total);
+ m_serial.write("n");
+ return data;
+
+ }
+ }
+
+ return {};
+ }
+
void device::continuous_stop() {
if (connected())
m_serial.write("S");