Commit 6774e7c0a09edb798efaacf83017a921e869c8e0
1 parent
ed72f34b
Redesign of Hantek::Control
Showing
9 changed files
with
747 additions
and
567 deletions
openhantek/ChangeLog
| ... | ... | @@ -126,3 +126,7 @@ |
| 126 | 126 | * Version 0.2.0: |
| 127 | 127 | * Updated version information |
| 128 | 128 | * Updated Doxygen mainpage and roadmap |
| 129 | + | |
| 130 | +2011-11-16 Oliver Haag <oliver.haag@gmail.com> | |
| 131 | +* Redesign of Hantek::Control to make it easier to add support for new models | |
| 132 | +* Removed buggy destructor from GlGenerator, proper cleanup still missing | ... | ... |
openhantek/OpenHantek.pro
openhantek/src/dockwindows.cpp
| ... | ... | @@ -50,13 +50,13 @@ HorizontalDock::HorizontalDock(DsoSettings *settings, QWidget *parent, Qt::Windo |
| 50 | 50 | << 1e-3 << 2e-3 << 4e-3 << 1e-2 << 2e-2 << 4e-2 << 1e-1 << 2e-1 << 4e-1 |
| 51 | 51 | << 1e0 << 2e0 << 4e0 << 1e1 << 2e1 << 4e1 << 6e1 << 12e1 << 24e1 |
| 52 | 52 | << 6e2 << 12e2 << 24e2 << 36e2; ///< Timebase steps in seconds/div |
| 53 | - for(QList<double>::iterator timebase = this->timebaseSteps.begin(); timebase != this->timebaseSteps.end(); ++timebase) | |
| 53 | + for(QList<double>::iterator timebase = this->timebaseSteps.begin(); timebase != this->timebaseSteps.end(); timebase++) | |
| 54 | 54 | this->timebaseStrings << Helper::valueToString(*timebase, Helper::UNIT_SECONDS, 0); |
| 55 | 55 | this->frequencybaseSteps |
| 56 | 56 | << 1.0 << 2.0 << 5.0 << 1e1 << 2e1 << 5e1 << 1e2 << 2e2 << 5e2 |
| 57 | 57 | << 1e3 << 2e3 << 5e3 << 1e4 << 2e4 << 4e4 << 1e5 << 2e5 << 5e5 |
| 58 | 58 | << 1e6 << 2e6 << 5e6 << 1e7; ///< Frequencybase steps in Hz/div |
| 59 | - for(QList<double>::iterator frequencybase = this->frequencybaseSteps.begin(); frequencybase != this->frequencybaseSteps.end(); ++frequencybase) | |
| 59 | + for(QList<double>::iterator frequencybase = this->frequencybaseSteps.begin(); frequencybase != this->frequencybaseSteps.end(); frequencybase++) | |
| 60 | 60 | this->frequencybaseStrings << Helper::valueToString(*frequencybase, Helper::UNIT_HERTZ, 0); |
| 61 | 61 | |
| 62 | 62 | // Initialize elements |
| ... | ... | @@ -323,7 +323,7 @@ SpectrumDock::SpectrumDock(DsoSettings *settings, QWidget *parent, Qt::WindowFla |
| 323 | 323 | // Initialize lists for comboboxes |
| 324 | 324 | this->magnitudeSteps << 1e0 << 2e0 << 3e0 << 6e0 |
| 325 | 325 | << 1e1 << 2e1 << 3e1 << 6e1 << 1e2 << 2e2 << 3e2 << 6e2; ///< Magnitude steps in dB/div |
| 326 | - for(QList<double>::iterator magnitude = this->magnitudeSteps.begin(); magnitude != this->magnitudeSteps.end(); ++magnitude) | |
| 326 | + for(QList<double>::iterator magnitude = this->magnitudeSteps.begin(); magnitude != this->magnitudeSteps.end(); magnitude++) | |
| 327 | 327 | this->magnitudeStrings << Helper::valueToString(*magnitude, Helper::UNIT_DECIBEL, 0); |
| 328 | 328 | |
| 329 | 329 | // Initialize elements | ... | ... |
openhantek/src/glgenerator.cpp
| ... | ... | @@ -86,7 +86,7 @@ GlGenerator::GlGenerator(DsoSettings *settings, QObject *parent) : QObject(paren |
| 86 | 86 | |
| 87 | 87 | /// \brief Deletes OpenGL objects. |
| 88 | 88 | GlGenerator::~GlGenerator() { |
| 89 | - delete[] this->vaChannel; | |
| 89 | + // todo: Clean up vaChannel | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /// \brief Set the data analyzer whose data will be drawn. | ... | ... |
openhantek/src/hantek/control.cpp
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | // |
| 6 | 6 | // Copyright (C) 2008, 2009 Oleg Khudyakov |
| 7 | 7 | // prcoder@potrebitel.ru |
| 8 | -// Copyright (C) 2010 Oliver Haag | |
| 8 | +// Copyright (C) 2010, 2011 Oliver Haag | |
| 9 | 9 | // oliver.haag@gmail.com |
| 10 | 10 | // |
| 11 | 11 | // This program is free software: you can redistribute it and/or modify it |
| ... | ... | @@ -24,6 +24,8 @@ |
| 24 | 24 | //////////////////////////////////////////////////////////////////////////////// |
| 25 | 25 | |
| 26 | 26 | |
| 27 | +#include <limits> | |
| 28 | + | |
| 27 | 29 | #include <QList> |
| 28 | 30 | #include <QMutex> |
| 29 | 31 | |
| ... | ... | @@ -39,38 +41,60 @@ namespace Hantek { |
| 39 | 41 | /// \brief Initializes the command buffers and lists. |
| 40 | 42 | /// \param parent The parent widget. |
| 41 | 43 | Control::Control(QObject *parent) : DsoControl(parent) { |
| 42 | - // Values for the Gain and Timebase enums | |
| 43 | - this->gainSteps << 0.08 << 0.16 << 0.40 << 0.80 << 1.60 << 4.00 | |
| 44 | - << 8.0 << 16.0 << 40.0; | |
| 45 | - this->samplerateChannelMax = 50e6; | |
| 46 | - this->samplerateFastMax = 100e6; | |
| 47 | - this->samplerateMax = this->samplerateChannelMax; | |
| 48 | - this->samplerateDivider = 1; | |
| 49 | - this->triggerPosition = 0; | |
| 50 | - this->triggerSlope = Dso::SLOPE_POSITIVE; | |
| 51 | - this->triggerSpecial = false; | |
| 52 | - this->triggerSource = 0; | |
| 53 | - this->commandVersion = 0; | |
| 44 | + // Use DSO-2090 specification as default | |
| 45 | + this->specification.command.bulk.setBuffer = BULK_SETTRIGGERANDSAMPLERATE; | |
| 46 | + this->specification.command.bulk.setFilter = BULK_SETFILTER; | |
| 47 | + this->specification.command.bulk.setGain = BULK_SETGAIN; | |
| 48 | + this->specification.command.bulk.setSamplerate = BULK_SETTRIGGERANDSAMPLERATE; | |
| 49 | + this->specification.command.bulk.setTrigger = BULK_SETTRIGGERANDSAMPLERATE; | |
| 50 | + this->specification.command.control.setOffset = CONTROL_SETOFFSET; | |
| 51 | + this->specification.command.control.setRelays = CONTROL_SETRELAYS; | |
| 52 | + this->specification.command.values.offsetLimits = VALUE_OFFSETLIMITS; | |
| 53 | + this->specification.command.values.voltageLimits = (ControlValue) -1; | |
| 54 | + | |
| 55 | + this->specification.gainSteps << 0.08 << 0.16 << 0.40 << 0.80 << 1.60 | |
| 56 | + << 4.00 << 8.0 << 16.0 << 40.0; | |
| 57 | + | |
| 58 | + this->specification.samplerate.single.base = 50e6; | |
| 59 | + this->specification.samplerate.single.max = 50e6; | |
| 60 | + this->specification.samplerate.multi.base = 100e6; | |
| 61 | + this->specification.samplerate.multi.max = 100e6; | |
| 62 | + | |
| 63 | + for(unsigned int channel = 0; channel < HANTEK_CHANNELS; channel++) { | |
| 64 | + for(unsigned int gainId = 0; gainId < GAIN_COUNT; gainId++) { | |
| 65 | + this->specification.offsetLimit[channel][gainId][OFFSET_START] = 0x0000; | |
| 66 | + this->specification.offsetLimit[channel][gainId][OFFSET_END] = 0xffff; | |
| 67 | + } | |
| 68 | + } | |
| 69 | + | |
| 70 | + // Set settings to default values | |
| 71 | + this->settings.bufferSizeId = 0; | |
| 72 | + this->settings.samplerate.limits = &(this->specification.samplerate.single); | |
| 73 | + this->settings.samplerate.downsampling = 1; | |
| 74 | + this->settings.trigger.position = 0; | |
| 75 | + this->settings.trigger.slope = Dso::SLOPE_POSITIVE; | |
| 76 | + this->settings.trigger.special = false; | |
| 77 | + this->settings.trigger.source = 0; | |
| 54 | 78 | |
| 55 | 79 | // Special trigger sources |
| 56 | 80 | this->specialTriggerSources << tr("EXT") << tr("EXT/10"); |
| 57 | 81 | |
| 58 | 82 | // Transmission-ready bulk commands |
| 59 | - this->command[COMMAND_SETFILTER] = new CommandSetFilter(); | |
| 60 | - this->command[COMMAND_SETTRIGGERANDSAMPLERATE] = new CommandSetTriggerAndSamplerate(); | |
| 61 | - this->command[COMMAND_FORCETRIGGER] = new CommandForceTrigger(); | |
| 62 | - this->command[COMMAND_STARTSAMPLING] = new CommandCaptureStart(); | |
| 63 | - this->command[COMMAND_ENABLETRIGGER] = new CommandTriggerEnabled(); | |
| 64 | - this->command[COMMAND_GETDATA] = new CommandGetData(); | |
| 65 | - this->command[COMMAND_GETCAPTURESTATE] = new CommandGetCaptureState(); | |
| 66 | - this->command[COMMAND_SETGAIN] = new CommandSetGain(); | |
| 67 | - this->command[COMMAND_SETLOGICALDATA] = new CommandSetLogicalData(); | |
| 68 | - this->command[COMMAND_GETLOGICALDATA] = new CommandGetLogicalData(); | |
| 69 | - this->command[COMMAND_SETSAMPLERATE5200] = new CommandSetSamplerate5200(); | |
| 70 | - this->command[COMMAND_SETBUFFER5200] = new CommandSetBuffer5200(); | |
| 71 | - this->command[COMMAND_SETTRIGGER5200] = new CommandSetTrigger5200(); | |
| 72 | - | |
| 73 | - for(int command = 0; command < COMMAND_COUNT; command++) | |
| 83 | + this->command[BULK_SETFILTER] = new BulkSetFilter(); | |
| 84 | + this->command[BULK_SETTRIGGERANDSAMPLERATE] = new BulkSetTriggerAndSamplerate(); | |
| 85 | + this->command[BULK_FORCETRIGGER] = new BulkForceTrigger(); | |
| 86 | + this->command[BULK_STARTSAMPLING] = new BulkCaptureStart(); | |
| 87 | + this->command[BULK_ENABLETRIGGER] = new BulkTriggerEnabled(); | |
| 88 | + this->command[BULK_GETDATA] = new BulkGetData(); | |
| 89 | + this->command[BULK_GETCAPTURESTATE] = new BulkGetCaptureState(); | |
| 90 | + this->command[BULK_SETGAIN] = new BulkSetGain(); | |
| 91 | + this->command[BULK_SETLOGICALDATA] = new BulkSetLogicalData(); | |
| 92 | + this->command[BULK_GETLOGICALDATA] = new BulkGetLogicalData(); | |
| 93 | + this->command[BULK_SETSAMPLERATE5200] = new BulkSetSamplerate5200(); | |
| 94 | + this->command[BULK_SETBUFFER5200] = new BulkSetBuffer5200(); | |
| 95 | + this->command[BULK_SETTRIGGER5200] = new BulkSetTrigger5200(); | |
| 96 | + | |
| 97 | + for(int command = 0; command < BULK_COUNT; command++) | |
| 74 | 98 | this->commandPending[command] = false; |
| 75 | 99 | |
| 76 | 100 | // Transmission-ready control commands |
| ... | ... | @@ -82,14 +106,6 @@ namespace Hantek { |
| 82 | 106 | for(int control = 0; control < CONTROLINDEX_COUNT; control++) |
| 83 | 107 | this->controlPending[control] = false; |
| 84 | 108 | |
| 85 | - // Channel level data | |
| 86 | - for(unsigned int channel = 0; channel < HANTEK_CHANNELS; channel++) { | |
| 87 | - for(unsigned int gainId = 0; gainId < GAIN_COUNT; gainId++) { | |
| 88 | - this->channelLevels[channel][gainId][OFFSET_START] = 0x0000; | |
| 89 | - this->channelLevels[channel][gainId][OFFSET_END] = 0xffff; | |
| 90 | - } | |
| 91 | - } | |
| 92 | - | |
| 93 | 109 | // USB device |
| 94 | 110 | this->device = new Device(this); |
| 95 | 111 | |
| ... | ... | @@ -124,7 +140,7 @@ namespace Hantek { |
| 124 | 140 | |
| 125 | 141 | while(captureState != LIBUSB_ERROR_NO_DEVICE && !this->terminate) { |
| 126 | 142 | // Send all pending bulk commands |
| 127 | - for(int command = 0; command < COMMAND_COUNT; command++) { | |
| 143 | + for(int command = 0; command < BULK_COUNT; command++) { | |
| 128 | 144 | if(!this->commandPending[command]) |
| 129 | 145 | continue; |
| 130 | 146 | |
| ... | ... | @@ -134,7 +150,7 @@ namespace Hantek { |
| 134 | 150 | |
| 135 | 151 | errorCode = this->device->bulkCommand(this->command[command]); |
| 136 | 152 | if(errorCode < 0) { |
| 137 | - qDebug("Sending bulk command 0x%02x failed: %s", command, Helper::libUsbErrorString(errorCode).toLocal8Bit().data()); | |
| 153 | + qWarning("Sending bulk command 0x%02x failed: %s", command, Helper::libUsbErrorString(errorCode).toLocal8Bit().data()); | |
| 138 | 154 | |
| 139 | 155 | if(errorCode == LIBUSB_ERROR_NO_DEVICE) { |
| 140 | 156 | captureState = LIBUSB_ERROR_NO_DEVICE; |
| ... | ... | @@ -158,7 +174,7 @@ namespace Hantek { |
| 158 | 174 | |
| 159 | 175 | errorCode = this->device->controlWrite(this->controlCode[control], this->control[control]->data(), this->control[control]->getSize()); |
| 160 | 176 | if(errorCode < 0) { |
| 161 | - qDebug("Sending control command 0x%2x failed: %s", control, Helper::libUsbErrorString(errorCode).toLocal8Bit().data()); | |
| 177 | + qWarning("Sending control command 0x%2x failed: %s", control, Helper::libUsbErrorString(errorCode).toLocal8Bit().data()); | |
| 162 | 178 | |
| 163 | 179 | if(errorCode == LIBUSB_ERROR_NO_DEVICE) { |
| 164 | 180 | captureState = LIBUSB_ERROR_NO_DEVICE; |
| ... | ... | @@ -171,9 +187,9 @@ namespace Hantek { |
| 171 | 187 | if(captureState == LIBUSB_ERROR_NO_DEVICE) |
| 172 | 188 | break; |
| 173 | 189 | |
| 174 | - // Check the current oscilloscope state everytime 25% of the buffer should be refilled | |
| 190 | + // Check the current oscilloscope state everytime 25% of the time the buffer should be refilled | |
| 175 | 191 | // Not more often than every 10 ms though |
| 176 | - int cycleTime = qMax(this->samplerateDivider * this->bufferSize * 250 / this->samplerateMax, (long unsigned int) 10); | |
| 192 | + int cycleTime = qMax((unsigned long int) (this->specification.bufferSizes[this->settings.bufferSizeId] / this->settings.samplerate.current * 250), (long unsigned int) 10); | |
| 177 | 193 | this->msleep(cycleTime); |
| 178 | 194 | |
| 179 | 195 | if(!this->sampling) { |
| ... | ... | @@ -195,10 +211,10 @@ namespace Hantek { |
| 195 | 211 | // Get data and process it, if we're still sampling |
| 196 | 212 | errorCode = this->getSamples(samplingStarted); |
| 197 | 213 | if(errorCode < 0) |
| 198 | - qDebug("Getting sample data failed: %s", Helper::libUsbErrorString(errorCode).toLocal8Bit().data()); | |
| 214 | + qWarning("Getting sample data failed: %s", Helper::libUsbErrorString(errorCode).toLocal8Bit().data()); | |
| 199 | 215 | |
| 200 | 216 | // Check if we're in single trigger mode |
| 201 | - if(this->triggerMode == Dso::TRIGGERMODE_SINGLE && samplingStarted) | |
| 217 | + if(this->settings.trigger.mode == Dso::TRIGGERMODE_SINGLE && samplingStarted) | |
| 202 | 218 | this->stopSampling(); |
| 203 | 219 | |
| 204 | 220 | // Sampling completed, restart it when necessary |
| ... | ... | @@ -209,29 +225,29 @@ namespace Hantek { |
| 209 | 225 | break; |
| 210 | 226 | |
| 211 | 227 | case CAPTURE_WAITING: |
| 212 | - if(samplingStarted && lastTriggerMode == this->triggerMode) { | |
| 228 | + if(samplingStarted && lastTriggerMode == this->settings.trigger.mode) { | |
| 213 | 229 | cycleCounter++; |
| 214 | 230 | |
| 215 | 231 | if(cycleCounter == startCycle) { |
| 216 | 232 | // Buffer refilled completely since start of sampling, enable the trigger now |
| 217 | - errorCode = this->device->bulkCommand(this->command[COMMAND_ENABLETRIGGER]); | |
| 233 | + errorCode = this->device->bulkCommand(this->command[BULK_ENABLETRIGGER]); | |
| 218 | 234 | if(errorCode < 0) { |
| 219 | 235 | if(errorCode == LIBUSB_ERROR_NO_DEVICE) |
| 220 | 236 | captureState = LIBUSB_ERROR_NO_DEVICE; |
| 221 | 237 | break; |
| 222 | 238 | } |
| 223 | - #ifdef DEBUG | |
| 239 | +#ifdef DEBUG | |
| 224 | 240 | qDebug("Enabling trigger"); |
| 225 | - #endif | |
| 241 | +#endif | |
| 226 | 242 | } |
| 227 | - else if(cycleCounter >= 8 + startCycle && this->triggerMode == Dso::TRIGGERMODE_AUTO) { | |
| 243 | + else if(cycleCounter >= 8 + startCycle && this->settings.trigger.mode == Dso::TRIGGERMODE_AUTO) { | |
| 228 | 244 | // Force triggering |
| 229 | - errorCode = this->device->bulkCommand(this->command[COMMAND_FORCETRIGGER]); | |
| 245 | + errorCode = this->device->bulkCommand(this->command[BULK_FORCETRIGGER]); | |
| 230 | 246 | if(errorCode == LIBUSB_ERROR_NO_DEVICE) |
| 231 | 247 | captureState = LIBUSB_ERROR_NO_DEVICE; |
| 232 | - #ifdef DEBUG | |
| 248 | +#ifdef DEBUG | |
| 233 | 249 | qDebug("Forcing trigger"); |
| 234 | - #endif | |
| 250 | +#endif | |
| 235 | 251 | } |
| 236 | 252 | |
| 237 | 253 | if(cycleCounter < 50 || cycleCounter < 4000 / cycleTime) |
| ... | ... | @@ -239,7 +255,7 @@ namespace Hantek { |
| 239 | 255 | } |
| 240 | 256 | |
| 241 | 257 | // Start capturing |
| 242 | - errorCode = this->device->bulkCommand(this->command[COMMAND_STARTSAMPLING]); | |
| 258 | + errorCode = this->device->bulkCommand(this->command[BULK_STARTSAMPLING]); | |
| 243 | 259 | if(errorCode < 0) { |
| 244 | 260 | if(errorCode == LIBUSB_ERROR_NO_DEVICE) |
| 245 | 261 | captureState = LIBUSB_ERROR_NO_DEVICE; |
| ... | ... | @@ -251,15 +267,15 @@ namespace Hantek { |
| 251 | 267 | |
| 252 | 268 | samplingStarted = true; |
| 253 | 269 | cycleCounter = 0; |
| 254 | - startCycle = this->triggerPosition * 1000 / cycleTime + 1; | |
| 255 | - lastTriggerMode = this->triggerMode; | |
| 270 | + startCycle = this->settings.trigger.position * 1000 / cycleTime + 1; | |
| 271 | + lastTriggerMode = this->settings.trigger.mode; | |
| 256 | 272 | break; |
| 257 | 273 | |
| 258 | 274 | case CAPTURE_SAMPLING: |
| 259 | 275 | break; |
| 260 | 276 | default: |
| 261 | 277 | if(captureState < 0) |
| 262 | - qDebug("Getting capture state failed: %s", Helper::libUsbErrorString(captureState).toLocal8Bit().data()); | |
| 278 | + qWarning("Getting capture state failed: %s", Helper::libUsbErrorString(captureState).toLocal8Bit().data()); | |
| 263 | 279 | break; |
| 264 | 280 | } |
| 265 | 281 | } |
| ... | ... | @@ -287,16 +303,16 @@ namespace Hantek { |
| 287 | 303 | int Control::getCaptureState() { |
| 288 | 304 | int errorCode; |
| 289 | 305 | |
| 290 | - errorCode = this->device->bulkCommand(this->command[COMMAND_GETCAPTURESTATE], 1); | |
| 306 | + errorCode = this->device->bulkCommand(this->command[BULK_GETCAPTURESTATE], 1); | |
| 291 | 307 | if(errorCode < 0) |
| 292 | 308 | return errorCode; |
| 293 | 309 | |
| 294 | - ResponseGetCaptureState response; | |
| 310 | + BulkResponseGetCaptureState response; | |
| 295 | 311 | errorCode = this->device->bulkRead(response.data(), response.getSize()); |
| 296 | 312 | if(errorCode < 0) |
| 297 | 313 | return errorCode; |
| 298 | 314 | |
| 299 | - this->triggerPoint = this->calculateTriggerPoint(response.getTriggerPoint()); | |
| 315 | + this->settings.trigger.point = this->calculateTriggerPoint(response.getTriggerPoint()); | |
| 300 | 316 | |
| 301 | 317 | return (int) response.getCaptureState(); |
| 302 | 318 | } |
| ... | ... | @@ -307,12 +323,12 @@ namespace Hantek { |
| 307 | 323 | int errorCode; |
| 308 | 324 | |
| 309 | 325 | // Request data |
| 310 | - errorCode = this->device->bulkCommand(this->command[COMMAND_GETDATA], 1); | |
| 326 | + errorCode = this->device->bulkCommand(this->command[BULK_GETDATA], 1); | |
| 311 | 327 | if(errorCode < 0) |
| 312 | 328 | return errorCode; |
| 313 | 329 | |
| 314 | 330 | // Save raw data to temporary buffer |
| 315 | - unsigned int dataCount = this->bufferSize * HANTEK_CHANNELS; | |
| 331 | + unsigned int dataCount = this->specification.bufferSizes[this->settings.bufferSizeId] * HANTEK_CHANNELS; | |
| 316 | 332 | unsigned int dataLength = dataCount; |
| 317 | 333 | bool using10Bits = false; |
| 318 | 334 | if(this->device->getModel() == MODEL_DSO5200 || this->device->getModel() == MODEL_DSO5200A) { |
| ... | ... | @@ -339,13 +355,13 @@ namespace Hantek { |
| 339 | 355 | // Get oscilloscope settings |
| 340 | 356 | bool fastRate; |
| 341 | 357 | UsedChannels usedChannels; |
| 342 | - if(this->commandVersion == 0) { | |
| 343 | - fastRate = ((CommandSetTriggerAndSamplerate *) this->command[COMMAND_SETTRIGGERANDSAMPLERATE])->getFastRate(); | |
| 344 | - usedChannels = (UsedChannels) ((CommandSetTriggerAndSamplerate *) this->command[COMMAND_SETTRIGGERANDSAMPLERATE])->getUsedChannels(); | |
| 358 | + if(this->specification.command.bulk.setTrigger == BULK_SETTRIGGERANDSAMPLERATE) { | |
| 359 | + fastRate = ((BulkSetTriggerAndSamplerate *) this->command[BULK_SETTRIGGERANDSAMPLERATE])->getFastRate(); | |
| 360 | + usedChannels = (UsedChannels) ((BulkSetTriggerAndSamplerate *) this->command[BULK_SETTRIGGERANDSAMPLERATE])->getUsedChannels(); | |
| 345 | 361 | } |
| 346 | 362 | else { |
| 347 | - fastRate = ((CommandSetTrigger5200 *) this->command[COMMAND_SETTRIGGER5200])->getFastRate(); | |
| 348 | - usedChannels = (UsedChannels) ((CommandSetTrigger5200 *) this->command[COMMAND_SETTRIGGER5200])->getUsedChannels(); | |
| 363 | + fastRate = ((BulkSetTrigger5200 *) this->command[BULK_SETTRIGGER5200])->getFastRate(); | |
| 364 | + usedChannels = (UsedChannels) ((BulkSetTrigger5200 *) this->command[BULK_SETTRIGGER5200])->getUsedChannels(); | |
| 349 | 365 | } |
| 350 | 366 | // Convert channel data |
| 351 | 367 | if(fastRate) { |
| ... | ... | @@ -374,7 +390,7 @@ namespace Hantek { |
| 374 | 390 | } |
| 375 | 391 | |
| 376 | 392 | // Convert data from the oscilloscope and write it into the sample buffer |
| 377 | - unsigned int bufferPosition = (this->triggerPoint + 1) * 2; | |
| 393 | + unsigned int bufferPosition = (this->settings.trigger.point + 1) * 2; | |
| 378 | 394 | if(using10Bits) { |
| 379 | 395 | // Additional 2 most significant bits after the normal data |
| 380 | 396 | unsigned int extraBitsPosition; // Track the position of the extra bits in the additional byte |
| ... | ... | @@ -385,7 +401,7 @@ namespace Hantek { |
| 385 | 401 | |
| 386 | 402 | extraBitsPosition = bufferPosition % HANTEK_CHANNELS; |
| 387 | 403 | |
| 388 | - this->samples[channel][realPosition] = ((double) ((unsigned short int) data[bufferPosition] + (((unsigned short int) data[dataCount + bufferPosition - extraBitsPosition] << (8 - (HANTEK_CHANNELS - 1 - extraBitsPosition) * 2)) & 0x0200)) / this->sampleRange[HANTEK_CHANNELS - 1 - extraBitsPosition] - this->offsetReal[channel]) * this->gainSteps[this->gain[channel]]; | |
| 404 | + this->samples[channel][realPosition] = ((double) ((unsigned short int) data[bufferPosition] + (((unsigned short int) data[dataCount + bufferPosition - extraBitsPosition] << (8 - (HANTEK_CHANNELS - 1 - extraBitsPosition) * 2)) & 0x0200)) / this->specification.voltageLimit[HANTEK_CHANNELS - 1 - extraBitsPosition][this->settings.voltage[channel].gain] - this->settings.voltage[channel].offsetReal) * this->specification.gainSteps[this->settings.voltage[channel].gain]; | |
| 389 | 405 | } |
| 390 | 406 | } |
| 391 | 407 | else { |
| ... | ... | @@ -393,7 +409,7 @@ namespace Hantek { |
| 393 | 409 | if(bufferPosition >= dataCount) |
| 394 | 410 | bufferPosition %= dataCount; |
| 395 | 411 | |
| 396 | - this->samples[channel][realPosition] = ((double) data[bufferPosition] / this->sampleRange[channel] - this->offsetReal[channel]) * this->gainSteps[this->gain[channel]]; | |
| 412 | + this->samples[channel][realPosition] = ((double) data[bufferPosition] / this->specification.voltageLimit[channel][this->settings.voltage[channel].gain] - this->settings.voltage[channel].offsetReal) * this->specification.gainSteps[this->settings.voltage[channel].gain]; | |
| 397 | 413 | } |
| 398 | 414 | } |
| 399 | 415 | } |
| ... | ... | @@ -413,14 +429,14 @@ namespace Hantek { |
| 413 | 429 | } |
| 414 | 430 | |
| 415 | 431 | // Convert data from the oscilloscope and write it into the sample buffer |
| 416 | - unsigned int bufferPosition = (this->triggerPoint + 1) * 2; | |
| 432 | + unsigned int bufferPosition = (this->settings.trigger.point + 1) * 2; | |
| 417 | 433 | if(using10Bits) { |
| 418 | 434 | // Additional 2 most significant bits after the normal data |
| 419 | 435 | for(unsigned int realPosition = 0; realPosition < channelDataCount; realPosition++, bufferPosition += 2) { |
| 420 | 436 | if(bufferPosition >= dataCount) |
| 421 | 437 | bufferPosition %= dataCount; |
| 422 | 438 | |
| 423 | - this->samples[channel][realPosition] = ((double) ((unsigned short int) data[bufferPosition + HANTEK_CHANNELS - 1 - channel] + (((unsigned short int) data[dataCount + bufferPosition] << (8 - channel * 2)) & 0x0200)) / this->sampleRange[channel] - this->offsetReal[channel]) * this->gainSteps[this->gain[channel]]; | |
| 439 | + this->samples[channel][realPosition] = ((double) ((unsigned short int) data[bufferPosition + HANTEK_CHANNELS - 1 - channel] + (((unsigned short int) data[dataCount + bufferPosition] << (8 - channel * 2)) & 0x0200)) / this->specification.voltageLimit[channel][this->settings.voltage[channel].gain] - this->settings.voltage[channel].offsetReal) * this->specification.gainSteps[this->settings.voltage[channel].gain]; | |
| 424 | 440 | } |
| 425 | 441 | } |
| 426 | 442 | else { |
| ... | ... | @@ -428,7 +444,7 @@ namespace Hantek { |
| 428 | 444 | if(bufferPosition >= dataCount) |
| 429 | 445 | bufferPosition %= dataCount; |
| 430 | 446 | |
| 431 | - this->samples[channel][realPosition] = ((double) data[bufferPosition + HANTEK_CHANNELS - 1 - channel] / this->sampleRange[channel] - this->offsetReal[channel]) * this->gainSteps[this->gain[channel]]; | |
| 447 | + this->samples[channel][realPosition] = ((double) data[bufferPosition + HANTEK_CHANNELS - 1 - channel] / this->specification.voltageLimit[channel][this->settings.voltage[channel].gain] - this->settings.voltage[channel].offsetReal) * this->specification.gainSteps[this->settings.voltage[channel].gain]; | |
| 432 | 448 | } |
| 433 | 449 | } |
| 434 | 450 | } |
| ... | ... | @@ -442,7 +458,7 @@ namespace Hantek { |
| 442 | 458 | } |
| 443 | 459 | |
| 444 | 460 | this->samplesMutex.unlock(); |
| 445 | - emit samplesAvailable(&(this->samples), &(this->samplesSize), (double) this->samplerateMax / this->samplerateDivider, &(this->samplesMutex)); | |
| 461 | + emit samplesAvailable(&(this->samples), &(this->samplesSize), this->settings.samplerate.current, &(this->samplesMutex)); | |
| 446 | 462 | } |
| 447 | 463 | |
| 448 | 464 | return 0; |
| ... | ... | @@ -450,32 +466,49 @@ namespace Hantek { |
| 450 | 466 | |
| 451 | 467 | /// \brief Sets the size of the sample buffer without updating dependencies. |
| 452 | 468 | /// \param size The buffer size that should be met (S). |
| 453 | - /// \return The buffer size that has been set. | |
| 469 | + /// \return The buffer size that has been set, 0 on error. | |
| 454 | 470 | unsigned long int Control::updateBufferSize(unsigned long int size) { |
| 455 | - BufferSizeId sizeId = (size <= BUFFER_SMALL) ? BUFFERID_SMALL : BUFFERID_LARGE; | |
| 471 | + // Get the buffer size supporting the highest samplerate while meeting the requirement | |
| 472 | + int bestSizeId = -1; | |
| 473 | + for(int sizeId = 0; sizeId < this->specification.bufferSizes.count(); sizeId++) { | |
| 474 | + if(this->specification.bufferSizes[sizeId] >= size) { | |
| 475 | + // We meet the size-requirement, check if we provide the highest possible samplerate | |
| 476 | + if(bestSizeId == -1 || this->specification.bufferSizes[bestSizeId] < size || this->specification.bufferDividers[sizeId] < this->specification.bufferDividers[bestSizeId]) | |
| 477 | + bestSizeId = sizeId; | |
| 478 | + } | |
| 479 | + else { | |
| 480 | + // We don't meet the size-requirement, but maybe we're still the one coming closest | |
| 481 | + if(bestSizeId == -1 || this->specification.bufferSizes[sizeId] > this->specification.bufferSizes[bestSizeId]) | |
| 482 | + bestSizeId = sizeId; | |
| 483 | + } | |
| 484 | + } | |
| 456 | 485 | |
| 457 | - switch(this->commandVersion) { | |
| 458 | - case 0: | |
| 486 | + switch(this->specification.command.bulk.setBuffer) { | |
| 487 | + case BULK_SETTRIGGERANDSAMPLERATE: | |
| 459 | 488 | // SetTriggerAndSamplerate bulk command for buffer size |
| 460 | - ((CommandSetTriggerAndSamplerate *) this->command[COMMAND_SETTRIGGERANDSAMPLERATE])->setBufferSize(sizeId); | |
| 461 | - this->commandPending[COMMAND_SETTRIGGERANDSAMPLERATE] = true; | |
| 489 | + ((BulkSetTriggerAndSamplerate *) this->command[BULK_SETTRIGGERANDSAMPLERATE])->setBufferSize(bestSizeId); | |
| 490 | + this->commandPending[BULK_SETTRIGGERANDSAMPLERATE] = true; | |
| 462 | 491 | |
| 463 | - this->bufferSize = (sizeId == BUFFERID_SMALL) ? BUFFER_SMALL : BUFFER_LARGE; | |
| 464 | 492 | break; |
| 465 | 493 | |
| 466 | - case 1: | |
| 494 | + case BULK_SETBUFFER5200: { | |
| 467 | 495 | // SetBuffer5200 bulk command for buffer size |
| 468 | - CommandSetBuffer5200 *commandSetBuffer5200 = (CommandSetBuffer5200 *) this->command[COMMAND_SETBUFFER5200]; | |
| 496 | + BulkSetBuffer5200 *commandSetBuffer5200 = (BulkSetBuffer5200 *) this->command[BULK_SETBUFFER5200]; | |
| 469 | 497 | commandSetBuffer5200->setUsedPre(DTRIGGERPOSITION_ON); |
| 470 | 498 | commandSetBuffer5200->setUsedPost(DTRIGGERPOSITION_ON); |
| 471 | - commandSetBuffer5200->setBufferSize(sizeId); | |
| 472 | - this->commandPending[COMMAND_SETBUFFER5200] = true; | |
| 499 | + commandSetBuffer5200->setBufferSize(bestSizeId); | |
| 500 | + this->commandPending[BULK_SETBUFFER5200] = true; | |
| 473 | 501 | |
| 474 | - this->bufferSize = (sizeId == BUFFERID_SMALL) ? BUFFER_SMALL : BUFFER_LARGE5200; | |
| 475 | 502 | break; |
| 503 | + } | |
| 504 | + | |
| 505 | + default: | |
| 506 | + return 0; | |
| 476 | 507 | } |
| 477 | 508 | |
| 478 | - return this->bufferSize; | |
| 509 | + this->settings.bufferSizeId = bestSizeId; | |
| 510 | + | |
| 511 | + return this->specification.bufferSizes[this->settings.bufferSizeId]; | |
| 479 | 512 | } |
| 480 | 513 | |
| 481 | 514 | /// \brief Try to connect to the oscilloscope. |
| ... | ... | @@ -486,16 +519,32 @@ namespace Hantek { |
| 486 | 519 | if(!this->device->isConnected()) |
| 487 | 520 | return; |
| 488 | 521 | |
| 489 | - // Set all necessary configuration commands as pending | |
| 490 | - this->commandPending[COMMAND_SETFILTER] = true; | |
| 491 | - this->commandPending[COMMAND_FORCETRIGGER] = false; | |
| 492 | - this->commandPending[COMMAND_STARTSAMPLING] = false; | |
| 493 | - this->commandPending[COMMAND_ENABLETRIGGER] = false; | |
| 494 | - this->commandPending[COMMAND_GETDATA] = false; | |
| 495 | - this->commandPending[COMMAND_GETCAPTURESTATE] = false; | |
| 496 | - this->commandPending[COMMAND_SETGAIN] = true; | |
| 497 | - this->commandPending[COMMAND_SETLOGICALDATA] = false; | |
| 498 | - this->commandPending[COMMAND_GETLOGICALDATA] = false; | |
| 522 | + // Initialize the commands used on the DSO-2090 as pending | |
| 523 | + this->commandPending[BULK_SETFILTER] = true; | |
| 524 | + this->commandPending[BULK_SETTRIGGERANDSAMPLERATE] = true; | |
| 525 | + this->commandPending[BULK_FORCETRIGGER] = false; | |
| 526 | + this->commandPending[BULK_STARTSAMPLING] = false; | |
| 527 | + this->commandPending[BULK_ENABLETRIGGER] = false; | |
| 528 | + this->commandPending[BULK_GETDATA] = false; | |
| 529 | + this->commandPending[BULK_GETCAPTURESTATE] = false; | |
| 530 | + this->commandPending[BULK_SETGAIN] = true; | |
| 531 | + this->commandPending[BULK_SETLOGICALDATA] = false; | |
| 532 | + this->commandPending[BULK_GETLOGICALDATA] = false; | |
| 533 | + this->commandPending[BULK_UNKNOWN_0A] = false; | |
| 534 | + this->commandPending[BULK_UNKNOWN_0B] = false; | |
| 535 | + this->commandPending[BULK_SETSAMPLERATE5200] = false; | |
| 536 | + this->commandPending[BULK_SETBUFFER5200] = false; | |
| 537 | + this->commandPending[BULK_SETTRIGGER5200] = false; | |
| 538 | + // Initialize the command versions to the ones used on the DSO-2090 | |
| 539 | + this->specification.command.bulk.setBuffer = BULK_SETTRIGGERANDSAMPLERATE; | |
| 540 | + this->specification.command.bulk.setFilter = BULK_SETFILTER; | |
| 541 | + this->specification.command.bulk.setGain = BULK_SETGAIN; | |
| 542 | + this->specification.command.bulk.setSamplerate = BULK_SETTRIGGERANDSAMPLERATE; | |
| 543 | + this->specification.command.bulk.setTrigger = BULK_SETTRIGGERANDSAMPLERATE; | |
| 544 | + this->specification.command.control.setOffset = CONTROL_SETOFFSET; | |
| 545 | + this->specification.command.control.setRelays = CONTROL_SETRELAYS; | |
| 546 | + this->specification.command.values.offsetLimits = VALUE_OFFSETLIMITS; | |
| 547 | + this->specification.command.values.voltageLimits = (ControlValue) -1; | |
| 499 | 548 | |
| 500 | 549 | // Determine the command version we need for this model |
| 501 | 550 | bool unsupported = false; |
| ... | ... | @@ -503,23 +552,26 @@ namespace Hantek { |
| 503 | 552 | case MODEL_DSO2100: |
| 504 | 553 | case MODEL_DSO2150: |
| 505 | 554 | unsupported = true; |
| 555 | + | |
| 506 | 556 | case MODEL_DSO2090: |
| 507 | - this->commandPending[COMMAND_SETTRIGGERANDSAMPLERATE] = true; | |
| 508 | - this->commandPending[COMMAND_SETSAMPLERATE5200] = false; | |
| 509 | - this->commandPending[COMMAND_SETBUFFER5200] = false; | |
| 510 | - this->commandPending[COMMAND_SETTRIGGER5200] = false; | |
| 511 | - this->commandVersion = 0; | |
| 557 | + // Keep the defaults we've set before | |
| 512 | 558 | break; |
| 513 | 559 | |
| 514 | 560 | case MODEL_DSO2250: |
| 515 | 561 | case MODEL_DSO5200A: |
| 516 | 562 | unsupported = true; |
| 563 | + | |
| 517 | 564 | case MODEL_DSO5200: |
| 518 | - this->commandPending[COMMAND_SETTRIGGERANDSAMPLERATE] = false; | |
| 519 | - this->commandPending[COMMAND_SETSAMPLERATE5200] = true; | |
| 520 | - this->commandPending[COMMAND_SETBUFFER5200] = true; | |
| 521 | - this->commandPending[COMMAND_SETTRIGGER5200] = true; | |
| 522 | - this->commandVersion = 1; | |
| 565 | + this->specification.command.bulk.setBuffer = BULK_SETBUFFER5200; | |
| 566 | + this->specification.command.bulk.setSamplerate = BULK_SETSAMPLERATE5200; | |
| 567 | + this->specification.command.bulk.setTrigger = BULK_SETTRIGGER5200; | |
| 568 | + this->specification.command.values.voltageLimits = VALUE_VOLTAGELIMITS; | |
| 569 | + | |
| 570 | + this->commandPending[BULK_SETTRIGGERANDSAMPLERATE] = false; | |
| 571 | + this->commandPending[BULK_SETSAMPLERATE5200] = true; | |
| 572 | + this->commandPending[BULK_SETBUFFER5200] = true; | |
| 573 | + this->commandPending[BULK_SETTRIGGER5200] = true; | |
| 574 | + | |
| 523 | 575 | break; |
| 524 | 576 | |
| 525 | 577 | default: |
| ... | ... | @@ -529,34 +581,50 @@ namespace Hantek { |
| 529 | 581 | } |
| 530 | 582 | |
| 531 | 583 | if(unsupported) |
| 532 | - qDebug("Warning: This Hantek DSO model isn't supported officially, so it may not be working as expected. Reports about your experiences are very welcome though (Please open a feature request in the tracker at https://sf.net/projects/openhantek/ or email me directly to oliver.haag@gmail.com). If it's working perfectly I can remove this warning, if not it should be possible to get it working with your help soon."); | |
| 584 | + qWarning("Warning: This Hantek DSO model isn't supported officially, so it may not be working as expected. Reports about your experiences are very welcome though (Please open a feature request in the tracker at https://sf.net/projects/openhantek/ or email me directly to oliver.haag@gmail.com). If it's working perfectly I can remove this warning, if not it should be possible to get it working with your help soon."); | |
| 533 | 585 | |
| 534 | 586 | for(int control = 0; control < CONTROLINDEX_COUNT; control++) |
| 535 | 587 | this->controlPending[control] = true; |
| 536 | 588 | |
| 537 | - // Maximum possible samplerate for a single channel | |
| 589 | + // Maximum possible samplerate for a single channel and dividers for buffer sizes | |
| 590 | + this->specification.bufferDividers.clear(); | |
| 591 | + this->specification.bufferSizes.clear(); | |
| 592 | + | |
| 538 | 593 | switch(this->device->getModel()) { |
| 539 | - case MODEL_DSO2090: | |
| 540 | - case MODEL_DSO2100: | |
| 541 | - this->samplerateChannelMax = 50e6; | |
| 542 | - this->samplerateFastMax = 100e6; | |
| 594 | + case MODEL_DSO2250: | |
| 595 | + case MODEL_DSO5200: | |
| 596 | + case MODEL_DSO5200A: | |
| 597 | + this->specification.samplerate.single.base = 100e6; | |
| 598 | + this->specification.samplerate.single.max = 125e6; | |
| 599 | + this->specification.samplerate.multi.base = 200e6; | |
| 600 | + this->specification.samplerate.multi.max = 250e6; | |
| 601 | + this->specification.bufferDividers << 1000 << 1 << 2; | |
| 602 | + this->specification.bufferSizes << ULONG_MAX << 10240 << 14336; | |
| 543 | 603 | break; |
| 544 | 604 | |
| 545 | 605 | case MODEL_DSO2150: |
| 546 | - this->samplerateChannelMax = 50e6; | |
| 547 | - this->samplerateFastMax = 150e6; | |
| 606 | + this->specification.samplerate.single.base = 50e6; | |
| 607 | + this->specification.samplerate.single.max = 75e6; | |
| 608 | + this->specification.samplerate.multi.base = 100e6; | |
| 609 | + this->specification.samplerate.multi.max = 150e6; | |
| 610 | + this->specification.bufferDividers << 1000 << 1 << 2; | |
| 611 | + this->specification.bufferSizes << ULONG_MAX << 10240 << 32768; | |
| 548 | 612 | break; |
| 549 | 613 | |
| 550 | 614 | default: |
| 551 | - this->samplerateChannelMax = 100e6; | |
| 552 | - this->samplerateFastMax = 250e6; | |
| 615 | + this->specification.samplerate.single.base = 50e6; | |
| 616 | + this->specification.samplerate.single.max = 50e6; | |
| 617 | + this->specification.samplerate.multi.base = 100e6; | |
| 618 | + this->specification.samplerate.multi.max = 100e6; | |
| 619 | + this->specification.bufferDividers << 1000 << 1 << 2; | |
| 620 | + this->specification.bufferSizes << ULONG_MAX << 10240 << 32768; | |
| 553 | 621 | break; |
| 554 | 622 | } |
| 555 | - this->samplerateMax = this->samplerateChannelMax; | |
| 556 | - this->samplerateDivider = 1; | |
| 623 | + this->settings.samplerate.limits = &(this->specification.samplerate.single); | |
| 624 | + this->settings.samplerate.downsampling = 1; | |
| 557 | 625 | |
| 558 | 626 | // Get channel level data |
| 559 | - errorCode = this->device->controlRead(CONTROL_VALUE, (unsigned char*) &(this->channelLevels), sizeof(this->channelLevels), (int) VALUE_CHANNELLEVEL); | |
| 627 | + errorCode = this->device->controlRead(CONTROL_VALUE, (unsigned char *) &(this->specification.offsetLimit), sizeof(this->specification.offsetLimit), (int) VALUE_OFFSETLIMITS); | |
| 560 | 628 | if(errorCode < 0) { |
| 561 | 629 | this->device->disconnect(); |
| 562 | 630 | emit statusMessage(tr("Couldn't get channel level data from oscilloscope"), 0); |
| ... | ... | @@ -575,70 +643,66 @@ namespace Hantek { |
| 575 | 643 | |
| 576 | 644 | this->updateBufferSize(size); |
| 577 | 645 | |
| 578 | - this->setTriggerPosition(this->triggerPosition); | |
| 579 | - this->setSamplerate(this->samplerateMax / this->samplerateDivider); | |
| 580 | - this->setTriggerSlope(this->triggerSlope); | |
| 646 | + this->setTriggerPosition(this->settings.trigger.position); | |
| 647 | + this->setSamplerate(); | |
| 581 | 648 | |
| 582 | - return this->bufferSize; | |
| 649 | + return this->specification.bufferSizes[this->settings.bufferSizeId]; | |
| 583 | 650 | } |
| 584 | 651 | |
| 585 | 652 | /// \brief Sets the samplerate of the oscilloscope. |
| 586 | 653 | /// \param samplerate The samplerate that should be met (S/s). |
| 587 | 654 | /// \return The samplerate that has been set. |
| 588 | 655 | unsigned long int Control::setSamplerate(unsigned long int samplerate) { |
| 589 | - if(!this->device->isConnected() || samplerate == 0) | |
| 656 | + if(!this->device->isConnected()) | |
| 590 | 657 | return 0; |
| 591 | 658 | |
| 592 | - // Pointers to needed commands | |
| 593 | - CommandSetTriggerAndSamplerate *commandSetTriggerAndSamplerate = (CommandSetTriggerAndSamplerate *) this->command[COMMAND_SETTRIGGERANDSAMPLERATE]; | |
| 594 | - CommandSetSamplerate5200 *commandSetSamplerate5200 = (CommandSetSamplerate5200 *) this->command[COMMAND_SETSAMPLERATE5200]; | |
| 595 | - CommandSetBuffer5200 *commandSetBuffer5200 = (CommandSetBuffer5200 *) this->command[COMMAND_SETBUFFER5200]; | |
| 596 | - CommandSetTrigger5200 *commandSetTrigger5200 = (CommandSetTrigger5200 *) this->command[COMMAND_SETTRIGGER5200]; | |
| 659 | + // Keep samplerate if no parameter was given | |
| 660 | + if(!samplerate) | |
| 661 | + samplerate = this->settings.samplerate.current; | |
| 662 | + // Abort samplerate calculation if we didn't get a valid value yet | |
| 663 | + if(!samplerate) | |
| 664 | + return samplerate; | |
| 597 | 665 | |
| 598 | 666 | // Calculate with fast rate first if only one channel is used |
| 599 | 667 | bool fastRate = false; |
| 600 | - this->samplerateMax = this->samplerateChannelMax; | |
| 601 | - if(((this->commandVersion == 0) ? commandSetTriggerAndSamplerate->getUsedChannels() : commandSetTrigger5200->getUsedChannels()) != USED_CH1CH2) { | |
| 668 | + this->settings.samplerate.limits = &(this->specification.samplerate.single); | |
| 669 | + if(this->settings.usedChannels <= 1) { | |
| 602 | 670 | fastRate = true; |
| 603 | - this->samplerateMax = this->samplerateFastMax; | |
| 604 | - } | |
| 605 | - | |
| 606 | - // The maximum sample rate depends on the buffer size | |
| 607 | - unsigned int bufferDivider = 1; | |
| 608 | - switch((this->commandVersion == 0) ? commandSetTriggerAndSamplerate->getBufferSize() : commandSetBuffer5200->getBufferSize()) { | |
| 609 | - case BUFFERID_ROLL: | |
| 610 | - bufferDivider = 1000; | |
| 611 | - break; | |
| 612 | - case BUFFERID_LARGE: | |
| 613 | - bufferDivider = 2; | |
| 614 | - break; | |
| 615 | - default: | |
| 616 | - break; | |
| 671 | + this->settings.samplerate.limits = &(this->specification.samplerate.multi); | |
| 617 | 672 | } |
| 618 | 673 | |
| 619 | - // Get divider that would provide the requested rate, can't be zero | |
| 620 | - this->samplerateMax /= bufferDivider; | |
| 621 | - this->samplerateDivider = qMax(this->samplerateMax / samplerate, (long unsigned int) 1); | |
| 674 | + // Get downsampling factor that would provide the requested rate | |
| 675 | + this->settings.samplerate.downsampling = this->settings.samplerate.limits->base / this->specification.bufferDividers[this->settings.bufferSizeId] / samplerate; | |
| 676 | + // A downsampling factor of zero will result in the maximum rate | |
| 677 | + if(this->settings.samplerate.downsampling) | |
| 678 | + this->settings.samplerate.current = this->settings.samplerate.limits->base / this->specification.bufferDividers[this->settings.bufferSizeId] / this->settings.samplerate.downsampling; | |
| 679 | + else | |
| 680 | + this->settings.samplerate.current = this->settings.samplerate.limits->max / this->specification.bufferDividers[this->settings.bufferSizeId]; | |
| 622 | 681 | |
| 623 | - // Use normal mode if we need valueSlow or it would meet the rate at least as exactly as fast rate mode | |
| 682 | + // Maybe normal mode would be sufficient or even better than fast rate mode | |
| 624 | 683 | if(fastRate) { |
| 625 | - unsigned long int slowSamplerate = this->samplerateChannelMax / bufferDivider; | |
| 626 | - unsigned long int slowDivider = qMax(slowSamplerate / samplerate, (long unsigned int) 1); | |
| 684 | + // Don't set the downsampling factor to zero (maximum rate) if we could use fast rate mode anyway | |
| 685 | + unsigned long int slowDownsampling = qMax(this->specification.samplerate.single.base / this->specification.bufferDividers[this->settings.bufferSizeId] / samplerate, (long unsigned int) 1); | |
| 627 | 686 | |
| 628 | - if(this->samplerateDivider > 4 || (qAbs((double) slowSamplerate / slowDivider - samplerate) <= qAbs(((double) this->samplerateMax / this->samplerateDivider) - samplerate))) { | |
| 687 | + // Use normal mode if we need valueSlow or it would meet the rate at least as exactly as fast rate mode | |
| 688 | + if(this->settings.samplerate.downsampling > 4 || (qAbs((double) this->specification.samplerate.single.base / this->specification.bufferDividers[this->settings.bufferSizeId] / slowDownsampling - samplerate) <= qAbs(this->settings.samplerate.current - samplerate))) { | |
| 629 | 689 | fastRate = false; |
| 630 | - this->samplerateMax = slowSamplerate; | |
| 631 | - this->samplerateDivider = slowDivider; | |
| 690 | + this->settings.samplerate.limits = &(this->specification.samplerate.single); | |
| 691 | + this->settings.samplerate.downsampling = slowDownsampling; | |
| 692 | + this->settings.samplerate.current = this->specification.samplerate.single.base / this->specification.bufferDividers[this->settings.bufferSizeId] / this->settings.samplerate.downsampling; | |
| 632 | 693 | } |
| 633 | 694 | } |
| 634 | 695 | |
| 635 | 696 | // Split the resulting divider into the values understood by the device |
| 636 | 697 | // The fast value is kept at 4 (or 3) for slow sample rates |
| 637 | - long int valueSlow = qMax(((long int) this->samplerateDivider - 3) / 2, (long int) 0); | |
| 638 | - unsigned char valueFast = this->samplerateDivider - valueSlow * 2; | |
| 698 | + long int valueSlow = qMax(((long int) this->settings.samplerate.downsampling - 3) / 2, (long int) 0); | |
| 699 | + unsigned char valueFast = this->settings.samplerate.downsampling - valueSlow * 2; | |
| 639 | 700 | |
| 640 | - switch(this->commandVersion) { | |
| 641 | - case 0: | |
| 701 | + switch(this->specification.command.bulk.setSamplerate) { | |
| 702 | + case BULK_SETTRIGGERANDSAMPLERATE: { | |
| 703 | + // Pointers to needed commands | |
| 704 | + BulkSetTriggerAndSamplerate *commandSetTriggerAndSamplerate = (BulkSetTriggerAndSamplerate *) this->command[BULK_SETTRIGGERANDSAMPLERATE]; | |
| 705 | + | |
| 642 | 706 | // Store samplerate fast value |
| 643 | 707 | commandSetTriggerAndSamplerate->setSamplerateFast(valueFast); |
| 644 | 708 | // Store samplerate slow value (two's complement) |
| ... | ... | @@ -646,11 +710,14 @@ namespace Hantek { |
| 646 | 710 | // Set fast rate when used |
| 647 | 711 | commandSetTriggerAndSamplerate->setFastRate(fastRate); |
| 648 | 712 | |
| 649 | - this->commandPending[COMMAND_SETTRIGGERANDSAMPLERATE] = true; | |
| 713 | + this->commandPending[BULK_SETTRIGGERANDSAMPLERATE] = true; | |
| 650 | 714 | |
| 651 | 715 | break; |
| 652 | - | |
| 653 | - default: | |
| 716 | + } | |
| 717 | + case BULK_SETSAMPLERATE5200: { | |
| 718 | + // Pointers to needed commands | |
| 719 | + BulkSetSamplerate5200 *commandSetSamplerate5200 = (BulkSetSamplerate5200 *) this->command[BULK_SETSAMPLERATE5200]; | |
| 720 | + BulkSetTrigger5200 *commandSetTrigger5200 = (BulkSetTrigger5200 *) this->command[BULK_SETTRIGGER5200]; | |
| 654 | 721 | // Store samplerate fast value |
| 655 | 722 | commandSetSamplerate5200->setSamplerateFast(4 - valueFast); |
| 656 | 723 | // Store samplerate slow value (two's complement) |
| ... | ... | @@ -658,15 +725,18 @@ namespace Hantek { |
| 658 | 725 | // Set fast rate when used |
| 659 | 726 | commandSetTrigger5200->setFastRate(fastRate); |
| 660 | 727 | |
| 661 | - this->commandPending[COMMAND_SETSAMPLERATE5200] = true; | |
| 662 | - this->commandPending[COMMAND_SETTRIGGER5200] = true; | |
| 728 | + this->commandPending[BULK_SETSAMPLERATE5200] = true; | |
| 729 | + this->commandPending[BULK_SETTRIGGER5200] = true; | |
| 663 | 730 | |
| 664 | 731 | break; |
| 732 | + } | |
| 733 | + default: | |
| 734 | + return 0; | |
| 665 | 735 | } |
| 666 | 736 | |
| 667 | - this->updateBufferSize(this->bufferSize); | |
| 668 | - this->setTriggerPosition(this->triggerPosition); | |
| 669 | - return this->samplerateMax / this->samplerateDivider; | |
| 737 | + this->updateBufferSize(this->specification.bufferSizes[this->settings.bufferSizeId]); | |
| 738 | + this->setTriggerPosition(this->settings.trigger.position); | |
| 739 | + return this->settings.samplerate.current; | |
| 670 | 740 | } |
| 671 | 741 | |
| 672 | 742 | /// \brief Enables/disables filtering of the given channel. |
| ... | ... | @@ -681,9 +751,9 @@ namespace Hantek { |
| 681 | 751 | return -1; |
| 682 | 752 | |
| 683 | 753 | // SetFilter bulk command for channel filter (used has to be inverted!) |
| 684 | - CommandSetFilter *commandSetFilter = (CommandSetFilter *) this->command[COMMAND_SETFILTER]; | |
| 754 | + BulkSetFilter *commandSetFilter = (BulkSetFilter *) this->command[BULK_SETFILTER]; | |
| 685 | 755 | commandSetFilter->setChannel(channel, !used); |
| 686 | - this->commandPending[COMMAND_SETFILTER] = true; | |
| 756 | + this->commandPending[BULK_SETFILTER] = true; | |
| 687 | 757 | |
| 688 | 758 | unsigned char usedChannels = USED_CH1; |
| 689 | 759 | if(!commandSetFilter->getChannel(1)) { |
| ... | ... | @@ -693,17 +763,17 @@ namespace Hantek { |
| 693 | 763 | usedChannels = USED_CH1CH2; |
| 694 | 764 | } |
| 695 | 765 | |
| 696 | - switch(this->commandVersion) { | |
| 697 | - case 0: { | |
| 698 | - // SetTriggerAndSamplerate bulk command for trigger source | |
| 699 | - ((CommandSetTriggerAndSamplerate *) this->command[COMMAND_SETTRIGGERANDSAMPLERATE])->setUsedChannels(usedChannels); | |
| 700 | - this->commandPending[COMMAND_SETTRIGGERANDSAMPLERATE] = true; | |
| 766 | + switch(this->specification.command.bulk.setTrigger) { | |
| 767 | + case BULK_SETTRIGGER5200: { | |
| 768 | + // SetTrigger5200s bulk command for trigger source | |
| 769 | + ((BulkSetTrigger5200 *) this->command[BULK_SETTRIGGER5200])->setUsedChannels(usedChannels); | |
| 770 | + this->commandPending[BULK_SETTRIGGER5200] = true; | |
| 701 | 771 | break; |
| 702 | 772 | } |
| 703 | - case 1: { | |
| 704 | - // SetTrigger5200s bulk command for trigger source | |
| 705 | - ((CommandSetTrigger5200 *) this->command[COMMAND_SETTRIGGER5200])->setUsedChannels(usedChannels); | |
| 706 | - this->commandPending[COMMAND_SETTRIGGER5200] = true; | |
| 773 | + default: { | |
| 774 | + // SetTriggerAndSamplerate bulk command for trigger source | |
| 775 | + ((BulkSetTriggerAndSamplerate *) this->command[BULK_SETTRIGGERANDSAMPLERATE])->setUsedChannels(usedChannels); | |
| 776 | + this->commandPending[BULK_SETTRIGGERANDSAMPLERATE] = true; | |
| 707 | 777 | break; |
| 708 | 778 | } |
| 709 | 779 | } |
| ... | ... | @@ -743,64 +813,67 @@ namespace Hantek { |
| 743 | 813 | // Find lowest gain voltage thats at least as high as the requested |
| 744 | 814 | int gainId; |
| 745 | 815 | for(gainId = 0; gainId < GAIN_COUNT - 1; gainId++) |
| 746 | - if(this->gainSteps[gainId] >= gain) | |
| 816 | + if(this->specification.gainSteps[gainId] >= gain) | |
| 747 | 817 | break; |
| 748 | 818 | |
| 749 | 819 | // Get the voltage scaler id and it's sample range for this gain |
| 750 | 820 | int scalerId; |
| 751 | - switch(this->commandVersion) { | |
| 752 | - case 0: | |
| 753 | - scalerId = gainId % 3; | |
| 754 | - this->sampleRange[channel] = 0xff; | |
| 755 | - break; | |
| 756 | - default: | |
| 757 | - /// \todo Use calibration data to get the DSO-5200 sample ranges | |
| 821 | + switch(this->device->getModel()) { | |
| 822 | + case MODEL_DSO5200: | |
| 823 | + case MODEL_DSO5200A: | |
| 824 | + /// \todo Use calibration data to get the DSO-5200(A) sample ranges | |
| 758 | 825 | if(gainId == GAIN_10MV) { |
| 759 | 826 | scalerId = 1; |
| 760 | - this->sampleRange[channel] = 184; | |
| 827 | + this->specification.voltageLimit[channel][gainId] = 184; | |
| 761 | 828 | } |
| 762 | 829 | else { |
| 763 | 830 | switch(gainId % 3) { |
| 764 | 831 | case 1: |
| 765 | 832 | scalerId = 1; |
| 766 | - this->sampleRange[channel] = 368; | |
| 833 | + this->specification.voltageLimit[channel][gainId] = 368; | |
| 767 | 834 | break; |
| 768 | 835 | case 2: |
| 769 | 836 | scalerId = 0; |
| 770 | - this->sampleRange[channel] = 454; | |
| 837 | + this->specification.voltageLimit[channel][gainId] = 454; | |
| 771 | 838 | break; |
| 772 | 839 | default: |
| 773 | 840 | scalerId = 0; |
| 774 | - this->sampleRange[channel] = 908; | |
| 841 | + this->specification.voltageLimit[channel][gainId] = 908; | |
| 775 | 842 | break; |
| 776 | 843 | } |
| 777 | 844 | } |
| 778 | 845 | break; |
| 846 | + | |
| 847 | + default: | |
| 848 | + scalerId = gainId % 3; | |
| 849 | + this->specification.voltageLimit[channel][gainId] = 0xff; | |
| 850 | + break; | |
| 779 | 851 | } |
| 780 | 852 | |
| 781 | 853 | // SetGain bulk command for gain |
| 782 | - ((CommandSetGain *) this->command[COMMAND_SETGAIN])->setGain(channel, scalerId); | |
| 783 | - this->commandPending[COMMAND_SETGAIN] = true; | |
| 854 | + ((BulkSetGain *) this->command[BULK_SETGAIN])->setGain(channel, scalerId); | |
| 855 | + this->commandPending[BULK_SETGAIN] = true; | |
| 784 | 856 | |
| 785 | 857 | // SetRelays control command for gain relays |
| 786 | 858 | ControlSetRelays *controlSetRelays = (ControlSetRelays *) this->control[CONTROLINDEX_SETRELAYS]; |
| 787 | - switch(this->commandVersion) { | |
| 788 | - case 0: | |
| 789 | - controlSetRelays->setBelow1V(channel, gainId < GAIN_1V); | |
| 790 | - controlSetRelays->setBelow100mV(channel, gainId < GAIN_100MV); | |
| 791 | - break; | |
| 792 | - case 1: | |
| 859 | + switch(this->device->getModel()) { | |
| 860 | + case MODEL_DSO5200: | |
| 861 | + case MODEL_DSO5200A: | |
| 793 | 862 | controlSetRelays->setBelow1V(channel, gainId <= GAIN_1V); |
| 794 | 863 | controlSetRelays->setBelow100mV(channel, gainId <= GAIN_100MV); |
| 795 | 864 | break; |
| 865 | + default: | |
| 866 | + controlSetRelays->setBelow1V(channel, gainId < GAIN_1V); | |
| 867 | + controlSetRelays->setBelow100mV(channel, gainId < GAIN_100MV); | |
| 868 | + break; | |
| 796 | 869 | } |
| 797 | 870 | this->controlPending[CONTROLINDEX_SETRELAYS] = true; |
| 798 | 871 | |
| 799 | - this->gain[channel] = (Gain) gainId; | |
| 872 | + this->settings.voltage[channel].gain = (Gain) gainId; | |
| 800 | 873 | |
| 801 | - this->setOffset(channel, this->offset[channel]); | |
| 874 | + this->setOffset(channel, this->settings.voltage[channel].offset); | |
| 802 | 875 | |
| 803 | - return this->gainSteps[gainId]; | |
| 876 | + return this->specification.gainSteps[gainId]; | |
| 804 | 877 | } |
| 805 | 878 | |
| 806 | 879 | /// \brief Set the offset for the given channel. |
| ... | ... | @@ -816,8 +889,8 @@ namespace Hantek { |
| 816 | 889 | |
| 817 | 890 | // Calculate the offset value |
| 818 | 891 | // The range is given by the calibration data (convert from big endian) |
| 819 | - unsigned short int minimum = ((unsigned short int) *((unsigned char *) &(this->channelLevels[channel][this->gain[channel]][OFFSET_START])) << 8) + *((unsigned char *) &(this->channelLevels[channel][this->gain[channel]][OFFSET_START]) + 1); | |
| 820 | - unsigned short int maximum = ((unsigned short int) *((unsigned char *) &(this->channelLevels[channel][this->gain[channel]][OFFSET_START])) << 8) + *((unsigned char *) &(this->channelLevels[channel][this->gain[channel]][OFFSET_END]) + 1); | |
| 892 | + unsigned short int minimum = ((unsigned short int) *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_START])) << 8) + *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_START]) + 1); | |
| 893 | + unsigned short int maximum = ((unsigned short int) *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_START])) << 8) + *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_END]) + 1); | |
| 821 | 894 | unsigned short int offsetValue = offset * (maximum - minimum) + minimum + 0.5; |
| 822 | 895 | double offsetReal = (double) (offsetValue - minimum) / (maximum - minimum); |
| 823 | 896 | |
| ... | ... | @@ -825,10 +898,10 @@ namespace Hantek { |
| 825 | 898 | ((ControlSetOffset *) this->control[CONTROLINDEX_SETOFFSET])->setChannel(channel, offsetValue); |
| 826 | 899 | this->controlPending[CONTROLINDEX_SETOFFSET] = true; |
| 827 | 900 | |
| 828 | - this->offset[channel] = offset; | |
| 829 | - this->offsetReal[channel] = offsetReal; | |
| 901 | + this->settings.voltage[channel].offset = offset; | |
| 902 | + this->settings.voltage[channel].offsetReal = offsetReal; | |
| 830 | 903 | |
| 831 | - this->setTriggerLevel(channel, this->triggerLevel[channel]); | |
| 904 | + this->setTriggerLevel(channel, this->settings.trigger.level[channel]); | |
| 832 | 905 | |
| 833 | 906 | return offsetReal; |
| 834 | 907 | } |
| ... | ... | @@ -842,7 +915,7 @@ namespace Hantek { |
| 842 | 915 | if(mode < Dso::TRIGGERMODE_AUTO || mode > Dso::TRIGGERMODE_SINGLE) |
| 843 | 916 | return -1; |
| 844 | 917 | |
| 845 | - this->triggerMode = mode; | |
| 918 | + this->settings.trigger.mode = mode; | |
| 846 | 919 | return 0; |
| 847 | 920 | } |
| 848 | 921 | |
| ... | ... | @@ -864,17 +937,17 @@ namespace Hantek { |
| 864 | 937 | else |
| 865 | 938 | sourceValue = TRIGGER_CH1 - id; |
| 866 | 939 | |
| 867 | - switch(this->commandVersion) { | |
| 868 | - case 0: | |
| 869 | - // SetTriggerAndSamplerate bulk command for trigger source | |
| 870 | - ((CommandSetTriggerAndSamplerate *) this->command[COMMAND_SETTRIGGERANDSAMPLERATE])->setTriggerSource(sourceValue); | |
| 871 | - this->commandPending[COMMAND_SETTRIGGERANDSAMPLERATE] = true; | |
| 940 | + switch(this->specification.command.bulk.setTrigger) { | |
| 941 | + case BULK_SETTRIGGER5200: | |
| 942 | + // SetTrigger5200 bulk command for trigger source | |
| 943 | + ((BulkSetTrigger5200 *) this->command[BULK_SETTRIGGER5200])->setTriggerSource(sourceValue); | |
| 944 | + this->commandPending[BULK_SETTRIGGER5200] = true; | |
| 872 | 945 | break; |
| 873 | 946 | |
| 874 | - case 1: | |
| 875 | - // SetTrigger5200 bulk command for trigger source | |
| 876 | - ((CommandSetTrigger5200 *) this->command[COMMAND_SETTRIGGER5200])->setTriggerSource(sourceValue); | |
| 877 | - this->commandPending[COMMAND_SETTRIGGER5200] = true; | |
| 947 | + default: | |
| 948 | + // SetTriggerAndSamplerate bulk command for trigger source | |
| 949 | + ((BulkSetTriggerAndSamplerate *) this->command[BULK_SETTRIGGERANDSAMPLERATE])->setTriggerSource(sourceValue); | |
| 950 | + this->commandPending[BULK_SETTRIGGERANDSAMPLERATE] = true; | |
| 878 | 951 | break; |
| 879 | 952 | } |
| 880 | 953 | |
| ... | ... | @@ -882,8 +955,8 @@ namespace Hantek { |
| 882 | 955 | ((ControlSetRelays *) this->control[CONTROLINDEX_SETRELAYS])->setTrigger(special); |
| 883 | 956 | this->controlPending[CONTROLINDEX_SETRELAYS] = true; |
| 884 | 957 | |
| 885 | - this->triggerSpecial = special; | |
| 886 | - this->triggerSource = id; | |
| 958 | + this->settings.trigger.special = special; | |
| 959 | + this->settings.trigger.source = id; | |
| 887 | 960 | |
| 888 | 961 | // Apply trigger level of the new source |
| 889 | 962 | if(special) { |
| ... | ... | @@ -892,7 +965,7 @@ namespace Hantek { |
| 892 | 965 | this->controlPending[CONTROLINDEX_SETOFFSET] = true; |
| 893 | 966 | } |
| 894 | 967 | else |
| 895 | - this->setTriggerLevel(id, this->triggerLevel[id]); | |
| 968 | + this->setTriggerLevel(id, this->settings.trigger.level[id]); | |
| 896 | 969 | |
| 897 | 970 | return 0; |
| 898 | 971 | } |
| ... | ... | @@ -910,25 +983,26 @@ namespace Hantek { |
| 910 | 983 | |
| 911 | 984 | // Calculate the trigger level value |
| 912 | 985 | unsigned short int minimum, maximum; |
| 913 | - switch(this->commandVersion) { | |
| 914 | - case 0: | |
| 915 | - // It's from 0x00 to 0xfd for the 8 bit models | |
| 916 | - minimum = 0x00; | |
| 917 | - maximum = 0xfd; | |
| 986 | + switch(this->device->getModel()) { | |
| 987 | + case MODEL_DSO5200: | |
| 988 | + case MODEL_DSO5200A: | |
| 989 | + // The range is the same as used for the offsets for 10 bit models | |
| 990 | + minimum = ((unsigned short int) *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_START])) << 8) + *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_START]) + 1); | |
| 991 | + maximum = ((unsigned short int) *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_START])) << 8) + *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_END]) + 1); | |
| 918 | 992 | break; |
| 919 | 993 | |
| 920 | 994 | default: |
| 921 | - // The range is the same as used for the offsets for 10 bit models | |
| 922 | - minimum = ((unsigned short int) *((unsigned char *) &(this->channelLevels[channel][this->gain[channel]][OFFSET_START])) << 8) + *((unsigned char *) &(this->channelLevels[channel][this->gain[channel]][OFFSET_START]) + 1); | |
| 923 | - maximum = ((unsigned short int) *((unsigned char *) &(this->channelLevels[channel][this->gain[channel]][OFFSET_START])) << 8) + *((unsigned char *) &(this->channelLevels[channel][this->gain[channel]][OFFSET_END]) + 1); | |
| 995 | + // It's from 0x00 to 0xfd for the 8 bit models | |
| 996 | + minimum = 0x00; | |
| 997 | + maximum = 0xfd; | |
| 924 | 998 | break; |
| 925 | 999 | } |
| 926 | 1000 | |
| 927 | 1001 | // Never get out of the limits |
| 928 | - unsigned short int levelValue = qBound((long int) minimum, (long int) ((this->offsetReal[channel] + level / this->gainSteps[this->gain[channel]]) * (maximum - minimum) + 0.5) + minimum, (long int) maximum); | |
| 1002 | + unsigned short int levelValue = qBound((long int) minimum, (long int) ((this->settings.voltage[channel].offsetReal + level / this->specification.gainSteps[this->settings.voltage[channel].gain]) * (maximum - minimum) + 0.5) + minimum, (long int) maximum); | |
| 929 | 1003 | |
| 930 | 1004 | // Check if the set channel is the trigger source |
| 931 | - if(!this->triggerSpecial && channel == this->triggerSource) { | |
| 1005 | + if(!this->settings.trigger.special && channel == this->settings.trigger.source) { | |
| 932 | 1006 | // SetOffset control command for trigger level |
| 933 | 1007 | ((ControlSetOffset *) this->control[CONTROLINDEX_SETOFFSET])->setTrigger(levelValue); |
| 934 | 1008 | this->controlPending[CONTROLINDEX_SETOFFSET] = true; |
| ... | ... | @@ -936,8 +1010,8 @@ namespace Hantek { |
| 936 | 1010 | |
| 937 | 1011 | /// \todo Get alternating trigger in here |
| 938 | 1012 | |
| 939 | - this->triggerLevel[channel] = level; | |
| 940 | - return (double) ((levelValue - minimum) / (maximum - minimum) - this->offsetReal[channel]) * this->gainSteps[this->gain[channel]]; | |
| 1013 | + this->settings.trigger.level[channel] = level; | |
| 1014 | + return (double) ((levelValue - minimum) / (maximum - minimum) - this->settings.voltage[channel].offsetReal) * this->specification.gainSteps[this->settings.voltage[channel].gain]; | |
| 941 | 1015 | } |
| 942 | 1016 | |
| 943 | 1017 | /// \brief Set the trigger slope. |
| ... | ... | @@ -950,24 +1024,24 @@ namespace Hantek { |
| 950 | 1024 | if(slope != Dso::SLOPE_NEGATIVE && slope != Dso::SLOPE_POSITIVE) |
| 951 | 1025 | return -1; |
| 952 | 1026 | |
| 953 | - switch(this->commandVersion) { | |
| 954 | - case 0: { | |
| 1027 | + switch(this->specification.command.bulk.setTrigger) { | |
| 1028 | + case BULK_SETTRIGGER5200: { | |
| 1029 | + // SetTrigger5200 bulk command for trigger slope | |
| 1030 | + ((BulkSetTrigger5200 *) this->command[BULK_SETTRIGGER5200])->setTriggerSlope(slope); | |
| 1031 | + this->commandPending[BULK_SETTRIGGER5200] = true; | |
| 1032 | + break; | |
| 1033 | + } | |
| 1034 | + default: { | |
| 955 | 1035 | // SetTriggerAndSamplerate bulk command for trigger slope |
| 956 | - CommandSetTriggerAndSamplerate *commandSetTriggerAndSamplerate = (CommandSetTriggerAndSamplerate *) this->command[COMMAND_SETTRIGGERANDSAMPLERATE]; | |
| 1036 | + BulkSetTriggerAndSamplerate *commandSetTriggerAndSamplerate = (BulkSetTriggerAndSamplerate *) this->command[BULK_SETTRIGGERANDSAMPLERATE]; | |
| 957 | 1037 | |
| 958 | 1038 | commandSetTriggerAndSamplerate->setTriggerSlope(slope); |
| 959 | - this->commandPending[COMMAND_SETTRIGGERANDSAMPLERATE] = true; | |
| 960 | - break; | |
| 961 | - } | |
| 962 | - case 1: { | |
| 963 | - // SetTrigger5200 bulk command for trigger slope | |
| 964 | - ((CommandSetTrigger5200 *) this->command[COMMAND_SETTRIGGER5200])->setTriggerSlope(slope); | |
| 965 | - this->commandPending[COMMAND_SETTRIGGER5200] = true; | |
| 1039 | + this->commandPending[BULK_SETTRIGGERANDSAMPLERATE] = true; | |
| 966 | 1040 | break; |
| 967 | 1041 | } |
| 968 | 1042 | } |
| 969 | 1043 | |
| 970 | - this->triggerSlope = slope; | |
| 1044 | + this->settings.trigger.slope = slope; | |
| 971 | 1045 | return 0; |
| 972 | 1046 | } |
| 973 | 1047 | |
| ... | ... | @@ -979,44 +1053,44 @@ namespace Hantek { |
| 979 | 1053 | return -2; |
| 980 | 1054 | |
| 981 | 1055 | // All trigger positions are measured in samples |
| 982 | - unsigned long int positionSamples = position * this->samplerateMax / this->samplerateDivider; | |
| 1056 | + unsigned long int positionSamples = position * this->settings.samplerate.current; | |
| 983 | 1057 | |
| 984 | - switch(this->commandVersion) { | |
| 985 | - case 0: { | |
| 1058 | + switch(this->specification.command.bulk.setTrigger) { | |
| 1059 | + case BULK_SETTRIGGER5200: { | |
| 986 | 1060 | // Fast rate mode uses both channels |
| 987 | - if(((CommandSetTriggerAndSamplerate *) this->command[COMMAND_SETTRIGGERANDSAMPLERATE])->getFastRate()) | |
| 1061 | + if(((BulkSetTrigger5200 *) this->command[BULK_SETTRIGGER5200])->getFastRate()) | |
| 988 | 1062 | positionSamples /= HANTEK_CHANNELS; |
| 989 | 1063 | |
| 990 | - // Calculate the position value (Start point depending on buffer size) | |
| 991 | - unsigned long int position = 0x7ffff - this->bufferSize + positionSamples; | |
| 992 | - | |
| 993 | - // SetTriggerAndSamplerate bulk command for trigger position | |
| 994 | - ((CommandSetTriggerAndSamplerate *) this->command[COMMAND_SETTRIGGERANDSAMPLERATE])->setTriggerPosition(position); | |
| 995 | - this->commandPending[COMMAND_SETTRIGGERANDSAMPLERATE] = true; | |
| 996 | - | |
| 997 | - break; | |
| 998 | - } | |
| 999 | - case 1: { | |
| 1000 | - // Fast rate mode uses both channels | |
| 1001 | - if(((CommandSetTrigger5200 *) this->command[COMMAND_SETTRIGGER5200])->getFastRate()) | |
| 1002 | - positionSamples /= HANTEK_CHANNELS; | |
| 1003 | - | |
| 1004 | - // Calculate the position values (Inverse, maximum is 0xffff) | |
| 1005 | - unsigned short int positionPre = 0xffff - this->bufferSize + positionSamples; | |
| 1064 | + // Calculate the position values (Inverse, maximum is 0xffff) | |
| 1065 | + unsigned short int positionPre = 0xffff - this->specification.bufferSizes[this->settings.bufferSizeId] + positionSamples; | |
| 1006 | 1066 | unsigned short int positionPost = 0xffff - positionSamples; |
| 1007 | 1067 | |
| 1008 | 1068 | // SetBuffer5200 bulk command for trigger position |
| 1009 | - CommandSetBuffer5200 *commandSetBuffer5200 = (CommandSetBuffer5200 *) this->command[COMMAND_SETBUFFER5200]; | |
| 1069 | + BulkSetBuffer5200 *commandSetBuffer5200 = (BulkSetBuffer5200 *) this->command[BULK_SETBUFFER5200]; | |
| 1010 | 1070 | commandSetBuffer5200->setTriggerPositionPre(positionPre); |
| 1011 | 1071 | commandSetBuffer5200->setTriggerPositionPost(positionPost); |
| 1012 | - this->commandPending[COMMAND_SETBUFFER5200] = true; | |
| 1072 | + this->commandPending[BULK_SETBUFFER5200] = true; | |
| 1073 | + | |
| 1074 | + break; | |
| 1075 | + } | |
| 1076 | + default: { | |
| 1077 | + // Fast rate mode uses both channels | |
| 1078 | + if(((BulkSetTriggerAndSamplerate *) this->command[BULK_SETTRIGGERANDSAMPLERATE])->getFastRate()) | |
| 1079 | + positionSamples /= HANTEK_CHANNELS; | |
| 1080 | + | |
| 1081 | + // Calculate the position value (Start point depending on buffer size) | |
| 1082 | + unsigned long int position = 0x7ffff - this->specification.bufferSizes[this->settings.bufferSizeId] + positionSamples; | |
| 1083 | + | |
| 1084 | + // SetTriggerAndSamplerate bulk command for trigger position | |
| 1085 | + ((BulkSetTriggerAndSamplerate *) this->command[BULK_SETTRIGGERANDSAMPLERATE])->setTriggerPosition(position); | |
| 1086 | + this->commandPending[BULK_SETTRIGGERANDSAMPLERATE] = true; | |
| 1013 | 1087 | |
| 1014 | 1088 | break; |
| 1015 | 1089 | } |
| 1016 | 1090 | } |
| 1017 | 1091 | |
| 1018 | - this->triggerPosition = position; | |
| 1019 | - return (double) positionSamples / this->samplerateMax * this->samplerateDivider; | |
| 1092 | + this->settings.trigger.position = position; | |
| 1093 | + return (double) positionSamples / this->settings.samplerate.current; | |
| 1020 | 1094 | } |
| 1021 | 1095 | |
| 1022 | 1096 | #ifdef DEBUG |
| ... | ... | @@ -1038,7 +1112,7 @@ namespace Hantek { |
| 1038 | 1112 | |
| 1039 | 1113 | // Read command code (First byte) |
| 1040 | 1114 | Helper::hexParse(data, &commandCode, 1); |
| 1041 | - if(commandCode > COMMAND_COUNT) | |
| 1115 | + if(commandCode > BULK_COUNT) | |
| 1042 | 1116 | return -2; |
| 1043 | 1117 | |
| 1044 | 1118 | // Update bulk command and mark as pending | ... | ... |
openhantek/src/hantek/control.h
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | // |
| 7 | 7 | // Copyright (C) 2008, 2009 Oleg Khudyakov |
| 8 | 8 | // prcoder@potrebitel.ru |
| 9 | -// Copyright (C) 2010 Oliver Haag | |
| 9 | +// Copyright (C) 2010, 2011 Oliver Haag | |
| 10 | 10 | // oliver.haag@gmail.com |
| 11 | 11 | // |
| 12 | 12 | // This program is free software: you can redistribute it and/or modify it |
| ... | ... | @@ -53,6 +53,122 @@ namespace Hantek { |
| 53 | 53 | }; |
| 54 | 54 | |
| 55 | 55 | ////////////////////////////////////////////////////////////////////////////// |
| 56 | + /// \struct ControlSpecificationCommandsBulk hantek/control.h | |
| 57 | + /// \brief Stores the bulk command codes used for this device. | |
| 58 | + struct ControlSpecificationCommandsBulk { | |
| 59 | + BulkCode setFilter; ///< Command for setting used channels | |
| 60 | + BulkCode setSamplerate; ///< Command for samplerate settings | |
| 61 | + BulkCode setGain; ///< Command for gain settings (Usually in combination with CONTROL_SETRELAYS) | |
| 62 | + BulkCode setBuffer; ///< Command for buffer settings | |
| 63 | + BulkCode setTrigger; ///< Command for trigger settings | |
| 64 | + }; | |
| 65 | + | |
| 66 | + ////////////////////////////////////////////////////////////////////////////// | |
| 67 | + /// \struct ControlSpecificationCommandsControl hantek/control.h | |
| 68 | + /// \brief Stores the control command codes used for this device. | |
| 69 | + struct ControlSpecificationCommandsControl { | |
| 70 | + ControlCode setOffset; ///< Command for setting offset calibration data | |
| 71 | + ControlCode setRelays; ///< Command for setting gain relays (Usually in combination with BULK_SETGAIN) | |
| 72 | + }; | |
| 73 | + | |
| 74 | + ////////////////////////////////////////////////////////////////////////////// | |
| 75 | + /// \struct ControlSpecificationCommandsControlValues hantek/control.h | |
| 76 | + /// \brief Stores the control value codes used for this device. | |
| 77 | + struct ControlSpecificationCommandsValues { | |
| 78 | + ControlValue offsetLimits; ///< Code for channel offset limits | |
| 79 | + ControlValue voltageLimits; ///< Code for voltage limits | |
| 80 | + }; | |
| 81 | + | |
| 82 | + ////////////////////////////////////////////////////////////////////////////// | |
| 83 | + /// \struct ControlSpecificationCommands hantek/control.h | |
| 84 | + /// \brief Stores the command codes used for this device. | |
| 85 | + struct ControlSpecificationCommands { | |
| 86 | + ControlSpecificationCommandsBulk bulk; ///< The used bulk commands | |
| 87 | + ControlSpecificationCommandsControl control; ///< The used control commands | |
| 88 | + ControlSpecificationCommandsValues values; ///< The used control values | |
| 89 | + }; | |
| 90 | + | |
| 91 | + ////////////////////////////////////////////////////////////////////////////// | |
| 92 | + /// \struct ControlSamplerateLimits hantek/control.h | |
| 93 | + /// \brief Stores the samplerate limits for calculations. | |
| 94 | + struct ControlSamplerateLimits { | |
| 95 | + unsigned long int base; ///< The base for sample rate calculations | |
| 96 | + unsigned long int max; ///< The maximum sample rate | |
| 97 | + }; | |
| 98 | + | |
| 99 | + ////////////////////////////////////////////////////////////////////////////// | |
| 100 | + /// \struct ControlSpecificationSamplerate hantek/control.h | |
| 101 | + /// \brief Stores the samplerate limits. | |
| 102 | + struct ControlSpecificationSamplerate { | |
| 103 | + ControlSamplerateLimits single; ///< The limits for single channel mode | |
| 104 | + ControlSamplerateLimits multi; ///< The limits for multi channel mode | |
| 105 | + }; | |
| 106 | + | |
| 107 | + ////////////////////////////////////////////////////////////////////////////// | |
| 108 | + /// \struct ControlSpecification hantek/control.h | |
| 109 | + /// \brief Stores the specifications of the currently connected device. | |
| 110 | + struct ControlSpecification { | |
| 111 | + // Interface | |
| 112 | + ControlSpecificationCommands command; ///< The commands for this device | |
| 113 | + | |
| 114 | + // Limits | |
| 115 | + ControlSpecificationSamplerate samplerate; ///< The samplerate specifications | |
| 116 | + QList<unsigned long int> bufferSizes; ///< Available buffer sizes, ULONG_MAX means rolling | |
| 117 | + QList<unsigned long int> bufferDividers; ///< Samplerate dividers for buffer sizes | |
| 118 | + QList<double> gainSteps; ///< Available voltage steps in V/screenheight | |
| 119 | + | |
| 120 | + // Calibration | |
| 121 | + /// The sample values at the top of the screen | |
| 122 | + unsigned short int voltageLimit[HANTEK_CHANNELS][GAIN_COUNT]; | |
| 123 | + /// Calibration data for the channel offsets | |
| 124 | + unsigned short int offsetLimit[HANTEK_CHANNELS][GAIN_COUNT][OFFSET_COUNT]; | |
| 125 | + }; | |
| 126 | + | |
| 127 | + ////////////////////////////////////////////////////////////////////////////// | |
| 128 | + /// \struct ControlSettingsSamplerate hantek/control.h | |
| 129 | + /// \brief Stores the current samplerate settings of the device. | |
| 130 | + struct ControlSettingsSamplerate { | |
| 131 | + ControlSamplerateLimits *limits; ///< The samplerate limits | |
| 132 | + //unsigned long int divider; ///< The fixed samplerate divider | |
| 133 | + unsigned long int downsampling; ///< The variable downsampling factor | |
| 134 | + double current; ///< The current samplerate | |
| 135 | + }; | |
| 136 | + | |
| 137 | + ////////////////////////////////////////////////////////////////////////////// | |
| 138 | + /// \struct ControlSettingsSamplerate hantek/control.h | |
| 139 | + /// \brief Stores the current trigger settings of the device. | |
| 140 | + struct ControlSettingsTrigger { | |
| 141 | + double level[HANTEK_CHANNELS]; ///< The trigger level for each channel in V | |
| 142 | + double position; ///< The current pretrigger position | |
| 143 | + unsigned int point; ///< The trigger point value | |
| 144 | + Dso::TriggerMode mode; ///< The trigger mode | |
| 145 | + Dso::Slope slope; ///< The trigger slope | |
| 146 | + bool special; ///< true, if the trigger source is special | |
| 147 | + unsigned int source; ///< The trigger source | |
| 148 | + }; | |
| 149 | + | |
| 150 | + ////////////////////////////////////////////////////////////////////////////// | |
| 151 | + /// \struct ControlSettingsSamplerate hantek/control.h | |
| 152 | + /// \brief Stores the current amplification settings of the device. | |
| 153 | + struct ControlSettingsVoltage { | |
| 154 | + Gain gain; ///< The gain id | |
| 155 | + double offset; ///< The screen offset for each channel | |
| 156 | + double offsetReal; ///< The real offset for each channel (Due to quantization) | |
| 157 | + bool used; ///< true, if the channel is used | |
| 158 | + }; | |
| 159 | + | |
| 160 | + ////////////////////////////////////////////////////////////////////////////// | |
| 161 | + /// \struct ControlSettings hantek/control.h | |
| 162 | + /// \brief Stores the current settings of the device. | |
| 163 | + struct ControlSettings { | |
| 164 | + ControlSettingsSamplerate samplerate; ///< The samplerate settings | |
| 165 | + ControlSettingsVoltage voltage[HANTEK_CHANNELS]; ///< The amplification settings | |
| 166 | + ControlSettingsTrigger trigger; ///< The trigger settings | |
| 167 | + unsigned int bufferSizeId; ///< The id in the buffer size array | |
| 168 | + unsigned short int usedChannels; ///< Number of activated channels | |
| 169 | + }; | |
| 170 | + | |
| 171 | + ////////////////////////////////////////////////////////////////////////////// | |
| 56 | 172 | /// \class Control hantek/control.h |
| 57 | 173 | /// \brief The DsoControl abstraction layer for %Hantek USB DSOs. |
| 58 | 174 | class Control : public DsoControl { |
| ... | ... | @@ -72,48 +188,28 @@ namespace Hantek { |
| 72 | 188 | int getSamples(bool process); |
| 73 | 189 | unsigned long int updateBufferSize(unsigned long int size); |
| 74 | 190 | |
| 191 | + // Communication with device | |
| 75 | 192 | Device *device; ///< The USB device for the oscilloscope |
| 76 | 193 | |
| 77 | - Helper::DataArray<unsigned char> *command[COMMAND_COUNT]; ///< Pointers to commands, ready to be transmitted | |
| 78 | - bool commandPending[COMMAND_COUNT]; ///< true, when the command should be executed | |
| 194 | + Helper::DataArray<unsigned char> *command[BULK_COUNT]; ///< Pointers to bulk commands, ready to be transmitted | |
| 195 | + bool commandPending[BULK_COUNT]; ///< true, when the command should be executed | |
| 79 | 196 | Helper::DataArray<unsigned char> *control[CONTROLINDEX_COUNT]; ///< Pointers to control commands |
| 80 | 197 | unsigned char controlCode[CONTROLINDEX_COUNT]; ///< Request codes for control commands |
| 81 | 198 | bool controlPending[CONTROLINDEX_COUNT]; ///< true, when the control command should be executed |
| 82 | 199 | |
| 83 | - short int commandVersion; ///< The used version of the commands | |
| 84 | - | |
| 85 | - /// Calibration data for the channel offsets | |
| 86 | - unsigned short int channelLevels[HANTEK_CHANNELS][GAIN_COUNT][OFFSET_COUNT]; | |
| 87 | - | |
| 88 | - // Various cached settings | |
| 89 | - unsigned long int samplerateDivider; ///< The samplerate divider | |
| 90 | - unsigned long int samplerateMax; ///< The maximum sample rate for the current setup | |
| 91 | - unsigned long int samplerateChannelMax; ///< The maximum sample rate for a single channel | |
| 92 | - unsigned long int samplerateFastMax; ///< The maximum sample rate for fast rate mode | |
| 93 | - Gain gain[HANTEK_CHANNELS]; ///< The gain id | |
| 94 | - unsigned short int sampleRange[HANTEK_CHANNELS]; ///< The sample values at the top of the screen | |
| 95 | - double offset[HANTEK_CHANNELS]; ///< The current screen offset for each channel | |
| 96 | - double offsetReal[HANTEK_CHANNELS]; ///< The real offset for each channel (Due to quantization) | |
| 97 | - double triggerLevel[HANTEK_CHANNELS]; ///< The trigger level for each channel in V | |
| 98 | - double triggerPosition; ///< The current pretrigger position | |
| 99 | - unsigned int bufferSize; ///< The buffer size in samples | |
| 100 | - unsigned int triggerPoint; ///< The trigger point value | |
| 101 | - Dso::TriggerMode triggerMode; ///< The trigger mode | |
| 102 | - Dso::Slope triggerSlope; ///< The trigger slope | |
| 103 | - bool triggerSpecial; ///< true, if the trigger source is special | |
| 104 | - unsigned int triggerSource; ///< The trigger source | |
| 200 | + // Device setup | |
| 201 | + ControlSpecification specification; ///< The specifications of the device | |
| 202 | + ControlSettings settings; ///< The current settings of the device | |
| 105 | 203 | |
| 204 | + // Results | |
| 106 | 205 | QList<double *> samples; ///< Sample data arrays |
| 107 | 206 | QList<unsigned int> samplesSize; ///< Number of samples data array |
| 108 | 207 | QMutex samplesMutex; ///< Mutex for the sample data |
| 109 | - | |
| 110 | - // Lists for enums | |
| 111 | - QList<double> gainSteps; ///< Voltage steps in V/screenheight | |
| 112 | 208 | |
| 113 | 209 | public slots: |
| 114 | 210 | virtual void connectDevice(); |
| 115 | 211 | |
| 116 | - unsigned long int setSamplerate(unsigned long int samplerate); | |
| 212 | + unsigned long int setSamplerate(unsigned long int samplerate = 0); | |
| 117 | 213 | unsigned long int setBufferSize(unsigned long int size); |
| 118 | 214 | |
| 119 | 215 | int setChannelUsed(unsigned int channel, bool used); | ... | ... |
openhantek/src/hantek/device.cpp
| ... | ... | @@ -99,13 +99,6 @@ namespace Hantek { |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - /// \todo Use 9 bit data model of DSO-5200(A) | |
| 103 | - /* if ((deviceModel == DSO_5200) || (deviceModel == DSO_5200A)) | |
| 104 | - { | |
| 105 | - extraBitsData = true; | |
| 106 | - qDebug("Using a 9-bita data model"); | |
| 107 | - }*/ | |
| 108 | - | |
| 109 | 102 | if(this->model >= 0) { |
| 110 | 103 | // Open device |
| 111 | 104 | deviceAddress = QString("%1:%2").arg(device->bus->location, 3, 10, QLatin1Char('0')).arg(device->devnum, 3, 10, QLatin1Char('0')); | ... | ... |
openhantek/src/hantek/types.cpp
| ... | ... | @@ -32,9 +32,9 @@ |
| 32 | 32 | |
| 33 | 33 | namespace Hantek { |
| 34 | 34 | ////////////////////////////////////////////////////////////////////////////// |
| 35 | - // class CommandSetFilter | |
| 35 | + // class BulkSetFilter | |
| 36 | 36 | /// \brief Sets the data array to the default values. |
| 37 | - CommandSetFilter::CommandSetFilter() : Helper::DataArray<unsigned char>(8) { | |
| 37 | + BulkSetFilter::BulkSetFilter() : Helper::DataArray<unsigned char>(8) { | |
| 38 | 38 | this->init(); |
| 39 | 39 | } |
| 40 | 40 | |
| ... | ... | @@ -42,7 +42,7 @@ namespace Hantek { |
| 42 | 42 | /// \param channel1 true if channel 1 is filtered. |
| 43 | 43 | /// \param channel2 true if channel 2 is filtered. |
| 44 | 44 | /// \param trigger true if trigger is filtered. |
| 45 | - CommandSetFilter::CommandSetFilter(bool channel1, bool channel2, bool trigger) : Helper::DataArray<unsigned char>(8) { | |
| 45 | + BulkSetFilter::BulkSetFilter(bool channel1, bool channel2, bool trigger) : Helper::DataArray<unsigned char>(8) { | |
| 46 | 46 | this->init(); |
| 47 | 47 | |
| 48 | 48 | this->setChannel(0, channel1); |
| ... | ... | @@ -53,7 +53,7 @@ namespace Hantek { |
| 53 | 53 | /// \brief Gets the filtering state of one channel. |
| 54 | 54 | /// \param channel The channel whose filtering state should be returned. |
| 55 | 55 | /// \return The filtering state of the channel. |
| 56 | - bool CommandSetFilter::getChannel(unsigned int channel) { | |
| 56 | + bool BulkSetFilter::getChannel(unsigned int channel) { | |
| 57 | 57 | FilterBits *filterBits = (FilterBits *) &(this->array[2]); |
| 58 | 58 | if(channel == 0) |
| 59 | 59 | return filterBits->channel1 == 1; |
| ... | ... | @@ -64,7 +64,7 @@ namespace Hantek { |
| 64 | 64 | /// \brief Enables/disables filtering of one channel. |
| 65 | 65 | /// \param channel The channel that should be set. |
| 66 | 66 | /// \param filtered true if the channel should be filtered. |
| 67 | - void CommandSetFilter::setChannel(unsigned int channel, bool filtered) { | |
| 67 | + void BulkSetFilter::setChannel(unsigned int channel, bool filtered) { | |
| 68 | 68 | FilterBits *filterBits = (FilterBits *) &(this->array[2]); |
| 69 | 69 | if(channel == 0) |
| 70 | 70 | filterBits->channel1 = filtered ? 1 : 0; |
| ... | ... | @@ -74,29 +74,29 @@ namespace Hantek { |
| 74 | 74 | |
| 75 | 75 | /// \brief Gets the filtering state for the trigger. |
| 76 | 76 | /// \return The filtering state of the trigger. |
| 77 | - bool CommandSetFilter::getTrigger() { | |
| 77 | + bool BulkSetFilter::getTrigger() { | |
| 78 | 78 | return ((FilterBits *) &(this->array[2]))->trigger == 1; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /// \brief Enables/disables filtering for the trigger. |
| 82 | 82 | /// \param filtered true if the trigger should be filtered. |
| 83 | - void CommandSetFilter::setTrigger(bool filtered) { | |
| 83 | + void BulkSetFilter::setTrigger(bool filtered) { | |
| 84 | 84 | FilterBits *filterBits = (FilterBits *) &(this->array[2]); |
| 85 | 85 | |
| 86 | 86 | filterBits->trigger = filtered ? 1 : 0; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /// \brief Initialize the array to the needed values. |
| 90 | - void CommandSetFilter::init() { | |
| 91 | - this->array[0] = COMMAND_SETFILTER; | |
| 90 | + void BulkSetFilter::init() { | |
| 91 | + this->array[0] = BULK_SETFILTER; | |
| 92 | 92 | this->array[1] = 0x0f; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | ////////////////////////////////////////////////////////////////////////////// |
| 97 | - // class CommandSetTriggerAndSamplerate | |
| 97 | + // class BulkSetTriggerAndSamplerate | |
| 98 | 98 | /// \brief Sets the data array to the default values. |
| 99 | - CommandSetTriggerAndSamplerate::CommandSetTriggerAndSamplerate() : Helper::DataArray<unsigned char>(12) { | |
| 99 | + BulkSetTriggerAndSamplerate::BulkSetTriggerAndSamplerate() : Helper::DataArray<unsigned char>(12) { | |
| 100 | 100 | this->init(); |
| 101 | 101 | } |
| 102 | 102 | |
| ... | ... | @@ -109,7 +109,7 @@ namespace Hantek { |
| 109 | 109 | /// \param usedChannels The enabled channels (Tsr2). |
| 110 | 110 | /// \param fastRate The fastRate state (Tsr2). |
| 111 | 111 | /// \param triggerSlope The triggerSlope value (Tsr2). |
| 112 | - CommandSetTriggerAndSamplerate::CommandSetTriggerAndSamplerate(unsigned short int samplerateSlow, unsigned long int triggerPosition, unsigned char triggerSource, unsigned char bufferSize, unsigned char samplerateFast, unsigned char usedChannels, bool fastRate, unsigned char triggerSlope) : Helper::DataArray<unsigned char>(12) { | |
| 112 | + BulkSetTriggerAndSamplerate::BulkSetTriggerAndSamplerate(unsigned short int samplerateSlow, unsigned long int triggerPosition, unsigned char triggerSource, unsigned char bufferSize, unsigned char samplerateFast, unsigned char usedChannels, bool fastRate, unsigned char triggerSlope) : Helper::DataArray<unsigned char>(12) { | |
| 113 | 113 | this->init(); |
| 114 | 114 | |
| 115 | 115 | this->setTriggerSource(triggerSource); |
| ... | ... | @@ -124,179 +124,179 @@ namespace Hantek { |
| 124 | 124 | |
| 125 | 125 | /// \brief Get the triggerSource value in Tsr1Bits. |
| 126 | 126 | /// \return The triggerSource value. |
| 127 | - unsigned char CommandSetTriggerAndSamplerate::getTriggerSource() { | |
| 127 | + unsigned char BulkSetTriggerAndSamplerate::getTriggerSource() { | |
| 128 | 128 | return ((Tsr1Bits *) &(this->array[2]))->triggerSource; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /// \brief Set the triggerSource in Tsr1Bits to the given value. |
| 132 | 132 | /// \param value The new triggerSource value. |
| 133 | - void CommandSetTriggerAndSamplerate::setTriggerSource(unsigned char value) { | |
| 133 | + void BulkSetTriggerAndSamplerate::setTriggerSource(unsigned char value) { | |
| 134 | 134 | ((Tsr1Bits *) &(this->array[2]))->triggerSource = value; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /// \brief Get the bufferSize value in Tsr1Bits. |
| 138 | 138 | /// \return The #BufferSizeId value. |
| 139 | - unsigned char CommandSetTriggerAndSamplerate::getBufferSize() { | |
| 139 | + unsigned char BulkSetTriggerAndSamplerate::getBufferSize() { | |
| 140 | 140 | return ((Tsr1Bits *) &(this->array[2]))->bufferSize; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /// \brief Set the bufferSize in Tsr1Bits to the given value. |
| 144 | 144 | /// \param value The new #BufferSizeId value. |
| 145 | - void CommandSetTriggerAndSamplerate::setBufferSize(unsigned char value) { | |
| 145 | + void BulkSetTriggerAndSamplerate::setBufferSize(unsigned char value) { | |
| 146 | 146 | ((Tsr1Bits *) &(this->array[2]))->bufferSize = value; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /// \brief Get the samplerateFast value in Tsr1Bits. |
| 150 | 150 | /// \return The samplerateFast value. |
| 151 | - unsigned char CommandSetTriggerAndSamplerate::getSamplerateFast() { | |
| 151 | + unsigned char BulkSetTriggerAndSamplerate::getSamplerateFast() { | |
| 152 | 152 | return ((Tsr1Bits *) &(this->array[2]))->samplerateFast; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /// \brief Set the samplerateFast in Tsr1Bits to the given value. |
| 156 | 156 | /// \param value The new samplerateFast value. |
| 157 | - void CommandSetTriggerAndSamplerate::setSamplerateFast(unsigned char value) { | |
| 157 | + void BulkSetTriggerAndSamplerate::setSamplerateFast(unsigned char value) { | |
| 158 | 158 | ((Tsr1Bits *) &(this->array[2]))->samplerateFast = value; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /// \brief Get the usedChannels value in Tsr2Bits. |
| 162 | 162 | /// \return The usedChannels value. |
| 163 | - unsigned char CommandSetTriggerAndSamplerate::getUsedChannels() { | |
| 163 | + unsigned char BulkSetTriggerAndSamplerate::getUsedChannels() { | |
| 164 | 164 | return ((Tsr2Bits *) &(this->array[3]))->usedChannels; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /// \brief Set the usedChannels in Tsr2Bits to the given value. |
| 168 | 168 | /// \param value The new usedChannels value. |
| 169 | - void CommandSetTriggerAndSamplerate::setUsedChannels(unsigned char value) { | |
| 169 | + void BulkSetTriggerAndSamplerate::setUsedChannels(unsigned char value) { | |
| 170 | 170 | ((Tsr2Bits *) &(this->array[3]))->usedChannels = value; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /// \brief Get the fastRate state in Tsr2Bits. |
| 174 | 174 | /// \return The fastRate state. |
| 175 | - bool CommandSetTriggerAndSamplerate::getFastRate() { | |
| 175 | + bool BulkSetTriggerAndSamplerate::getFastRate() { | |
| 176 | 176 | return ((Tsr2Bits *) &(this->array[3]))->fastRate == 1; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /// \brief Set the fastRate in Tsr2Bits to the given state. |
| 180 | 180 | /// \param fastRate The new fastRate state. |
| 181 | - void CommandSetTriggerAndSamplerate::setFastRate(bool fastRate) { | |
| 181 | + void BulkSetTriggerAndSamplerate::setFastRate(bool fastRate) { | |
| 182 | 182 | ((Tsr2Bits *) &(this->array[3]))->fastRate = fastRate ? 1 : 0; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /// \brief Get the triggerSlope value in Tsr2Bits. |
| 186 | 186 | /// \return The triggerSlope value. |
| 187 | - unsigned char CommandSetTriggerAndSamplerate::getTriggerSlope() { | |
| 187 | + unsigned char BulkSetTriggerAndSamplerate::getTriggerSlope() { | |
| 188 | 188 | return ((Tsr2Bits *) &(this->array[3]))->triggerSlope; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /// \brief Set the triggerSlope in Tsr2Bits to the given value. |
| 192 | 192 | /// \param slope The new triggerSlope value. |
| 193 | - void CommandSetTriggerAndSamplerate::setTriggerSlope(unsigned char slope) { | |
| 193 | + void BulkSetTriggerAndSamplerate::setTriggerSlope(unsigned char slope) { | |
| 194 | 194 | ((Tsr2Bits *) &(this->array[3]))->triggerSlope = slope; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /// \brief Get the SamplerateSlow value. |
| 198 | 198 | /// \return The SamplerateSlow value. |
| 199 | - unsigned short int CommandSetTriggerAndSamplerate::getSamplerateSlow() { | |
| 199 | + unsigned short int BulkSetTriggerAndSamplerate::getSamplerateSlow() { | |
| 200 | 200 | return (unsigned short int) this->array[4] | ((unsigned short int) this->array[5] << 8); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /// \brief Set the SamplerateSlow to the given value. |
| 204 | 204 | /// \param samplerate The new SamplerateSlow value. |
| 205 | - void CommandSetTriggerAndSamplerate::setSamplerateSlow(unsigned short int samplerate) { | |
| 205 | + void BulkSetTriggerAndSamplerate::setSamplerateSlow(unsigned short int samplerate) { | |
| 206 | 206 | this->array[4] = (unsigned char) samplerate; |
| 207 | 207 | this->array[5] = (unsigned char) (samplerate >> 8); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /// \brief Get the TriggerPosition value. |
| 211 | 211 | /// \return The horizontal trigger position. |
| 212 | - unsigned long int CommandSetTriggerAndSamplerate::getTriggerPosition() { | |
| 212 | + unsigned long int BulkSetTriggerAndSamplerate::getTriggerPosition() { | |
| 213 | 213 | return (unsigned long int) this->array[6] | ((unsigned long int) this->array[7] << 8) | ((unsigned long int) this->array[10] << 16); |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /// \brief Set the TriggerPosition to the given value. |
| 217 | 217 | /// \param position The new horizontal trigger position. |
| 218 | - void CommandSetTriggerAndSamplerate::setTriggerPosition(unsigned long int position) { | |
| 218 | + void BulkSetTriggerAndSamplerate::setTriggerPosition(unsigned long int position) { | |
| 219 | 219 | this->array[6] = (unsigned char) position; |
| 220 | 220 | this->array[7] = (unsigned char) (position >> 8); |
| 221 | 221 | this->array[10] = (unsigned char) (position >> 16); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /// \brief Initialize the array to the needed values. |
| 225 | - void CommandSetTriggerAndSamplerate::init() { | |
| 226 | - this->array[0] = COMMAND_SETTRIGGERANDSAMPLERATE; | |
| 225 | + void BulkSetTriggerAndSamplerate::init() { | |
| 226 | + this->array[0] = BULK_SETTRIGGERANDSAMPLERATE; | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | |
| 230 | 230 | ////////////////////////////////////////////////////////////////////////////// |
| 231 | - // class CommandForceTrigger | |
| 231 | + // class BulkForceTrigger | |
| 232 | 232 | /// \brief Sets the data array to needed values. |
| 233 | - CommandForceTrigger::CommandForceTrigger() : Helper::DataArray<unsigned char>(2) { | |
| 234 | - this->array[0] = COMMAND_FORCETRIGGER; | |
| 233 | + BulkForceTrigger::BulkForceTrigger() : Helper::DataArray<unsigned char>(2) { | |
| 234 | + this->array[0] = BULK_FORCETRIGGER; | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | |
| 238 | 238 | ////////////////////////////////////////////////////////////////////////////// |
| 239 | - // class CommandCaptureStart | |
| 239 | + // class BulkCaptureStart | |
| 240 | 240 | /// \brief Sets the data array to needed values. |
| 241 | - CommandCaptureStart::CommandCaptureStart() : Helper::DataArray<unsigned char>(2) { | |
| 242 | - this->array[0] = COMMAND_STARTSAMPLING; | |
| 241 | + BulkCaptureStart::BulkCaptureStart() : Helper::DataArray<unsigned char>(2) { | |
| 242 | + this->array[0] = BULK_STARTSAMPLING; | |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | |
| 246 | 246 | ////////////////////////////////////////////////////////////////////////////// |
| 247 | - // class CommandTriggerEnabled | |
| 247 | + // class BulkTriggerEnabled | |
| 248 | 248 | /// \brief Sets the data array to needed values. |
| 249 | - CommandTriggerEnabled::CommandTriggerEnabled() : Helper::DataArray<unsigned char>(2) { | |
| 250 | - this->array[0] = COMMAND_ENABLETRIGGER; | |
| 249 | + BulkTriggerEnabled::BulkTriggerEnabled() : Helper::DataArray<unsigned char>(2) { | |
| 250 | + this->array[0] = BULK_ENABLETRIGGER; | |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
| 254 | 254 | ////////////////////////////////////////////////////////////////////////////// |
| 255 | - // class CommandGetData | |
| 255 | + // class BulkGetData | |
| 256 | 256 | /// \brief Sets the data array to needed values. |
| 257 | - CommandGetData::CommandGetData() : Helper::DataArray<unsigned char>(2) { | |
| 258 | - this->array[0] = COMMAND_GETDATA; | |
| 257 | + BulkGetData::BulkGetData() : Helper::DataArray<unsigned char>(2) { | |
| 258 | + this->array[0] = BULK_GETDATA; | |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | |
| 262 | 262 | ////////////////////////////////////////////////////////////////////////////// |
| 263 | - // class CommandGetCaptureState | |
| 263 | + // class BulkGetCaptureState | |
| 264 | 264 | /// \brief Sets the data array to needed values. |
| 265 | - CommandGetCaptureState::CommandGetCaptureState() : Helper::DataArray<unsigned char>(2) { | |
| 266 | - this->array[0] = COMMAND_GETCAPTURESTATE; | |
| 265 | + BulkGetCaptureState::BulkGetCaptureState() : Helper::DataArray<unsigned char>(2) { | |
| 266 | + this->array[0] = BULK_GETCAPTURESTATE; | |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | |
| 270 | 270 | ////////////////////////////////////////////////////////////////////////////// |
| 271 | - // class ResponseGetCaptureState | |
| 271 | + // class BulkResponseGetCaptureState | |
| 272 | 272 | /// \brief Initializes the array. |
| 273 | - ResponseGetCaptureState::ResponseGetCaptureState() : Helper::DataArray<unsigned char>(512) { | |
| 273 | + BulkResponseGetCaptureState::BulkResponseGetCaptureState() : Helper::DataArray<unsigned char>(512) { | |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /// \brief Gets the capture state. |
| 277 | 277 | /// \return The CaptureState of the oscilloscope. |
| 278 | - CaptureState ResponseGetCaptureState::getCaptureState() { | |
| 278 | + CaptureState BulkResponseGetCaptureState::getCaptureState() { | |
| 279 | 279 | return (CaptureState) this->array[0]; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | /// \brief Gets the trigger point. |
| 283 | 283 | /// \return The trigger point for the captured samples. |
| 284 | - unsigned int ResponseGetCaptureState::getTriggerPoint() { | |
| 284 | + unsigned int BulkResponseGetCaptureState::getTriggerPoint() { | |
| 285 | 285 | return this->array[2] | (this->array[3] << 8); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
| 289 | 289 | ////////////////////////////////////////////////////////////////////////////// |
| 290 | - // class CommandSetGain | |
| 290 | + // class BulkSetGain | |
| 291 | 291 | /// \brief Sets the data array to needed values. |
| 292 | - CommandSetGain::CommandSetGain() : Helper::DataArray<unsigned char>(8) { | |
| 292 | + BulkSetGain::BulkSetGain() : Helper::DataArray<unsigned char>(8) { | |
| 293 | 293 | this->init(); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /// \brief Sets the gain to the given values. |
| 297 | 297 | /// \param channel1 The gain value for channel 1. |
| 298 | 298 | /// \param channel2 The gain value for channel 2. |
| 299 | - CommandSetGain::CommandSetGain(unsigned char channel1, unsigned char channel2) : Helper::DataArray<unsigned char>(8) { | |
| 299 | + BulkSetGain::BulkSetGain(unsigned char channel1, unsigned char channel2) : Helper::DataArray<unsigned char>(8) { | |
| 300 | 300 | this->init(); |
| 301 | 301 | |
| 302 | 302 | this->setGain(0, channel1); |
| ... | ... | @@ -306,7 +306,7 @@ namespace Hantek { |
| 306 | 306 | /// \brief Get the gain for the given channel. |
| 307 | 307 | /// \param channel The channel whose gain should be returned. |
| 308 | 308 | /// \returns The gain value. |
| 309 | - unsigned char CommandSetGain::getGain(unsigned int channel) { | |
| 309 | + unsigned char BulkSetGain::getGain(unsigned int channel) { | |
| 310 | 310 | GainBits *gainBits = (GainBits *) &(this->array[2]); |
| 311 | 311 | if(channel == 0) |
| 312 | 312 | return gainBits->channel1; |
| ... | ... | @@ -317,7 +317,7 @@ namespace Hantek { |
| 317 | 317 | /// \brief Set the gain for the given channel. |
| 318 | 318 | /// \param channel The channel that should be set. |
| 319 | 319 | /// \param value The new gain value for the channel. |
| 320 | - void CommandSetGain::setGain(unsigned int channel, unsigned char value) { | |
| 320 | + void BulkSetGain::setGain(unsigned int channel, unsigned char value) { | |
| 321 | 321 | GainBits *gainBits = (GainBits *) &(this->array[2]); |
| 322 | 322 | if(channel == 0) |
| 323 | 323 | gainBits->channel1 = value; |
| ... | ... | @@ -326,23 +326,23 @@ namespace Hantek { |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | /// \brief Initialize the array to the needed values. |
| 329 | - void CommandSetGain::init() { | |
| 330 | - this->array[0] = COMMAND_SETGAIN; | |
| 329 | + void BulkSetGain::init() { | |
| 330 | + this->array[0] = BULK_SETGAIN; | |
| 331 | 331 | this->array[1] = 0x0f; |
| 332 | 332 | ((GainBits *) &(this->array[2]))->reserved = 3; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | |
| 336 | 336 | ////////////////////////////////////////////////////////////////////////////// |
| 337 | - // class CommandSetLogicalData | |
| 337 | + // class BulkSetLogicalData | |
| 338 | 338 | /// \brief Sets the data array to needed values. |
| 339 | - CommandSetLogicalData::CommandSetLogicalData() : Helper::DataArray<unsigned char>(8) { | |
| 339 | + BulkSetLogicalData::BulkSetLogicalData() : Helper::DataArray<unsigned char>(8) { | |
| 340 | 340 | this->init(); |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | /// \brief Sets the data to the given value. |
| 344 | 344 | /// \param data The data byte. |
| 345 | - CommandSetLogicalData::CommandSetLogicalData(unsigned char data) : Helper::DataArray<unsigned char>(8) { | |
| 345 | + BulkSetLogicalData::BulkSetLogicalData(unsigned char data) : Helper::DataArray<unsigned char>(8) { | |
| 346 | 346 | this->init(); |
| 347 | 347 | |
| 348 | 348 | this->setData(data); |
| ... | ... | @@ -350,33 +350,33 @@ namespace Hantek { |
| 350 | 350 | |
| 351 | 351 | /// \brief Gets the data. |
| 352 | 352 | /// \returns The data byte. |
| 353 | - unsigned char CommandSetLogicalData::getData() { | |
| 353 | + unsigned char BulkSetLogicalData::getData() { | |
| 354 | 354 | return this->array[2]; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | /// \brief Sets the data to the given value. |
| 358 | 358 | /// \param data The new data byte. |
| 359 | - void CommandSetLogicalData::setData(unsigned char data) { | |
| 359 | + void BulkSetLogicalData::setData(unsigned char data) { | |
| 360 | 360 | this->array[2] = data; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /// \brief Initialize the array to the needed values. |
| 364 | - void CommandSetLogicalData::init() { | |
| 365 | - this->array[0] = COMMAND_SETLOGICALDATA; | |
| 364 | + void BulkSetLogicalData::init() { | |
| 365 | + this->array[0] = BULK_SETLOGICALDATA; | |
| 366 | 366 | this->array[1] = 0x0f; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | |
| 370 | 370 | ////////////////////////////////////////////////////////////////////////////// |
| 371 | - // class CommandGetLogicalData | |
| 371 | + // class BulkGetLogicalData | |
| 372 | 372 | /// \brief Sets the data array to needed values. |
| 373 | - CommandGetLogicalData::CommandGetLogicalData() : Helper::DataArray<unsigned char>(2) { | |
| 374 | - this->array[0] = COMMAND_GETLOGICALDATA; | |
| 373 | + BulkGetLogicalData::BulkGetLogicalData() : Helper::DataArray<unsigned char>(2) { | |
| 374 | + this->array[0] = BULK_GETLOGICALDATA; | |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | |
| 378 | 378 | ////////////////////////////////////////////////////////////////////////////// |
| 379 | - // class ControlGetSpeed | |
| 379 | + // class BulkGetSpeed | |
| 380 | 380 | /// \brief Initializes the array. |
| 381 | 381 | ControlGetSpeed::ControlGetSpeed() : Helper::DataArray<unsigned char>(10) { |
| 382 | 382 | } |
| ... | ... | @@ -389,10 +389,10 @@ namespace Hantek { |
| 389 | 389 | |
| 390 | 390 | |
| 391 | 391 | ////////////////////////////////////////////////////////////////////////////// |
| 392 | - // class ControlBeginCommand | |
| 392 | + // class BulkBeginCommand | |
| 393 | 393 | /// \brief Sets the command index to the given value. |
| 394 | 394 | /// \param index The CommandIndex for the command. |
| 395 | - ControlBeginCommand::ControlBeginCommand(CommandIndex index) : Helper::DataArray<unsigned char>(10) { | |
| 395 | + ControlBeginCommand::ControlBeginCommand(BulkIndex index) : Helper::DataArray<unsigned char>(10) { | |
| 396 | 396 | this->init(); |
| 397 | 397 | |
| 398 | 398 | this->setIndex(index); |
| ... | ... | @@ -400,13 +400,13 @@ namespace Hantek { |
| 400 | 400 | |
| 401 | 401 | /// \brief Gets the command index. |
| 402 | 402 | /// \return The CommandIndex for the command. |
| 403 | - CommandIndex ControlBeginCommand::getIndex() { | |
| 404 | - return (CommandIndex) this->array[1]; | |
| 403 | + BulkIndex ControlBeginCommand::getIndex() { | |
| 404 | + return (BulkIndex) this->array[1]; | |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | /// \brief Sets the command index to the given value. |
| 408 | 408 | /// \param index The new CommandIndex for the command. |
| 409 | - void ControlBeginCommand::setIndex(CommandIndex index) { | |
| 409 | + void ControlBeginCommand::setIndex(BulkIndex index) { | |
| 410 | 410 | memset(&(this->array[1]), (unsigned char) index, 3); |
| 411 | 411 | } |
| 412 | 412 | |
| ... | ... | @@ -417,7 +417,7 @@ namespace Hantek { |
| 417 | 417 | |
| 418 | 418 | |
| 419 | 419 | ////////////////////////////////////////////////////////////////////////////// |
| 420 | - // class ControlSetOffset | |
| 420 | + // class BulkSetOffset | |
| 421 | 421 | /// \brief Sets the data array to the default values. |
| 422 | 422 | ControlSetOffset::ControlSetOffset() : Helper::DataArray<unsigned char>(17) { |
| 423 | 423 | } |
| ... | ... | @@ -471,7 +471,7 @@ namespace Hantek { |
| 471 | 471 | |
| 472 | 472 | |
| 473 | 473 | ////////////////////////////////////////////////////////////////////////////// |
| 474 | - // class ControlSetRelays | |
| 474 | + // class BulkSetRelays | |
| 475 | 475 | /// \brief Sets all relay states. |
| 476 | 476 | /// \param ch1Below1V Sets the state of the Channel 1 below 1 V relay. |
| 477 | 477 | /// \param ch1Below100mV Sets the state of the Channel 1 below 100 mV relay. |
| ... | ... | @@ -564,16 +564,16 @@ namespace Hantek { |
| 564 | 564 | |
| 565 | 565 | |
| 566 | 566 | ////////////////////////////////////////////////////////////////////////////// |
| 567 | - // class CommandSetSamplerate5200 | |
| 567 | + // class BulkSetSamplerate5200 | |
| 568 | 568 | /// \brief Sets the data array to the default values. |
| 569 | - CommandSetSamplerate5200::CommandSetSamplerate5200() : Helper::DataArray<unsigned char>(6) { | |
| 569 | + BulkSetSamplerate5200::BulkSetSamplerate5200() : Helper::DataArray<unsigned char>(6) { | |
| 570 | 570 | this->init(); |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | /// \brief Sets the data bytes to the specified values. |
| 574 | 574 | /// \param samplerateSlow The SamplerateSlow value. |
| 575 | 575 | /// \param samplerateFast The SamplerateFast value. |
| 576 | - CommandSetSamplerate5200::CommandSetSamplerate5200(unsigned short int samplerateSlow, unsigned char samplerateFast) : Helper::DataArray<unsigned char>(6) { | |
| 576 | + BulkSetSamplerate5200::BulkSetSamplerate5200(unsigned short int samplerateSlow, unsigned char samplerateFast) : Helper::DataArray<unsigned char>(6) { | |
| 577 | 577 | this->init(); |
| 578 | 578 | |
| 579 | 579 | this->setSamplerateFast(samplerateFast); |
| ... | ... | @@ -582,39 +582,39 @@ namespace Hantek { |
| 582 | 582 | |
| 583 | 583 | /// \brief Get the SamplerateFast value. |
| 584 | 584 | /// \return The SamplerateFast value. |
| 585 | - unsigned char CommandSetSamplerate5200::getSamplerateFast() { | |
| 585 | + unsigned char BulkSetSamplerate5200::getSamplerateFast() { | |
| 586 | 586 | return this->array[4]; |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | /// \brief Set the SamplerateFast to the given value. |
| 590 | 590 | /// \param value The new SamplerateFast value. |
| 591 | - void CommandSetSamplerate5200::setSamplerateFast(unsigned char value) { | |
| 591 | + void BulkSetSamplerate5200::setSamplerateFast(unsigned char value) { | |
| 592 | 592 | this->array[4] = value; |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | /// \brief Get the SamplerateSlow value. |
| 596 | 596 | /// \return The SamplerateSlow value. |
| 597 | - unsigned short int CommandSetSamplerate5200::getSamplerateSlow() { | |
| 597 | + unsigned short int BulkSetSamplerate5200::getSamplerateSlow() { | |
| 598 | 598 | return (unsigned short int) this->array[2] | ((unsigned short int) this->array[3] << 8); |
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | /// \brief Set the SamplerateSlow to the given value. |
| 602 | 602 | /// \param samplerate The new SamplerateSlow value. |
| 603 | - void CommandSetSamplerate5200::setSamplerateSlow(unsigned short int samplerate) { | |
| 603 | + void BulkSetSamplerate5200::setSamplerateSlow(unsigned short int samplerate) { | |
| 604 | 604 | this->array[2] = (unsigned char) samplerate; |
| 605 | 605 | this->array[3] = (unsigned char) (samplerate >> 8); |
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | /// \brief Initialize the array to the needed values. |
| 609 | - void CommandSetSamplerate5200::init() { | |
| 610 | - this->array[0] = COMMAND_SETSAMPLERATE5200; | |
| 609 | + void BulkSetSamplerate5200::init() { | |
| 610 | + this->array[0] = BULK_SETSAMPLERATE5200; | |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | |
| 614 | 614 | ////////////////////////////////////////////////////////////////////////////// |
| 615 | - // class CommandSetBuffer5200 | |
| 615 | + // class BulkSetBuffer5200 | |
| 616 | 616 | /// \brief Sets the data array to the default values. |
| 617 | - CommandSetBuffer5200::CommandSetBuffer5200() : Helper::DataArray<unsigned char>(10) { | |
| 617 | + BulkSetBuffer5200::BulkSetBuffer5200() : Helper::DataArray<unsigned char>(10) { | |
| 618 | 618 | this->init(); |
| 619 | 619 | } |
| 620 | 620 | |
| ... | ... | @@ -624,7 +624,7 @@ namespace Hantek { |
| 624 | 624 | /// \param usedPre The TriggerPositionUsedPre value. |
| 625 | 625 | /// \param usedPost The TriggerPositionUsedPost value. |
| 626 | 626 | /// \param bufferSize The #BufferSizeId value. |
| 627 | - CommandSetBuffer5200::CommandSetBuffer5200(unsigned short int triggerPositionPre, unsigned short int triggerPositionPost, unsigned char usedPre, unsigned char usedPost, unsigned char bufferSize) : Helper::DataArray<unsigned char>(10) { | |
| 627 | + BulkSetBuffer5200::BulkSetBuffer5200(unsigned short int triggerPositionPre, unsigned short int triggerPositionPost, unsigned char usedPre, unsigned char usedPost, unsigned char bufferSize) : Helper::DataArray<unsigned char>(10) { | |
| 628 | 628 | this->init(); |
| 629 | 629 | |
| 630 | 630 | this->setTriggerPositionPre(triggerPositionPre); |
| ... | ... | @@ -636,78 +636,78 @@ namespace Hantek { |
| 636 | 636 | |
| 637 | 637 | /// \brief Get the TriggerPositionPre value. |
| 638 | 638 | /// \return The TriggerPositionPre value. |
| 639 | - unsigned short int CommandSetBuffer5200::getTriggerPositionPre() { | |
| 639 | + unsigned short int BulkSetBuffer5200::getTriggerPositionPre() { | |
| 640 | 640 | return (unsigned short int) this->array[2] | ((unsigned short int) this->array[3] << 8); |
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | /// \brief Set the TriggerPositionPre to the given value. |
| 644 | 644 | /// \param position The new TriggerPositionPre value. |
| 645 | - void CommandSetBuffer5200::setTriggerPositionPre(unsigned short int position) { | |
| 645 | + void BulkSetBuffer5200::setTriggerPositionPre(unsigned short int position) { | |
| 646 | 646 | this->array[2] = (unsigned char) position; |
| 647 | 647 | this->array[3] = (unsigned char) (position >> 8); |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | /// \brief Get the TriggerPositionPost value. |
| 651 | 651 | /// \return The TriggerPositionPost value. |
| 652 | - unsigned short int CommandSetBuffer5200::getTriggerPositionPost() { | |
| 652 | + unsigned short int BulkSetBuffer5200::getTriggerPositionPost() { | |
| 653 | 653 | return (unsigned short int) this->array[6] | ((unsigned short int) this->array[7] << 8); |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | /// \brief Set the TriggerPositionPost to the given value. |
| 657 | 657 | /// \param position The new TriggerPositionPost value. |
| 658 | - void CommandSetBuffer5200::setTriggerPositionPost(unsigned short int position) { | |
| 658 | + void BulkSetBuffer5200::setTriggerPositionPost(unsigned short int position) { | |
| 659 | 659 | this->array[6] = (unsigned char) position; |
| 660 | 660 | this->array[7] = (unsigned char) (position >> 8); |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | /// \brief Get the TriggerPositionUsedPre value. |
| 664 | 664 | /// \return The #DTriggerPositionUsed value for the pre position. |
| 665 | - unsigned char CommandSetBuffer5200::getUsedPre() { | |
| 665 | + unsigned char BulkSetBuffer5200::getUsedPre() { | |
| 666 | 666 | return this->array[4]; |
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | /// \brief Set the TriggerPositionUsedPre to the given value. |
| 670 | 670 | /// \param value The new #DTriggerPositionUsed value for the pre position. |
| 671 | - void CommandSetBuffer5200::setUsedPre(unsigned char value) { | |
| 671 | + void BulkSetBuffer5200::setUsedPre(unsigned char value) { | |
| 672 | 672 | this->array[4] = value; |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | /// \brief Get the TriggerPositionUsedPost value. |
| 676 | 676 | /// \return The #DTriggerPositionUsed value for the post position. |
| 677 | - unsigned char CommandSetBuffer5200::getUsedPost() { | |
| 677 | + unsigned char BulkSetBuffer5200::getUsedPost() { | |
| 678 | 678 | return ((DBufferBits *) &(this->array[8]))->triggerPositionUsed; |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | /// \brief Set the TriggerPositionUsedPost to the given value. |
| 682 | 682 | /// \param value The new #DTriggerPositionUsed value for the post position. |
| 683 | - void CommandSetBuffer5200::setUsedPost(unsigned char value) { | |
| 683 | + void BulkSetBuffer5200::setUsedPost(unsigned char value) { | |
| 684 | 684 | ((DBufferBits *) &(this->array[8]))->triggerPositionUsed = value; |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | /// \brief Get the bufferSize value in DBufferBits. |
| 688 | 688 | /// \return The #BufferSizeId value. |
| 689 | - unsigned char CommandSetBuffer5200::getBufferSize() { | |
| 689 | + unsigned char BulkSetBuffer5200::getBufferSize() { | |
| 690 | 690 | return ((DBufferBits *) &(this->array[8]))->bufferSize; |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | /// \brief Set the bufferSize in DBufferBits to the given value. |
| 694 | 694 | /// \param value The new #BufferSizeId value. |
| 695 | - void CommandSetBuffer5200::setBufferSize(unsigned char value) { | |
| 695 | + void BulkSetBuffer5200::setBufferSize(unsigned char value) { | |
| 696 | 696 | ((DBufferBits *) &(this->array[8]))->bufferSize = value; |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | /// \brief Initialize the array to the needed values. |
| 700 | - void CommandSetBuffer5200::init() { | |
| 701 | - this->array[0] = COMMAND_SETBUFFER5200; | |
| 700 | + void BulkSetBuffer5200::init() { | |
| 701 | + this->array[0] = BULK_SETBUFFER5200; | |
| 702 | 702 | this->array[5] = 0xff; |
| 703 | 703 | this->array[9] = 0xff; |
| 704 | 704 | } |
| 705 | 705 | |
| 706 | 706 | |
| 707 | 707 | ////////////////////////////////////////////////////////////////////////////// |
| 708 | - // class CommandSetTrigger5200 | |
| 708 | + // class BulkSetTrigger5200 | |
| 709 | 709 | /// \brief Sets the data array to the default values. |
| 710 | - CommandSetTrigger5200::CommandSetTrigger5200() : Helper::DataArray<unsigned char>(8) { | |
| 710 | + BulkSetTrigger5200::BulkSetTrigger5200() : Helper::DataArray<unsigned char>(8) { | |
| 711 | 711 | this->init(); |
| 712 | 712 | } |
| 713 | 713 | |
| ... | ... | @@ -717,7 +717,7 @@ namespace Hantek { |
| 717 | 717 | /// \param fastRate The fastRate state. |
| 718 | 718 | /// \param triggerSlope The triggerSlope value. |
| 719 | 719 | /// \param triggerPulse The triggerPulse value. |
| 720 | - CommandSetTrigger5200::CommandSetTrigger5200(unsigned char triggerSource, unsigned char usedChannels, bool fastRate, unsigned char triggerSlope, unsigned char triggerPulse) : Helper::DataArray<unsigned char>(8) { | |
| 720 | + BulkSetTrigger5200::BulkSetTrigger5200(unsigned char triggerSource, unsigned char usedChannels, bool fastRate, unsigned char triggerSlope, unsigned char triggerPulse) : Helper::DataArray<unsigned char>(8) { | |
| 721 | 721 | this->init(); |
| 722 | 722 | |
| 723 | 723 | this->setTriggerSource(triggerSource); |
| ... | ... | @@ -729,67 +729,67 @@ namespace Hantek { |
| 729 | 729 | |
| 730 | 730 | /// \brief Get the triggerSource value in ETsrBits. |
| 731 | 731 | /// \return The #TriggerSource value. |
| 732 | - unsigned char CommandSetTrigger5200::getTriggerSource() { | |
| 732 | + unsigned char BulkSetTrigger5200::getTriggerSource() { | |
| 733 | 733 | return ((ETsrBits *) &(this->array[2]))->triggerSource; |
| 734 | 734 | } |
| 735 | 735 | |
| 736 | 736 | /// \brief Set the triggerSource in ETsrBits to the given value. |
| 737 | 737 | /// \param value The new #TriggerSource value. |
| 738 | - void CommandSetTrigger5200::setTriggerSource(unsigned char value) { | |
| 738 | + void BulkSetTrigger5200::setTriggerSource(unsigned char value) { | |
| 739 | 739 | ((ETsrBits *) &(this->array[2]))->triggerSource = value; |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | 742 | /// \brief Get the usedChannels value in ETsrBits. |
| 743 | 743 | /// \return The #UsedChannels value. |
| 744 | - unsigned char CommandSetTrigger5200::getUsedChannels() { | |
| 744 | + unsigned char BulkSetTrigger5200::getUsedChannels() { | |
| 745 | 745 | return ((ETsrBits *) &(this->array[2]))->usedChannels; |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | /// \brief Set the usedChannels in ETsrBits to the given value. |
| 749 | 749 | /// \param value The new #UsedChannels value. |
| 750 | - void CommandSetTrigger5200::setUsedChannels(unsigned char value) { | |
| 750 | + void BulkSetTrigger5200::setUsedChannels(unsigned char value) { | |
| 751 | 751 | ((ETsrBits *) &(this->array[2]))->usedChannels = value; |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | /// \brief Get the fastRate state in ETsrBits. |
| 755 | 755 | /// \return The fastRate state (Already inverted). |
| 756 | - bool CommandSetTrigger5200::getFastRate() { | |
| 756 | + bool BulkSetTrigger5200::getFastRate() { | |
| 757 | 757 | return ((ETsrBits *) &(this->array[2]))->fastRate == 0; |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | /// \brief Set the fastRate in ETsrBits to the given state. |
| 761 | 761 | /// \param fastRate The new fastRate state (Automatically inverted). |
| 762 | - void CommandSetTrigger5200::setFastRate(bool fastRate) { | |
| 762 | + void BulkSetTrigger5200::setFastRate(bool fastRate) { | |
| 763 | 763 | ((ETsrBits *) &(this->array[2]))->fastRate = fastRate ? 0 : 1; |
| 764 | 764 | } |
| 765 | 765 | |
| 766 | 766 | /// \brief Get the triggerSlope value in ETsrBits. |
| 767 | 767 | /// \return The triggerSlope value. |
| 768 | - unsigned char CommandSetTrigger5200::getTriggerSlope() { | |
| 768 | + unsigned char BulkSetTrigger5200::getTriggerSlope() { | |
| 769 | 769 | return ((ETsrBits *) &(this->array[2]))->triggerSlope; |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | /// \brief Set the triggerSlope in ETsrBits to the given value. |
| 773 | 773 | /// \param slope The new triggerSlope value. |
| 774 | - void CommandSetTrigger5200::setTriggerSlope(unsigned char slope) { | |
| 774 | + void BulkSetTrigger5200::setTriggerSlope(unsigned char slope) { | |
| 775 | 775 | ((ETsrBits *) &(this->array[2]))->triggerSlope = slope; |
| 776 | 776 | } |
| 777 | 777 | |
| 778 | 778 | /// \brief Get the triggerPulse state in ETsrBits. |
| 779 | 779 | /// \return The triggerPulse state. |
| 780 | - bool CommandSetTrigger5200::getTriggerPulse() { | |
| 780 | + bool BulkSetTrigger5200::getTriggerPulse() { | |
| 781 | 781 | return ((ETsrBits *) &(this->array[2]))->triggerPulse == 1; |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | /// \brief Set the triggerPulse in ETsrBits to the given state. |
| 785 | 785 | /// \param pulse The new triggerPulse state. |
| 786 | - void CommandSetTrigger5200::setTriggerPulse(bool pulse) { | |
| 786 | + void BulkSetTrigger5200::setTriggerPulse(bool pulse) { | |
| 787 | 787 | ((ETsrBits *) &(this->array[2]))->triggerPulse = pulse ? 1 : 0; |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | /// \brief Initialize the array to the needed values. |
| 791 | - void CommandSetTrigger5200::init() { | |
| 792 | - this->array[0] = COMMAND_SETTRIGGER5200; | |
| 791 | + void BulkSetTrigger5200::init() { | |
| 792 | + this->array[0] = BULK_SETTRIGGER5200; | |
| 793 | 793 | this->array[4] = 0x02; |
| 794 | 794 | } |
| 795 | 795 | } | ... | ... |
openhantek/src/hantek/types.h
| ... | ... | @@ -47,10 +47,10 @@ |
| 47 | 47 | /// \brief All %Hantek DSO device specific things. |
| 48 | 48 | namespace Hantek { |
| 49 | 49 | ////////////////////////////////////////////////////////////////////////////// |
| 50 | - /// \enum CommandCode hantek/types.h | |
| 50 | + /// \enum BulkCode hantek/types.h | |
| 51 | 51 | /// \brief All supported bulk commands. |
| 52 | 52 | /// Indicies given in square brackets specify byte numbers in little endian format. |
| 53 | - enum CommandCode { | |
| 53 | + enum BulkCode { | |
| 54 | 54 | /// <p> |
| 55 | 55 | /// This command sets channel and trigger filter: |
| 56 | 56 | /// <table> |
| ... | ... | @@ -66,7 +66,7 @@ namespace Hantek { |
| 66 | 66 | /// </tr> |
| 67 | 67 | /// </table> |
| 68 | 68 | /// </p> |
| 69 | - COMMAND_SETFILTER, | |
| 69 | + BULK_SETFILTER, | |
| 70 | 70 | |
| 71 | 71 | /// <p> |
| 72 | 72 | /// This command sets trigger and timebase: |
| ... | ... | @@ -101,7 +101,7 @@ namespace Hantek { |
| 101 | 101 | /// <p> |
| 102 | 102 | /// The TriggerPosition sets the position of the pretrigger in samples. The left side (0 %) is 0x77660 when using the small buffer and 0x78000 when using the large buffer. |
| 103 | 103 | /// </p> |
| 104 | - COMMAND_SETTRIGGERANDSAMPLERATE, | |
| 104 | + BULK_SETTRIGGERANDSAMPLERATE, | |
| 105 | 105 | |
| 106 | 106 | /// <p> |
| 107 | 107 | /// This command forces triggering: |
| ... | ... | @@ -112,7 +112,7 @@ namespace Hantek { |
| 112 | 112 | /// </tr> |
| 113 | 113 | /// </table> |
| 114 | 114 | /// </p> |
| 115 | - COMMAND_FORCETRIGGER, | |
| 115 | + BULK_FORCETRIGGER, | |
| 116 | 116 | |
| 117 | 117 | /// <p> |
| 118 | 118 | /// This command starts to capture data: |
| ... | ... | @@ -123,7 +123,7 @@ namespace Hantek { |
| 123 | 123 | /// </tr> |
| 124 | 124 | /// </table> |
| 125 | 125 | /// </p> |
| 126 | - COMMAND_STARTSAMPLING, | |
| 126 | + BULK_STARTSAMPLING, | |
| 127 | 127 | |
| 128 | 128 | /// <p> |
| 129 | 129 | /// This command sets the trigger: |
| ... | ... | @@ -134,7 +134,7 @@ namespace Hantek { |
| 134 | 134 | /// </tr> |
| 135 | 135 | /// </table> |
| 136 | 136 | /// </p> |
| 137 | - COMMAND_ENABLETRIGGER, | |
| 137 | + BULK_ENABLETRIGGER, | |
| 138 | 138 | |
| 139 | 139 | /// <p> |
| 140 | 140 | /// This command reads data from the hardware: |
| ... | ... | @@ -160,13 +160,27 @@ namespace Hantek { |
| 160 | 160 | /// </tr> |
| 161 | 161 | /// <tr> |
| 162 | 162 | /// <td>Sample[1024]</td> |
| 163 | + /// <td colspan="2">...</td> | |
| 164 | + /// </tr> | |
| 165 | + /// </table> | |
| 166 | + /// Because of the 10 bit data model, the DSO-5200 transmits the two extra bits for each sample afterwards: | |
| 167 | + /// <table> | |
| 168 | + /// <tr> | |
| 169 | + /// <td>Extra[0] << 2 | Extra[1]</td> | |
| 170 | + /// <td>0</td> | |
| 171 | + /// <td>Extra[2] << 2 | Extra[3]</td> | |
| 172 | + /// <td>0</td> | |
| 163 | 173 | /// <td>...</td> |
| 164 | - /// <td>...</td> | |
| 174 | + /// <td>Extra[510] << 2 | Extra[511]</td> | |
| 175 | + /// <td>0</td> | |
| 176 | + /// </tr> | |
| 177 | + /// <tr> | |
| 178 | + /// <td>Extra[512] << 2 | Extra[513]</td> | |
| 179 | + /// <td colspan="6">...</td> | |
| 165 | 180 | /// </tr> |
| 166 | 181 | /// </table> |
| 167 | - /// Because of the 9 bit data model, the DSO-5200 transmits an additional MSB for each sample afterwards. | |
| 168 | 182 | /// </p> |
| 169 | - COMMAND_GETDATA, | |
| 183 | + BULK_GETDATA, | |
| 170 | 184 | |
| 171 | 185 | /// <p> |
| 172 | 186 | /// This command checks the capture state: |
| ... | ... | @@ -189,7 +203,7 @@ namespace Hantek { |
| 189 | 203 | /// </tr> |
| 190 | 204 | /// </table> |
| 191 | 205 | /// </p> |
| 192 | - COMMAND_GETCAPTURESTATE, | |
| 206 | + BULK_GETCAPTURESTATE, | |
| 193 | 207 | |
| 194 | 208 | /// <p> |
| 195 | 209 | /// This command sets the gain: |
| ... | ... | @@ -207,10 +221,10 @@ namespace Hantek { |
| 207 | 221 | /// </table> |
| 208 | 222 | /// It is usually used in combination with #CONTROL_SETRELAYS. |
| 209 | 223 | /// </p> |
| 210 | - COMMAND_SETGAIN, | |
| 224 | + BULK_SETGAIN, | |
| 211 | 225 | |
| 212 | 226 | /// <p> |
| 213 | - /// This command sets the logical data (And what the hell is this?...): | |
| 227 | + /// This command sets the logical data (Not used in official Hantek software): | |
| 214 | 228 | /// <table> |
| 215 | 229 | /// <tr> |
| 216 | 230 | /// <td>0x08</td> |
| ... | ... | @@ -224,10 +238,10 @@ namespace Hantek { |
| 224 | 238 | /// </tr> |
| 225 | 239 | /// </table> |
| 226 | 240 | /// </p> |
| 227 | - COMMAND_SETLOGICALDATA, | |
| 241 | + BULK_SETLOGICALDATA, | |
| 228 | 242 | |
| 229 | 243 | /// <p> |
| 230 | - /// This command reads the logical data (And what the hell is this?...): | |
| 244 | + /// This command reads the logical data (Not used in official Hantek software): | |
| 231 | 245 | /// <table> |
| 232 | 246 | /// <tr> |
| 233 | 247 | /// <td>0x09</td> |
| ... | ... | @@ -236,17 +250,15 @@ namespace Hantek { |
| 236 | 250 | /// </table> |
| 237 | 251 | /// </p> |
| 238 | 252 | /// <p> |
| 239 | - /// The oscilloscope returns the logical data, which is 64 or 512 bytes long: | |
| 253 | + /// The oscilloscope returns the logical data, which contains valid data in the first byte although it is 64 or 512 bytes long: | |
| 240 | 254 | /// <table> |
| 241 | 255 | /// <tr> |
| 242 | - /// <td>?</td> | |
| 243 | - /// <td>?</td> | |
| 244 | - /// <td>?</td> | |
| 256 | + /// <td>Data</td> | |
| 245 | 257 | /// <td>...</td> |
| 246 | 258 | /// </tr> |
| 247 | 259 | /// </table> |
| 248 | 260 | /// </p> |
| 249 | - COMMAND_GETLOGICALDATA, | |
| 261 | + BULK_GETLOGICALDATA, | |
| 250 | 262 | |
| 251 | 263 | /// <p> |
| 252 | 264 | /// This command isn't used for the DSO-2090 and DSO-5200: |
| ... | ... | @@ -257,7 +269,7 @@ namespace Hantek { |
| 257 | 269 | /// </tr> |
| 258 | 270 | /// </table> |
| 259 | 271 | /// </p> |
| 260 | - COMMAND_UNKNOWN_0A, | |
| 272 | + BULK_UNKNOWN_0A, | |
| 261 | 273 | |
| 262 | 274 | /// <p> |
| 263 | 275 | /// This command isn't used for the DSO-2090 and DSO-5200: |
| ... | ... | @@ -268,7 +280,7 @@ namespace Hantek { |
| 268 | 280 | /// </tr> |
| 269 | 281 | /// </table> |
| 270 | 282 | /// </p> |
| 271 | - COMMAND_UNKNOWN_0B, | |
| 283 | + BULK_UNKNOWN_0B, | |
| 272 | 284 | |
| 273 | 285 | /// <p> |
| 274 | 286 | /// This command sets the sampling rate for the DSO-5200: |
| ... | ... | @@ -288,7 +300,7 @@ namespace Hantek { |
| 288 | 300 | /// <i>Samplerate = SamplerateMax / (2comp(SamplerateSlow) * 2 + 4 - SamplerateFast)</i><br /> |
| 289 | 301 | /// SamplerateMax is 100 MS/s for the DSO-5200 in default configuration and 250 MS/s in fast rate mode though, the modifications regarding buffer size are the the same that apply for the DSO-2090. |
| 290 | 302 | /// </p> |
| 291 | - COMMAND_SETSAMPLERATE5200, | |
| 303 | + BULK_SETSAMPLERATE5200, | |
| 292 | 304 | |
| 293 | 305 | /// <p> |
| 294 | 306 | /// This command sets the trigger position and buffer size for the DSO-5200: |
| ... | ... | @@ -314,7 +326,7 @@ namespace Hantek { |
| 314 | 326 | /// <p> |
| 315 | 327 | /// The TriggerPositionPre and TriggerPositionPost values set the pretrigger position. Both values have a range from 0xd7ff (0xc7ff for 14 kiS buffer) to 0xfffe. On the left side (0 %) the TriggerPositionPre value is minimal, on the right side (100 %) it is maximal. The TriggerPositionPost value is maximal for 0 % and minimal for 100%. |
| 316 | 328 | /// </p> |
| 317 | - COMMAND_SETBUFFER5200, | |
| 329 | + BULK_SETBUFFER5200, | |
| 318 | 330 | |
| 319 | 331 | /// <p> |
| 320 | 332 | /// This command sets the channel and trigger settings for the DSO-5200: |
| ... | ... | @@ -331,9 +343,9 @@ namespace Hantek { |
| 331 | 343 | /// </tr> |
| 332 | 344 | /// </table> |
| 333 | 345 | /// </p> |
| 334 | - COMMAND_SETTRIGGER5200, | |
| 346 | + BULK_SETTRIGGER5200, | |
| 335 | 347 | |
| 336 | - COMMAND_COUNT ///< Total number of commands | |
| 348 | + BULK_COUNT ///< Total number of commands | |
| 337 | 349 | }; |
| 338 | 350 | |
| 339 | 351 | ////////////////////////////////////////////////////////////////////////////// |
| ... | ... | @@ -457,16 +469,16 @@ namespace Hantek { |
| 457 | 469 | enum ControlValue { |
| 458 | 470 | /// Value 0x08 is the calibration data for the channels offsets. It holds the offset value for the top and bottom of the scope screen for every gain step on every channel. The data is stored as a three-dimensional array:<br /> |
| 459 | 471 | /// <i>channelLevels[channel][#Gain][#LevelOffset]</i> |
| 460 | - VALUE_CHANNELLEVEL = 0x08, | |
| 472 | + VALUE_OFFSETLIMITS = 0x08, | |
| 461 | 473 | |
| 462 | 474 | /// Value 0x0a is the address of the device. It has a length of one byte. |
| 463 | 475 | VALUE_DEVICEADDRESS = 0x0a, |
| 464 | 476 | |
| 465 | - /// Value 0x60 seems to be some calibration data with a length of four bytes. What it is good for is unknown so far. | |
| 477 | + /// Value 0x60 is the calibration data for the fast rate mode on the DSO-5200. It's used to correct the level differences between the two merged channels to avoid . | |
| 466 | 478 | VALUE_CALIBRATIONDATA = 0x60, |
| 467 | 479 | |
| 468 | - /// Value 0x70 is an additional data that is used on the DSO-5200, it's six bytes long. | |
| 469 | - VALUE_UNKNOWN_70 = 0x70 | |
| 480 | + /// Value 0x70 contains correction values for the ETS functionality of the DSO-5200. | |
| 481 | + VALUE_VOLTAGELIMITS = 0x70 | |
| 470 | 482 | }; |
| 471 | 483 | |
| 472 | 484 | ////////////////////////////////////////////////////////////////////////////// |
| ... | ... | @@ -556,13 +568,13 @@ namespace Hantek { |
| 556 | 568 | }; |
| 557 | 569 | |
| 558 | 570 | ////////////////////////////////////////////////////////////////////////////// |
| 559 | - /// \enum CommandIndex hantek/types.h | |
| 571 | + /// \enum BulkIndex hantek/types.h | |
| 560 | 572 | /// \brief Can be set by CONTROL_BEGINCOMMAND, maybe it allows multiple commands at the same time? |
| 561 | - enum CommandIndex { | |
| 573 | + enum BulkIndex { | |
| 562 | 574 | COMMANDINDEX_0 = 0x03, ///< Used most of the time |
| 563 | 575 | COMMANDINDEX_1 = 0x0a, |
| 564 | 576 | COMMANDINDEX_2 = 0x09, |
| 565 | - COMMANDINDEX_3 = 0x01, ///< Used for #COMMAND_SETTRIGGERANDSAMPLERATE sometimes | |
| 577 | + COMMANDINDEX_3 = 0x01, ///< Used for #BULK_SETTRIGGERANDSAMPLERATE sometimes | |
| 566 | 578 | COMMANDINDEX_4 = 0x02, |
| 567 | 579 | COMMANDINDEX_5 = 0x08 |
| 568 | 580 | }; |
| ... | ... | @@ -586,7 +598,7 @@ namespace Hantek { |
| 586 | 598 | |
| 587 | 599 | ////////////////////////////////////////////////////////////////////////////// |
| 588 | 600 | /// \struct FilterBits hantek/types.h |
| 589 | - /// \brief The bits for COMMAND_SETFILTER. | |
| 601 | + /// \brief The bits for BULK_SETFILTER. | |
| 590 | 602 | struct FilterBits { |
| 591 | 603 | unsigned char channel1:1; ///< Set to true when channel 1 isn't used |
| 592 | 604 | unsigned char channel2:1; ///< Set to true when channel 2 isn't used |
| ... | ... | @@ -596,7 +608,7 @@ namespace Hantek { |
| 596 | 608 | |
| 597 | 609 | ////////////////////////////////////////////////////////////////////////////// |
| 598 | 610 | /// \struct GainBits hantek/types.h |
| 599 | - /// \brief The gain bits for COMMAND_SETGAIN. | |
| 611 | + /// \brief The gain bits for BULK_SETGAIN. | |
| 600 | 612 | struct GainBits { |
| 601 | 613 | unsigned char channel1:2; ///< Gain for CH1, 0 = 1e* V, 1 = 2e*, 2 = 5e* |
| 602 | 614 | unsigned char channel2:2; ///< Gain for CH1, 0 = 1e* V, 1 = 2e*, 2 = 5e* |
| ... | ... | @@ -643,12 +655,12 @@ namespace Hantek { |
| 643 | 655 | }; |
| 644 | 656 | |
| 645 | 657 | ////////////////////////////////////////////////////////////////////////////// |
| 646 | - /// \class CommandSetFilter hantek/types.h | |
| 647 | - /// \brief The COMMAND_SETFILTER builder. | |
| 648 | - class CommandSetFilter : public Helper::DataArray<unsigned char> { | |
| 658 | + /// \class BulkSetFilter hantek/types.h | |
| 659 | + /// \brief The BULK_SETFILTER builder. | |
| 660 | + class BulkSetFilter : public Helper::DataArray<unsigned char> { | |
| 649 | 661 | public: |
| 650 | - CommandSetFilter(); | |
| 651 | - CommandSetFilter(bool channel1, bool channel2, bool trigger); | |
| 662 | + BulkSetFilter(); | |
| 663 | + BulkSetFilter(bool channel1, bool channel2, bool trigger); | |
| 652 | 664 | |
| 653 | 665 | bool getChannel(unsigned int channel); |
| 654 | 666 | void setChannel(unsigned int channel, bool filtered); |
| ... | ... | @@ -660,12 +672,12 @@ namespace Hantek { |
| 660 | 672 | }; |
| 661 | 673 | |
| 662 | 674 | ////////////////////////////////////////////////////////////////////////////// |
| 663 | - /// \class CommandSetTriggerAndSamplerate hantek/types.h | |
| 664 | - /// \brief The COMMAND_SETTRIGGERANDSAMPLERATE builder. | |
| 665 | - class CommandSetTriggerAndSamplerate : public Helper::DataArray<unsigned char> { | |
| 675 | + /// \class BulkSetTriggerAndSamplerate hantek/types.h | |
| 676 | + /// \brief The BULK_SETTRIGGERANDSAMPLERATE builder. | |
| 677 | + class BulkSetTriggerAndSamplerate : public Helper::DataArray<unsigned char> { | |
| 666 | 678 | public: |
| 667 | - CommandSetTriggerAndSamplerate(); | |
| 668 | - CommandSetTriggerAndSamplerate(unsigned short int samplerateSlow, unsigned long int triggerPosition, unsigned char triggerSource = 0, unsigned char bufferSize = 0, unsigned char samplerateFast = 0, unsigned char usedChannels = 0, bool fastRate = false, unsigned char triggerSlope = 0); | |
| 679 | + BulkSetTriggerAndSamplerate(); | |
| 680 | + BulkSetTriggerAndSamplerate(unsigned short int samplerateSlow, unsigned long int triggerPosition, unsigned char triggerSource = 0, unsigned char bufferSize = 0, unsigned char samplerateFast = 0, unsigned char usedChannels = 0, bool fastRate = false, unsigned char triggerSlope = 0); | |
| 669 | 681 | |
| 670 | 682 | unsigned char getTriggerSource(); |
| 671 | 683 | void setTriggerSource(unsigned char value); |
| ... | ... | @@ -689,63 +701,63 @@ namespace Hantek { |
| 689 | 701 | }; |
| 690 | 702 | |
| 691 | 703 | ////////////////////////////////////////////////////////////////////////////// |
| 692 | - /// \class CommandForceTrigger hantek/types.h | |
| 693 | - /// \brief The COMMAND_FORCETRIGGER builder. | |
| 694 | - class CommandForceTrigger : public Helper::DataArray<unsigned char> { | |
| 704 | + /// \class BulkForceTrigger hantek/types.h | |
| 705 | + /// \brief The BULK_FORCETRIGGER builder. | |
| 706 | + class BulkForceTrigger : public Helper::DataArray<unsigned char> { | |
| 695 | 707 | public: |
| 696 | - CommandForceTrigger(); | |
| 708 | + BulkForceTrigger(); | |
| 697 | 709 | }; |
| 698 | 710 | |
| 699 | 711 | ////////////////////////////////////////////////////////////////////////////// |
| 700 | - /// \class CommandCaptureStart hantek/types.h | |
| 701 | - /// \brief The COMMAND_CAPTURESTART builder. | |
| 702 | - class CommandCaptureStart : public Helper::DataArray<unsigned char> { | |
| 712 | + /// \class BulkCaptureStart hantek/types.h | |
| 713 | + /// \brief The BULK_CAPTURESTART builder. | |
| 714 | + class BulkCaptureStart : public Helper::DataArray<unsigned char> { | |
| 703 | 715 | public: |
| 704 | - CommandCaptureStart(); | |
| 716 | + BulkCaptureStart(); | |
| 705 | 717 | }; |
| 706 | 718 | |
| 707 | 719 | ////////////////////////////////////////////////////////////////////////////// |
| 708 | - /// \class CommandTriggerEnabled hantek/types.h | |
| 709 | - /// \brief The COMMAND_TRIGGERENABLED builder. | |
| 710 | - class CommandTriggerEnabled : public Helper::DataArray<unsigned char> { | |
| 720 | + /// \class BulkTriggerEnabled hantek/types.h | |
| 721 | + /// \brief The BULK_TRIGGERENABLED builder. | |
| 722 | + class BulkTriggerEnabled : public Helper::DataArray<unsigned char> { | |
| 711 | 723 | public: |
| 712 | - CommandTriggerEnabled(); | |
| 724 | + BulkTriggerEnabled(); | |
| 713 | 725 | }; |
| 714 | 726 | |
| 715 | 727 | ////////////////////////////////////////////////////////////////////////////// |
| 716 | - /// \class CommandGetData hantek/types.h | |
| 717 | - /// \brief The COMMAND_GETDATA builder. | |
| 718 | - class CommandGetData : public Helper::DataArray<unsigned char> { | |
| 728 | + /// \class BulkGetData hantek/types.h | |
| 729 | + /// \brief The BULK_GETDATA builder. | |
| 730 | + class BulkGetData : public Helper::DataArray<unsigned char> { | |
| 719 | 731 | public: |
| 720 | - CommandGetData(); | |
| 732 | + BulkGetData(); | |
| 721 | 733 | }; |
| 722 | 734 | |
| 723 | 735 | ////////////////////////////////////////////////////////////////////////////// |
| 724 | - /// \class CommandGetCaptureState hantek/types.h | |
| 725 | - /// \brief The COMMAND_GETCAPTURESTATE builder. | |
| 726 | - class CommandGetCaptureState : public Helper::DataArray<unsigned char> { | |
| 736 | + /// \class BulkGetCaptureState hantek/types.h | |
| 737 | + /// \brief The BULK_GETCAPTURESTATE builder. | |
| 738 | + class BulkGetCaptureState : public Helper::DataArray<unsigned char> { | |
| 727 | 739 | public: |
| 728 | - CommandGetCaptureState(); | |
| 740 | + BulkGetCaptureState(); | |
| 729 | 741 | }; |
| 730 | 742 | |
| 731 | 743 | ////////////////////////////////////////////////////////////////////////////// |
| 732 | - /// \class ResponseGetCaptureState hantek/types.h | |
| 733 | - /// \brief The parser for the COMMAND_GETCAPTURESTATE response. | |
| 734 | - class ResponseGetCaptureState : public Helper::DataArray<unsigned char> { | |
| 744 | + /// \class BulkResponseGetCaptureState hantek/types.h | |
| 745 | + /// \brief The parser for the BULK_GETCAPTURESTATE response. | |
| 746 | + class BulkResponseGetCaptureState : public Helper::DataArray<unsigned char> { | |
| 735 | 747 | public: |
| 736 | - ResponseGetCaptureState(); | |
| 748 | + BulkResponseGetCaptureState(); | |
| 737 | 749 | |
| 738 | 750 | CaptureState getCaptureState(); |
| 739 | 751 | unsigned int getTriggerPoint(); |
| 740 | 752 | }; |
| 741 | 753 | |
| 742 | 754 | ////////////////////////////////////////////////////////////////////////////// |
| 743 | - /// \class CommandSetGain hantek/types.h | |
| 744 | - /// \brief The COMMAND_SETGAIN builder. | |
| 745 | - class CommandSetGain : public Helper::DataArray<unsigned char> { | |
| 755 | + /// \class BulkSetGain hantek/types.h | |
| 756 | + /// \brief The BULK_SETGAIN builder. | |
| 757 | + class BulkSetGain : public Helper::DataArray<unsigned char> { | |
| 746 | 758 | public: |
| 747 | - CommandSetGain(); | |
| 748 | - CommandSetGain(unsigned char channel1, unsigned char channel2); | |
| 759 | + BulkSetGain(); | |
| 760 | + BulkSetGain(unsigned char channel1, unsigned char channel2); | |
| 749 | 761 | |
| 750 | 762 | unsigned char getGain(unsigned int channel); |
| 751 | 763 | void setGain(unsigned int channel, unsigned char value); |
| ... | ... | @@ -755,12 +767,12 @@ namespace Hantek { |
| 755 | 767 | }; |
| 756 | 768 | |
| 757 | 769 | ////////////////////////////////////////////////////////////////////////////// |
| 758 | - /// \class CommandSetLogicalData hantek/types.h | |
| 759 | - /// \brief The COMMAND_SETLOGICALDATA builder. | |
| 760 | - class CommandSetLogicalData : public Helper::DataArray<unsigned char> { | |
| 770 | + /// \class BulkSetLogicalData hantek/types.h | |
| 771 | + /// \brief The BULK_SETLOGICALDATA builder. | |
| 772 | + class BulkSetLogicalData : public Helper::DataArray<unsigned char> { | |
| 761 | 773 | public: |
| 762 | - CommandSetLogicalData(); | |
| 763 | - CommandSetLogicalData(unsigned char data); | |
| 774 | + BulkSetLogicalData(); | |
| 775 | + BulkSetLogicalData(unsigned char data); | |
| 764 | 776 | |
| 765 | 777 | unsigned char getData(); |
| 766 | 778 | void setData(unsigned char data); |
| ... | ... | @@ -770,11 +782,74 @@ namespace Hantek { |
| 770 | 782 | }; |
| 771 | 783 | |
| 772 | 784 | ////////////////////////////////////////////////////////////////////////////// |
| 773 | - /// \class CommandGetLogicalData hantek/types.h | |
| 774 | - /// \brief The COMMAND_GETLOGICALDATA builder. | |
| 775 | - class CommandGetLogicalData : public Helper::DataArray<unsigned char> { | |
| 785 | + /// \class BulkGetLogicalData hantek/types.h | |
| 786 | + /// \brief The BULK_GETLOGICALDATA builder. | |
| 787 | + class BulkGetLogicalData : public Helper::DataArray<unsigned char> { | |
| 788 | + public: | |
| 789 | + BulkGetLogicalData(); | |
| 790 | + }; | |
| 791 | + | |
| 792 | + ////////////////////////////////////////////////////////////////////////////// | |
| 793 | + /// \class BulkSetSamplerate5200 hantek/types.h | |
| 794 | + /// \brief The BULK_SETSAMPLERATE5200 builder. | |
| 795 | + class BulkSetSamplerate5200 : public Helper::DataArray<unsigned char> { | |
| 796 | + public: | |
| 797 | + BulkSetSamplerate5200(); | |
| 798 | + BulkSetSamplerate5200(unsigned short int samplerateSlow, unsigned char samplerateFast); | |
| 799 | + | |
| 800 | + unsigned char getSamplerateFast(); | |
| 801 | + void setSamplerateFast(unsigned char value); | |
| 802 | + unsigned short int getSamplerateSlow(); | |
| 803 | + void setSamplerateSlow(unsigned short int samplerate); | |
| 804 | + | |
| 805 | + private: | |
| 806 | + void init(); | |
| 807 | + }; | |
| 808 | + | |
| 809 | + ////////////////////////////////////////////////////////////////////////////// | |
| 810 | + /// \class BulkSetBuffer5200 hantek/types.h | |
| 811 | + /// \brief The BULK_SETBUFFER5200 builder. | |
| 812 | + class BulkSetBuffer5200 : public Helper::DataArray<unsigned char> { | |
| 776 | 813 | public: |
| 777 | - CommandGetLogicalData(); | |
| 814 | + BulkSetBuffer5200(); | |
| 815 | + BulkSetBuffer5200(unsigned short int triggerPositionPre, unsigned short int triggerPositionPost, unsigned char usedPre = 0, unsigned char usedPost = 0, unsigned char bufferSize = 0); | |
| 816 | + | |
| 817 | + unsigned short int getTriggerPositionPre(); | |
| 818 | + void setTriggerPositionPre(unsigned short int value); | |
| 819 | + unsigned short int getTriggerPositionPost(); | |
| 820 | + void setTriggerPositionPost(unsigned short int value); | |
| 821 | + unsigned char getUsedPre(); | |
| 822 | + void setUsedPre(unsigned char value); | |
| 823 | + unsigned char getUsedPost(); | |
| 824 | + void setUsedPost(unsigned char value); | |
| 825 | + unsigned char getBufferSize(); | |
| 826 | + void setBufferSize(unsigned char value); | |
| 827 | + | |
| 828 | + private: | |
| 829 | + void init(); | |
| 830 | + }; | |
| 831 | + | |
| 832 | + ////////////////////////////////////////////////////////////////////////////// | |
| 833 | + /// \class BulkSetTrigger5200 hantek/types.h | |
| 834 | + /// \brief The BULK_SETTRIGGER5200 builder. | |
| 835 | + class BulkSetTrigger5200 : public Helper::DataArray<unsigned char> { | |
| 836 | + public: | |
| 837 | + BulkSetTrigger5200(); | |
| 838 | + BulkSetTrigger5200(unsigned char triggerSource, unsigned char usedChannels, bool fastRate = false, unsigned char triggerSlope = 0, unsigned char triggerPulse = 0); | |
| 839 | + | |
| 840 | + unsigned char getTriggerSource(); | |
| 841 | + void setTriggerSource(unsigned char value); | |
| 842 | + unsigned char getUsedChannels(); | |
| 843 | + void setUsedChannels(unsigned char value); | |
| 844 | + bool getFastRate(); | |
| 845 | + void setFastRate(bool fastRate); | |
| 846 | + unsigned char getTriggerSlope(); | |
| 847 | + void setTriggerSlope(unsigned char slope); | |
| 848 | + bool getTriggerPulse(); | |
| 849 | + void setTriggerPulse(bool pulse); | |
| 850 | + | |
| 851 | + private: | |
| 852 | + void init(); | |
| 778 | 853 | }; |
| 779 | 854 | |
| 780 | 855 | ////////////////////////////////////////////////////////////////////////////// |
| ... | ... | @@ -792,10 +867,10 @@ namespace Hantek { |
| 792 | 867 | /// \brief The CONTROL_BEGINCOMMAND builder. |
| 793 | 868 | class ControlBeginCommand : public Helper::DataArray<unsigned char> { |
| 794 | 869 | public: |
| 795 | - ControlBeginCommand(CommandIndex index = COMMANDINDEX_0); | |
| 870 | + ControlBeginCommand(BulkIndex index = COMMANDINDEX_0); | |
| 796 | 871 | |
| 797 | - CommandIndex getIndex(); | |
| 798 | - void setIndex(CommandIndex index); | |
| 872 | + BulkIndex getIndex(); | |
| 873 | + void setIndex(BulkIndex index); | |
| 799 | 874 | |
| 800 | 875 | private: |
| 801 | 876 | void init(); |
| ... | ... | @@ -834,69 +909,6 @@ namespace Hantek { |
| 834 | 909 | bool getTrigger(); |
| 835 | 910 | void setTrigger(bool ext); |
| 836 | 911 | }; |
| 837 | - | |
| 838 | - ////////////////////////////////////////////////////////////////////////////// | |
| 839 | - /// \class CommandSetSamplerate5200 hantek/types.h | |
| 840 | - /// \brief The COMMAND_SETSAMPLERATE5200 builder. | |
| 841 | - class CommandSetSamplerate5200 : public Helper::DataArray<unsigned char> { | |
| 842 | - public: | |
| 843 | - CommandSetSamplerate5200(); | |
| 844 | - CommandSetSamplerate5200(unsigned short int samplerateSlow, unsigned char samplerateFast); | |
| 845 | - | |
| 846 | - unsigned char getSamplerateFast(); | |
| 847 | - void setSamplerateFast(unsigned char value); | |
| 848 | - unsigned short int getSamplerateSlow(); | |
| 849 | - void setSamplerateSlow(unsigned short int samplerate); | |
| 850 | - | |
| 851 | - private: | |
| 852 | - void init(); | |
| 853 | - }; | |
| 854 | - | |
| 855 | - ////////////////////////////////////////////////////////////////////////////// | |
| 856 | - /// \class CommandSetBuffer5200 hantek/types.h | |
| 857 | - /// \brief The COMMAND_SETBUFFER5200 builder. | |
| 858 | - class CommandSetBuffer5200 : public Helper::DataArray<unsigned char> { | |
| 859 | - public: | |
| 860 | - CommandSetBuffer5200(); | |
| 861 | - CommandSetBuffer5200(unsigned short int triggerPositionPre, unsigned short int triggerPositionPost, unsigned char usedPre = 0, unsigned char usedPost = 0, unsigned char bufferSize = 0); | |
| 862 | - | |
| 863 | - unsigned short int getTriggerPositionPre(); | |
| 864 | - void setTriggerPositionPre(unsigned short int value); | |
| 865 | - unsigned short int getTriggerPositionPost(); | |
| 866 | - void setTriggerPositionPost(unsigned short int value); | |
| 867 | - unsigned char getUsedPre(); | |
| 868 | - void setUsedPre(unsigned char value); | |
| 869 | - unsigned char getUsedPost(); | |
| 870 | - void setUsedPost(unsigned char value); | |
| 871 | - unsigned char getBufferSize(); | |
| 872 | - void setBufferSize(unsigned char value); | |
| 873 | - | |
| 874 | - private: | |
| 875 | - void init(); | |
| 876 | - }; | |
| 877 | - | |
| 878 | - ////////////////////////////////////////////////////////////////////////////// | |
| 879 | - /// \class CommandSetTrigger5200 hantek/types.h | |
| 880 | - /// \brief The COMMAND_SETTRIGGER5200 builder. | |
| 881 | - class CommandSetTrigger5200 : public Helper::DataArray<unsigned char> { | |
| 882 | - public: | |
| 883 | - CommandSetTrigger5200(); | |
| 884 | - CommandSetTrigger5200(unsigned char triggerSource, unsigned char usedChannels, bool fastRate = false, unsigned char triggerSlope = 0, unsigned char triggerPulse = 0); | |
| 885 | - | |
| 886 | - unsigned char getTriggerSource(); | |
| 887 | - void setTriggerSource(unsigned char value); | |
| 888 | - unsigned char getUsedChannels(); | |
| 889 | - void setUsedChannels(unsigned char value); | |
| 890 | - bool getFastRate(); | |
| 891 | - void setFastRate(bool fastRate); | |
| 892 | - unsigned char getTriggerSlope(); | |
| 893 | - void setTriggerSlope(unsigned char slope); | |
| 894 | - bool getTriggerPulse(); | |
| 895 | - void setTriggerPulse(bool pulse); | |
| 896 | - | |
| 897 | - private: | |
| 898 | - void init(); | |
| 899 | - }; | |
| 900 | 912 | } |
| 901 | 913 | |
| 902 | 914 | ... | ... |