Commit 4081ecc90e860630583bd5b78210b789149a4fea
1 parent
77f4c7b5
More DSO-2250 fixes
Showing
5 changed files
with
101 additions
and
161 deletions
openhantek/ChangeLog
| ... | ... | @@ -169,3 +169,7 @@ |
| 169 | 169 | * Change back workaround for Mac OS that is most probably not required anymore |
| 170 | 170 | * Various performance improvements and small fixes |
| 171 | 171 | * New cppcheck build target |
| 172 | + | |
| 173 | +2012-10-28 Oliver Haag <oliver.haag@gmail.com> | |
| 174 | +* Bugfix: DSO-2250 support, thanks to Dmitry Kolyadintsev | |
| 175 | +* Bugfix: Remove invalid divider for large buffers | ... | ... |
openhantek/src/hantek/control.cpp
| ... | ... | @@ -53,6 +53,8 @@ namespace Hantek { |
| 53 | 53 | this->specification.command.values.offsetLimits = (ControlValue) -1; |
| 54 | 54 | this->specification.command.values.voltageLimits = (ControlValue) -1; |
| 55 | 55 | |
| 56 | + this->specification.recordLengths << 0; | |
| 57 | + | |
| 56 | 58 | this->specification.samplerate.single.base = 50e6; |
| 57 | 59 | this->specification.samplerate.single.max = 50e6; |
| 58 | 60 | this->specification.samplerate.multi.base = 100e6; |
| ... | ... | @@ -127,7 +129,7 @@ namespace Hantek { |
| 127 | 129 | } |
| 128 | 130 | |
| 129 | 131 | /// \brief Gets the physical channel count for this oscilloscope. |
| 130 | - /// \returns The number of physical channels. | |
| 132 | + /// \return The number of physical channels. | |
| 131 | 133 | unsigned int Control::getChannelCount() { |
| 132 | 134 | return HANTEK_CHANNELS; |
| 133 | 135 | } |
| ... | ... | @@ -295,11 +297,11 @@ namespace Hantek { |
| 295 | 297 | /// \brief Calculates the trigger point from the CommandGetCaptureState data. |
| 296 | 298 | /// \param value The data value that contains the trigger point. |
| 297 | 299 | /// \return The calculated trigger point for the given data. |
| 298 | - unsigned short int Control::calculateTriggerPoint(unsigned short int value) { | |
| 299 | - unsigned short int result = value; | |
| 300 | + unsigned long int Control::calculateTriggerPoint(unsigned long int value) { | |
| 301 | + unsigned long int result = value; | |
| 300 | 302 | |
| 301 | 303 | // Each set bit inverts all bits with a lower value |
| 302 | - for(unsigned short int bitValue = 1; bitValue; bitValue <<= 1) | |
| 304 | + for(unsigned long int bitValue = 1; bitValue; bitValue <<= 1) | |
| 303 | 305 | if(result & bitValue) |
| 304 | 306 | result ^= bitValue - 1; |
| 305 | 307 | |
| ... | ... | @@ -358,7 +360,7 @@ namespace Hantek { |
| 358 | 360 | this->samplesMutex.lock(); |
| 359 | 361 | |
| 360 | 362 | // Convert channel data |
| 361 | - if(this->settings.samplerate.limits == &this->specification.samplerate.single) { | |
| 363 | + if(this->settings.samplerate.limits == &this->specification.samplerate.multi) { | |
| 362 | 364 | // Fast rate mode, one channel is using all buffers |
| 363 | 365 | int channel = 0; |
| 364 | 366 | for(; channel < HANTEK_CHANNELS; ++channel) { |
| ... | ... | @@ -495,25 +497,20 @@ namespace Hantek { |
| 495 | 497 | if(this->specification.command.bulk.setPretrigger == BULK_FSETBUFFER) { |
| 496 | 498 | // Pointers to needed commands |
| 497 | 499 | BulkSetRecordLength2250 *commandSetRecordLength2250 = static_cast<BulkSetRecordLength2250 *>(this->command[BULK_DSETBUFFER]); |
| 498 | - BulkSetBuffer2250 *commandSetBuffer2250 = static_cast<BulkSetBuffer2250 *>(this->command[BULK_FSETBUFFER]); | |
| 499 | 500 | |
| 500 | 501 | commandSetRecordLength2250->setRecordLength(bestSizeId); |
| 501 | - commandSetBuffer2250->setUsedPre(FTRIGGERPOSITION_ON); | |
| 502 | - commandSetBuffer2250->setUsedPost(FTRIGGERPOSITION_ON); | |
| 503 | - commandSetBuffer2250->setLargeBuffer(bestSizeId == RECORDLENGTHID_LARGE); | |
| 504 | - commandSetBuffer2250->setSlowBuffer(bestSizeId != RECORDLENGTHID_SMALL); | |
| 505 | - | |
| 506 | - this->commandPending[BULK_DSETBUFFER] = true; | |
| 507 | - this->commandPending[BULK_FSETBUFFER] = true; | |
| 508 | 502 | } |
| 509 | 503 | else { |
| 510 | 504 | // SetBuffer5200 bulk command for record length |
| 511 | 505 | BulkSetBuffer5200 *commandSetBuffer5200 = static_cast<BulkSetBuffer5200 *>(this->command[BULK_DSETBUFFER]); |
| 506 | + | |
| 512 | 507 | commandSetBuffer5200->setUsedPre(DTRIGGERPOSITION_ON); |
| 513 | 508 | commandSetBuffer5200->setUsedPost(DTRIGGERPOSITION_ON); |
| 514 | 509 | commandSetBuffer5200->setRecordLength(bestSizeId); |
| 515 | - this->commandPending[BULK_DSETBUFFER] = true; | |
| 516 | 510 | } |
| 511 | + | |
| 512 | + this->commandPending[BULK_DSETBUFFER] = true; | |
| 513 | + | |
| 517 | 514 | break; |
| 518 | 515 | |
| 519 | 516 | default: |
| ... | ... | @@ -645,7 +642,7 @@ namespace Hantek { |
| 645 | 642 | this->specification.samplerate.single.max = 125e6; |
| 646 | 643 | this->specification.samplerate.multi.base = 200e6; |
| 647 | 644 | this->specification.samplerate.multi.max = 250e6; |
| 648 | - this->specification.bufferDividers << 1000 << 1 << 2; | |
| 645 | + this->specification.bufferDividers << 1000 << 1 << 1; | |
| 649 | 646 | this->specification.recordLengths << ULONG_MAX << 10240 << 14336; |
| 650 | 647 | this->specification.gainSteps |
| 651 | 648 | << 0.16 << 0.40 << 0.80 << 1.60 << 4.00 << 8.0 << 16.0 << 40.0 << 80.0; |
| ... | ... | @@ -659,11 +656,11 @@ namespace Hantek { |
| 659 | 656 | break; |
| 660 | 657 | |
| 661 | 658 | case MODEL_DSO2250: |
| 662 | - this->specification.samplerate.single.base = 200e6; | |
| 663 | - this->specification.samplerate.single.max = 125e6; | |
| 659 | + this->specification.samplerate.single.base = 100e6; | |
| 660 | + this->specification.samplerate.single.max = 100e6; | |
| 664 | 661 | this->specification.samplerate.multi.base = 200e6; |
| 665 | 662 | this->specification.samplerate.multi.max = 250e6; |
| 666 | - this->specification.bufferDividers << 1000 << 1 << 2; | |
| 663 | + this->specification.bufferDividers << 1000 << 1 << 1; | |
| 667 | 664 | this->specification.recordLengths << ULONG_MAX << 10240 << 524288; |
| 668 | 665 | this->specification.gainSteps |
| 669 | 666 | << 0.08 << 0.16 << 0.40 << 0.80 << 1.60 << 4.00 << 8.0 << 16.0 << 40.0; |
| ... | ... | @@ -671,7 +668,7 @@ namespace Hantek { |
| 671 | 668 | this->specification.voltageLimit[channel] |
| 672 | 669 | << 255 << 255 << 255 << 255 << 255 << 255 << 255 << 255 << 255; |
| 673 | 670 | this->specification.gainIndex |
| 674 | - << 0 << 1 << 2 << 0 << 1 << 2 << 0 << 1 << 2; | |
| 671 | + << 0 << 2 << 3 << 0 << 2 << 3 << 0 << 2 << 3; | |
| 675 | 672 | this->specification.sampleSize = 8; |
| 676 | 673 | break; |
| 677 | 674 | |
| ... | ... | @@ -680,7 +677,7 @@ namespace Hantek { |
| 680 | 677 | this->specification.samplerate.single.max = 75e6; |
| 681 | 678 | this->specification.samplerate.multi.base = 100e6; |
| 682 | 679 | this->specification.samplerate.multi.max = 150e6; |
| 683 | - this->specification.bufferDividers << 1000 << 1 << 2; | |
| 680 | + this->specification.bufferDividers << 1000 << 1 << 1; | |
| 684 | 681 | this->specification.recordLengths << ULONG_MAX << 10240 << 32768; |
| 685 | 682 | this->specification.gainSteps |
| 686 | 683 | << 0.08 << 0.16 << 0.40 << 0.80 << 1.60 << 4.00 << 8.0 << 16.0 << 40.0; |
| ... | ... | @@ -697,7 +694,7 @@ namespace Hantek { |
| 697 | 694 | this->specification.samplerate.single.max = 50e6; |
| 698 | 695 | this->specification.samplerate.multi.base = 100e6; |
| 699 | 696 | this->specification.samplerate.multi.max = 100e6; |
| 700 | - this->specification.bufferDividers << 1000 << 1 << 2; | |
| 697 | + this->specification.bufferDividers << 1000 << 1 << 1; | |
| 701 | 698 | this->specification.recordLengths << ULONG_MAX << 10240 << 32768; |
| 702 | 699 | this->specification.gainSteps |
| 703 | 700 | << 0.08 << 0.16 << 0.40 << 0.80 << 1.60 << 4.00 << 8.0 << 16.0 << 40.0; |
| ... | ... | @@ -732,8 +729,8 @@ namespace Hantek { |
| 732 | 729 | |
| 733 | 730 | this->updateRecordLength(size); |
| 734 | 731 | |
| 735 | - this->setPretriggerPosition(this->settings.trigger.position); | |
| 736 | 732 | this->setSamplerate(); |
| 733 | + this->setPretriggerPosition(this->settings.trigger.position); | |
| 737 | 734 | |
| 738 | 735 | return this->specification.recordLengths[this->settings.recordLengthId]; |
| 739 | 736 | } |
| ... | ... | @@ -774,7 +771,7 @@ namespace Hantek { |
| 774 | 771 | unsigned long int slowDownsampling = qMax(this->specification.samplerate.single.base / this->specification.bufferDividers[this->settings.recordLengthId] / samplerate, (long unsigned int) 1); |
| 775 | 772 | |
| 776 | 773 | // Use normal mode if we need valueSlow or it would meet the rate at least as exactly as fast rate mode |
| 777 | - if(this->settings.samplerate.downsampling > 4 || (qAbs((double) this->specification.samplerate.single.base / this->specification.bufferDividers[this->settings.recordLengthId] / slowDownsampling - samplerate) <= qAbs(this->settings.samplerate.current - samplerate))) { | |
| 774 | + if(this->settings.samplerate.downsampling > 4 || (qAbs((double) this->specification.samplerate.single.base / this->specification.bufferDividers[this->settings.recordLengthId] / slowDownsampling - samplerate) <= qAbs((double) this->settings.samplerate.current - samplerate))) { | |
| 778 | 775 | fastRate = false; |
| 779 | 776 | this->settings.samplerate.limits = &(this->specification.samplerate.single); |
| 780 | 777 | this->settings.samplerate.downsampling = slowDownsampling; |
| ... | ... | @@ -782,13 +779,13 @@ namespace Hantek { |
| 782 | 779 | } |
| 783 | 780 | } |
| 784 | 781 | |
| 785 | - // Split the resulting divider into the values understood by the device | |
| 786 | - // The fast value is kept at 4 (or 3) for slow sample rates | |
| 787 | - long int valueSlow = qMax(((long int) this->settings.samplerate.downsampling - 3) / 2, (long int) 0); | |
| 788 | - unsigned char valueFast = this->settings.samplerate.downsampling - valueSlow * 2; | |
| 789 | - | |
| 790 | 782 | switch(this->specification.command.bulk.setSamplerate) { |
| 791 | 783 | case BULK_SETTRIGGERANDSAMPLERATE: { |
| 784 | + // Split the resulting divider into the values understood by the device | |
| 785 | + // The fast value is kept at 4 (or 3) for slow sample rates | |
| 786 | + long int valueSlow = qMax(((long int) this->settings.samplerate.downsampling - 3) / 2, (long int) 0); | |
| 787 | + unsigned char valueFast = this->settings.samplerate.downsampling - valueSlow * 2; | |
| 788 | + | |
| 792 | 789 | // Pointers to needed commands |
| 793 | 790 | BulkSetTriggerAndSamplerate *commandSetTriggerAndSamplerate = static_cast<BulkSetTriggerAndSamplerate *>(this->command[BULK_SETTRIGGERANDSAMPLERATE]); |
| 794 | 791 | |
| ... | ... | @@ -804,6 +801,11 @@ namespace Hantek { |
| 804 | 801 | break; |
| 805 | 802 | } |
| 806 | 803 | case BULK_CSETTRIGGERORSAMPLERATE: { |
| 804 | + // Split the resulting divider into the values understood by the device | |
| 805 | + // The fast value is kept at 4 (or 3) for slow sample rates | |
| 806 | + long int valueSlow = qMax(((long int) this->settings.samplerate.downsampling - 3) / 2, (long int) 0); | |
| 807 | + unsigned char valueFast = this->settings.samplerate.downsampling - valueSlow * 2; | |
| 808 | + | |
| 807 | 809 | // Pointers to needed commands |
| 808 | 810 | BulkSetSamplerate5200 *commandSetSamplerate5200 = static_cast<BulkSetSamplerate5200 *>(this->command[BULK_CSETTRIGGERORSAMPLERATE]); |
| 809 | 811 | BulkSetTrigger5200 *commandSetTrigger5200 = static_cast<BulkSetTrigger5200 *>(this->command[BULK_ESETTRIGGERORSAMPLERATE]); |
| ... | ... | @@ -824,10 +826,11 @@ namespace Hantek { |
| 824 | 826 | // Pointers to needed commands |
| 825 | 827 | BulkSetSamplerate2250 *commandSetSamplerate2250 = static_cast<BulkSetSamplerate2250 *>(this->command[BULK_ESETTRIGGERORSAMPLERATE]); |
| 826 | 828 | |
| 827 | - // Store samplerate fast value | |
| 828 | - commandSetSamplerate2250->setSamplerateFast(4 - valueFast); | |
| 829 | - // Store samplerate slow value (two's complement) | |
| 830 | - commandSetSamplerate2250->setSamplerateSlow(valueSlow == 0 ? 0 : 0xffff - valueSlow); | |
| 829 | + bool downsampling = this->settings.samplerate.downsampling > 1; | |
| 830 | + // Store downsampler state value | |
| 831 | + commandSetSamplerate2250->setDownsampling(downsampling); | |
| 832 | + // Store samplerate value | |
| 833 | + commandSetSamplerate2250->setSamplerate(downsampling ? 0x10001 - this->settings.samplerate.downsampling : 0); | |
| 831 | 834 | // Set fast rate when used |
| 832 | 835 | commandSetSamplerate2250->setFastRate(fastRate); |
| 833 | 836 | |
| ... | ... | @@ -1024,29 +1027,22 @@ namespace Hantek { |
| 1024 | 1027 | if((!special && id >= HANTEK_CHANNELS) || (special && id >= HANTEK_SPECIAL_CHANNELS)) |
| 1025 | 1028 | return Dso::ERROR_PARAMETER; |
| 1026 | 1029 | |
| 1027 | - // Generate trigger source value that will be transmitted | |
| 1028 | - int sourceValue; | |
| 1029 | - if(special) | |
| 1030 | - sourceValue = TRIGGER_EXT + id; | |
| 1031 | - else | |
| 1032 | - sourceValue = TRIGGER_CH1 - id; | |
| 1033 | - | |
| 1034 | 1030 | switch(this->specification.command.bulk.setTrigger) { |
| 1035 | 1031 | case BULK_SETTRIGGERANDSAMPLERATE: |
| 1036 | 1032 | // SetTriggerAndSamplerate bulk command for trigger source |
| 1037 | - static_cast<BulkSetTriggerAndSamplerate *>(this->command[BULK_SETTRIGGERANDSAMPLERATE])->setTriggerSource(sourceValue); | |
| 1033 | + static_cast<BulkSetTriggerAndSamplerate *>(this->command[BULK_SETTRIGGERANDSAMPLERATE])->setTriggerSource(special ? 3 + id : 1 - id); | |
| 1038 | 1034 | this->commandPending[BULK_SETTRIGGERANDSAMPLERATE] = true; |
| 1039 | 1035 | break; |
| 1040 | 1036 | |
| 1041 | 1037 | case BULK_CSETTRIGGERORSAMPLERATE: |
| 1042 | 1038 | // SetTrigger2250 bulk command for trigger source |
| 1043 | - static_cast<BulkSetTrigger2250 *>(this->command[BULK_CSETTRIGGERORSAMPLERATE])->setTriggerSource(sourceValue); | |
| 1039 | + static_cast<BulkSetTrigger2250 *>(this->command[BULK_CSETTRIGGERORSAMPLERATE])->setTriggerSource(special ? 0 : 2 + id); | |
| 1044 | 1040 | this->commandPending[BULK_CSETTRIGGERORSAMPLERATE] = true; |
| 1045 | 1041 | break; |
| 1046 | - | |
| 1042 | + | |
| 1047 | 1043 | case BULK_ESETTRIGGERORSAMPLERATE: |
| 1048 | 1044 | // SetTrigger5200 bulk command for trigger source |
| 1049 | - static_cast<BulkSetTrigger5200 *>(this->command[BULK_ESETTRIGGERORSAMPLERATE])->setTriggerSource(sourceValue); | |
| 1045 | + static_cast<BulkSetTrigger5200 *>(this->command[BULK_ESETTRIGGERORSAMPLERATE])->setTriggerSource(special ? 3 + id : 1 - id); | |
| 1050 | 1046 | this->commandPending[BULK_ESETTRIGGERORSAMPLERATE] = true; |
| 1051 | 1047 | break; |
| 1052 | 1048 | |
| ... | ... | @@ -1164,7 +1160,7 @@ namespace Hantek { |
| 1164 | 1160 | // All trigger positions are measured in samples |
| 1165 | 1161 | unsigned long int positionSamples = position * this->settings.samplerate.current; |
| 1166 | 1162 | // Fast rate mode uses both channels |
| 1167 | - if(this->settings.samplerate.limits == &this->specification.samplerate.single) | |
| 1163 | + if(this->settings.samplerate.limits == &this->specification.samplerate.multi) | |
| 1168 | 1164 | positionSamples /= HANTEK_CHANNELS; |
| 1169 | 1165 | |
| 1170 | 1166 | switch(this->specification.command.bulk.setPretrigger) { |
| ... | ... | @@ -1179,9 +1175,9 @@ namespace Hantek { |
| 1179 | 1175 | break; |
| 1180 | 1176 | } |
| 1181 | 1177 | case BULK_FSETBUFFER: { |
| 1182 | - // Calculate the position values (Inverse, maximum is 0xffff) | |
| 1183 | - unsigned short int positionPre = 0xffff - this->specification.recordLengths[this->settings.recordLengthId] + positionSamples; | |
| 1184 | - unsigned short int positionPost = 0xffff - positionSamples; | |
| 1178 | + // Calculate the position values (Inverse, maximum is 0x7ffff) | |
| 1179 | + unsigned short int positionPre = 0x7ffff - this->specification.recordLengths[this->settings.recordLengthId] + positionSamples; | |
| 1180 | + unsigned short int positionPost = 0x7ffff - positionSamples; | |
| 1185 | 1181 | |
| 1186 | 1182 | // SetBuffer2250 bulk command for trigger position |
| 1187 | 1183 | BulkSetBuffer2250 *commandSetBuffer2250 = static_cast<BulkSetBuffer2250 *>(this->command[BULK_FSETBUFFER]); |
| ... | ... | @@ -1238,7 +1234,7 @@ namespace Hantek { |
| 1238 | 1234 | unsigned char commandCode = 0; |
| 1239 | 1235 | |
| 1240 | 1236 | // Read command code (First byte) |
| 1241 | - Helper::hexParse(data, &commandCode, 1); | |
| 1237 | + Helper::hexParse(commandParts[2], &commandCode, 1); | |
| 1242 | 1238 | if(commandCode > BULK_COUNT) |
| 1243 | 1239 | return Dso::ERROR_UNSUPPORTED; |
| 1244 | 1240 | |
| ... | ... | @@ -1248,8 +1244,10 @@ namespace Hantek { |
| 1248 | 1244 | return Dso::ERROR_NONE; |
| 1249 | 1245 | } |
| 1250 | 1246 | else if(commandParts[1] == "control") { |
| 1251 | - // Get control code from third part | |
| 1252 | - unsigned char controlCode = commandParts[2].toUShort(); | |
| 1247 | + unsigned char controlCode = 0; | |
| 1248 | + | |
| 1249 | + // Read command code (First byte) | |
| 1250 | + Helper::hexParse(commandParts[2], &controlCode, 1); | |
| 1253 | 1251 | int control; |
| 1254 | 1252 | for(control = 0; control < CONTROLINDEX_COUNT; ++control) { |
| 1255 | 1253 | if(this->controlCode[control] == controlCode) | ... | ... |
openhantek/src/hantek/control.h
| ... | ... | @@ -134,7 +134,7 @@ namespace Hantek { |
| 134 | 134 | struct ControlSettingsSamplerate { |
| 135 | 135 | ControlSamplerateLimits *limits; ///< The samplerate limits |
| 136 | 136 | unsigned long int downsampling; ///< The variable downsampling factor |
| 137 | - double current; ///< The current samplerate | |
| 137 | + unsigned long int current; ///< The current samplerate | |
| 138 | 138 | }; |
| 139 | 139 | |
| 140 | 140 | ////////////////////////////////////////////////////////////////////////////// |
| ... | ... | @@ -186,7 +186,7 @@ namespace Hantek { |
| 186 | 186 | protected: |
| 187 | 187 | void run(); |
| 188 | 188 | |
| 189 | - unsigned short int calculateTriggerPoint(unsigned short int value); | |
| 189 | + unsigned long int calculateTriggerPoint(unsigned long int value); | |
| 190 | 190 | int getCaptureState(); |
| 191 | 191 | int getSamples(bool process); |
| 192 | 192 | unsigned long int updateRecordLength(unsigned long int size); | ... | ... |
openhantek/src/hantek/types.cpp
| ... | ... | @@ -282,7 +282,7 @@ namespace Hantek { |
| 282 | 282 | /// \brief Gets the trigger point. |
| 283 | 283 | /// \return The trigger point for the captured samples. |
| 284 | 284 | unsigned int BulkResponseGetCaptureState::getTriggerPoint() { |
| 285 | - return this->array[2] | (this->array[3] << 8); | |
| 285 | + return this->array[2] | (this->array[3] << 8) | (this->array[1] << 16); | |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
| ... | ... | @@ -650,14 +650,14 @@ namespace Hantek { |
| 650 | 650 | |
| 651 | 651 | /// \brief Sets the data bytes to the specified values. |
| 652 | 652 | /// \param fastRate The fastRate state (ESamplerateBits). |
| 653 | - /// \param samplerateFast The SamplerateFast value (ESamplerateBits). | |
| 654 | - /// \param samplerateSlow The SamplerateSlow value. | |
| 655 | - BulkSetSamplerate2250::BulkSetSamplerate2250(bool fastRate, unsigned char samplerateFast, unsigned short int samplerateSlow) : Helper::DataArray<unsigned char>(8) { | |
| 653 | + /// \param downsampling The downsampling state (ESamplerateBits). | |
| 654 | + /// \param samplerate The Samplerate value. | |
| 655 | + BulkSetSamplerate2250::BulkSetSamplerate2250(bool fastRate, bool downsampling, unsigned short int samplerate) : Helper::DataArray<unsigned char>(8) { | |
| 656 | 656 | this->init(); |
| 657 | 657 | |
| 658 | 658 | this->setFastRate(fastRate); |
| 659 | - this->setSamplerateFast(samplerateFast); | |
| 660 | - this->setSamplerateSlow(samplerateSlow); | |
| 659 | + this->setDownsampling(downsampling); | |
| 660 | + this->setSamplerate(samplerate); | |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | /// \brief Get the fastRate state in ESamplerateBits. |
| ... | ... | @@ -672,27 +672,27 @@ namespace Hantek { |
| 672 | 672 | ((ESamplerateBits *) &(this->array[2]))->fastRate = fastRate ? 1 : 0; |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | - /// \brief Get the samplerateFast value in ESamplerateBits. | |
| 676 | - /// \return The samplerateFast value in ESamplerateBits. | |
| 677 | - unsigned char BulkSetSamplerate2250::getSamplerateFast() { | |
| 678 | - return ((ESamplerateBits *) &(this->array[2]))->samplerateFast; | |
| 675 | + /// \brief Get the downsampling state in ESamplerateBits. | |
| 676 | + /// \return The samplerateFast state. | |
| 677 | + bool BulkSetSamplerate2250::getDownsampling() { | |
| 678 | + return ((ESamplerateBits *) &(this->array[2]))->downsampling == 1; | |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | /// \brief Set the samplerateFast in ESamplerateBits to the given value. |
| 682 | 682 | /// \param value The new samplerateFast value. |
| 683 | - void BulkSetSamplerate2250::setSamplerateFast(unsigned char value) { | |
| 684 | - ((ESamplerateBits *) &(this->array[2]))->samplerateFast = value; | |
| 683 | + void BulkSetSamplerate2250::setDownsampling(bool downsampling) { | |
| 684 | + ((ESamplerateBits *) &(this->array[2]))->downsampling = downsampling ? 1 : 0; | |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | - /// \brief Get the SamplerateSlow value. | |
| 688 | - /// \return The SamplerateSlow value. | |
| 689 | - unsigned short int BulkSetSamplerate2250::getSamplerateSlow() { | |
| 687 | + /// \brief Get the Samplerate value. | |
| 688 | + /// \return The Samplerate value. | |
| 689 | + unsigned short int BulkSetSamplerate2250::getSamplerate() { | |
| 690 | 690 | return (unsigned short int) this->array[4] | ((unsigned short int) this->array[5] << 8); |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | - /// \brief Set the SamplerateSlow to the given value. | |
| 694 | - /// \param samplerate The new SamplerateSlow value. | |
| 695 | - void BulkSetSamplerate2250::setSamplerateSlow(unsigned short int samplerate) { | |
| 693 | + /// \brief Set the Samplerate to the given value. | |
| 694 | + /// \param samplerate The new Samplerate value. | |
| 695 | + void BulkSetSamplerate2250::setSamplerate(unsigned short int samplerate) { | |
| 696 | 696 | this->array[4] = (unsigned char) samplerate; |
| 697 | 697 | this->array[5] = (unsigned char) (samplerate >> 8); |
| 698 | 698 | } |
| ... | ... | @@ -804,93 +804,39 @@ namespace Hantek { |
| 804 | 804 | /// \brief Sets the data bytes to the specified values. |
| 805 | 805 | /// \param triggerPositionPre The TriggerPositionPre value. |
| 806 | 806 | /// \param triggerPositionPost The TriggerPositionPost value. |
| 807 | - /// \param usedPre The TriggerPositionUsedPre value. | |
| 808 | - /// \param usedPost The TriggerPositionUsedPost value. | |
| 809 | - /// \param largeBuffer The largeBuffer state. | |
| 810 | - /// \param slowBuffer The slowBuffer state. | |
| 811 | - BulkSetBuffer2250::BulkSetBuffer2250(unsigned short int triggerPositionPre, unsigned short int triggerPositionPost, unsigned char usedPre, unsigned char usedPost, bool largeBuffer, bool slowBuffer) : Helper::DataArray<unsigned char>(10) { | |
| 807 | + BulkSetBuffer2250::BulkSetBuffer2250(unsigned long int triggerPositionPre, unsigned long int triggerPositionPost) : Helper::DataArray<unsigned char>(12) { | |
| 812 | 808 | this->init(); |
| 813 | 809 | |
| 814 | 810 | this->setTriggerPositionPre(triggerPositionPre); |
| 815 | 811 | this->setTriggerPositionPost(triggerPositionPost); |
| 816 | - this->setUsedPre(usedPre); | |
| 817 | - this->setUsedPost(usedPost); | |
| 818 | - this->setLargeBuffer(largeBuffer); | |
| 819 | - this->setSlowBuffer(slowBuffer); | |
| 820 | - } | |
| 821 | - | |
| 822 | - /// \brief Get the TriggerPositionPre value. | |
| 823 | - /// \return The TriggerPositionPre value. | |
| 824 | - unsigned short int BulkSetBuffer2250::getTriggerPositionPre() { | |
| 825 | - return (unsigned short int) this->array[2] | ((unsigned short int) this->array[3] << 8); | |
| 826 | - } | |
| 827 | - | |
| 828 | - /// \brief Set the TriggerPositionPre to the given value. | |
| 829 | - /// \param position The new TriggerPositionPre value. | |
| 830 | - void BulkSetBuffer2250::setTriggerPositionPre(unsigned short int position) { | |
| 831 | - this->array[2] = (unsigned char) position; | |
| 832 | - this->array[3] = (unsigned char) (position >> 8); | |
| 833 | 812 | } |
| 834 | 813 | |
| 835 | 814 | /// \brief Get the TriggerPositionPost value. |
| 836 | 815 | /// \return The TriggerPositionPost value. |
| 837 | - unsigned short int BulkSetBuffer2250::getTriggerPositionPost() { | |
| 838 | - return (unsigned short int) this->array[6] | ((unsigned short int) this->array[7] << 8); | |
| 816 | + unsigned long int BulkSetBuffer2250::getTriggerPositionPost() { | |
| 817 | + return (unsigned long int) this->array[2] | ((unsigned long int) this->array[3] << 8) | ((unsigned long int) this->array[4] << 16); | |
| 839 | 818 | } |
| 840 | 819 | |
| 841 | 820 | /// \brief Set the TriggerPositionPost to the given value. |
| 842 | 821 | /// \param position The new TriggerPositionPost value. |
| 843 | - void BulkSetBuffer2250::setTriggerPositionPost(unsigned short int position) { | |
| 844 | - this->array[6] = (unsigned char) position; | |
| 845 | - this->array[7] = (unsigned char) (position >> 8); | |
| 846 | - } | |
| 847 | - | |
| 848 | - /// \brief Get the TriggerPositionUsedPre value. | |
| 849 | - /// \return The ::DTriggerPositionUsed value for the pre position. | |
| 850 | - unsigned char BulkSetBuffer2250::getUsedPre() { | |
| 851 | - return ((FBuffer1Bits *) &(this->array[4]))->triggerPositionUsed; | |
| 852 | - } | |
| 853 | - | |
| 854 | - /// \brief Set the TriggerPositionUsedPre to the given value. | |
| 855 | - /// \param value The new ::DTriggerPositionUsed value for the pre position. | |
| 856 | - void BulkSetBuffer2250::setUsedPre(unsigned char value) { | |
| 857 | - ((FBuffer1Bits *) &(this->array[4]))->triggerPositionUsed = value; | |
| 858 | - } | |
| 859 | - | |
| 860 | - /// \brief Get the TriggerPositionUsedPost value. | |
| 861 | - /// \return The ::DTriggerPositionUsed value for the post position. | |
| 862 | - unsigned char BulkSetBuffer2250::getUsedPost() { | |
| 863 | - return ((FBuffer1Bits *) &(this->array[8]))->triggerPositionUsed; | |
| 864 | - } | |
| 865 | - | |
| 866 | - /// \brief Set the TriggerPositionUsedPost to the given value. | |
| 867 | - /// \param value The new ::DTriggerPositionUsed value for the post position. | |
| 868 | - void BulkSetBuffer2250::setUsedPost(unsigned char value) { | |
| 869 | - ((FBuffer1Bits *) &(this->array[8]))->triggerPositionUsed = value; | |
| 870 | - } | |
| 871 | - | |
| 872 | - /// \brief Get the largeBuffer state in FBuffer1Bits. | |
| 873 | - /// \return The largeBuffer state. | |
| 874 | - bool BulkSetBuffer2250::getLargeBuffer() { | |
| 875 | - return ((FBuffer1Bits *) &(this->array[2]))->largeBuffer == 0; | |
| 876 | - } | |
| 877 | - | |
| 878 | - /// \brief Set the largeBuffer in FBuffer1Bits to the given state. | |
| 879 | - /// \param largeBuffer The new largeBuffer state. | |
| 880 | - void BulkSetBuffer2250::setLargeBuffer(bool largeBuffer) { | |
| 881 | - ((FBuffer1Bits *) &(this->array[2]))->largeBuffer = largeBuffer ? 0 : 1; | |
| 822 | + void BulkSetBuffer2250::setTriggerPositionPost(unsigned long int position) { | |
| 823 | + this->array[2] = (unsigned char) position; | |
| 824 | + this->array[3] = (unsigned char) (position >> 8); | |
| 825 | + this->array[4] = (unsigned char) (position >> 16); | |
| 882 | 826 | } |
| 883 | 827 | |
| 884 | - /// \brief Get the slowBuffer state in FBuffer2Bits. | |
| 885 | - /// \return The slowBuffer state. | |
| 886 | - bool BulkSetBuffer2250::getSlowBuffer() { | |
| 887 | - return ((FBuffer2Bits *) &(this->array[2]))->slowBuffer == 1; | |
| 828 | + /// \brief Get the TriggerPositionPre value. | |
| 829 | + /// \return The TriggerPositionPre value. | |
| 830 | + unsigned long int BulkSetBuffer2250::getTriggerPositionPre() { | |
| 831 | + return (unsigned long int) this->array[6] | ((unsigned short int) this->array[7] << 8) | ((unsigned short int) this->array[8] << 16); | |
| 888 | 832 | } |
| 889 | 833 | |
| 890 | - /// \brief Set the slowBuffer in FBuffer2Bits to the given state. | |
| 891 | - /// \param slowBuffer The new slowBuffer state. | |
| 892 | - void BulkSetBuffer2250::setSlowBuffer(bool slowBuffer) { | |
| 893 | - ((FBuffer2Bits *) &(this->array[2]))->slowBuffer = slowBuffer ? 1 : 0; | |
| 834 | + /// \brief Set the TriggerPositionPre to the given value. | |
| 835 | + /// \param position The new TriggerPositionPre value. | |
| 836 | + void BulkSetBuffer2250::setTriggerPositionPre(unsigned long int position) { | |
| 837 | + this->array[6] = (unsigned char) position; | |
| 838 | + this->array[7] = (unsigned char) (position >> 8); | |
| 839 | + this->array[8] = (unsigned char) (position >> 16); | |
| 894 | 840 | } |
| 895 | 841 | |
| 896 | 842 | /// \brief Initialize the array to the needed values. | ... | ... |
openhantek/src/hantek/types.h
| ... | ... | @@ -779,7 +779,7 @@ namespace Hantek { |
| 779 | 779 | /// \brief Samplerate bits for DSO-2250 0x0e command. |
| 780 | 780 | struct ESamplerateBits { |
| 781 | 781 | unsigned char fastRate:1; ///< false, if one channels uses all buffers |
| 782 | - unsigned char samplerateFast:3; ///< samplerate value for fast sampling rates | |
| 782 | + unsigned char downsampling:1; ///< true, if the downsampler is activated | |
| 783 | 783 | unsigned char reserved:4; ///< Unused bits |
| 784 | 784 | }; |
| 785 | 785 | |
| ... | ... | @@ -948,7 +948,7 @@ namespace Hantek { |
| 948 | 948 | |
| 949 | 949 | ////////////////////////////////////////////////////////////////////////////// |
| 950 | 950 | /// \class BulkSetFilter2250 hantek/types.h |
| 951 | - /// \brief The DSO-5200/DSO-5200A BULK_BSETFILTER builder. | |
| 951 | + /// \brief The DSO-2250 BULK_BSETFILTER builder. | |
| 952 | 952 | class BulkSetFilter2250 : public Helper::DataArray<unsigned char> { |
| 953 | 953 | public: |
| 954 | 954 | BulkSetFilter2250(); |
| ... | ... | @@ -1039,14 +1039,14 @@ namespace Hantek { |
| 1039 | 1039 | class BulkSetSamplerate2250 : public Helper::DataArray<unsigned char> { |
| 1040 | 1040 | public: |
| 1041 | 1041 | BulkSetSamplerate2250(); |
| 1042 | - BulkSetSamplerate2250(bool fastRate, unsigned char samplerateFast = 0, unsigned short int samplerateSlow = 0); | |
| 1042 | + BulkSetSamplerate2250(bool fastRate, bool downsampling = false, unsigned short int samplerate = 0); | |
| 1043 | 1043 | |
| 1044 | 1044 | bool getFastRate(); |
| 1045 | 1045 | void setFastRate(bool fastRate); |
| 1046 | - unsigned char getSamplerateFast(); | |
| 1047 | - void setSamplerateFast(unsigned char value); | |
| 1048 | - unsigned short int getSamplerateSlow(); | |
| 1049 | - void setSamplerateSlow(unsigned short int samplerate); | |
| 1046 | + bool getDownsampling(); | |
| 1047 | + void setDownsampling(bool downsampling); | |
| 1048 | + unsigned short int getSamplerate(); | |
| 1049 | + void setSamplerate(unsigned short int samplerate); | |
| 1050 | 1050 | |
| 1051 | 1051 | private: |
| 1052 | 1052 | void init(); |
| ... | ... | @@ -1081,20 +1081,12 @@ namespace Hantek { |
| 1081 | 1081 | class BulkSetBuffer2250 : public Helper::DataArray<unsigned char> { |
| 1082 | 1082 | public: |
| 1083 | 1083 | BulkSetBuffer2250(); |
| 1084 | - BulkSetBuffer2250(unsigned short int triggerPositionPre, unsigned short int triggerPositionPost, unsigned char usedPre = 0, unsigned char usedPost = 0, bool largeBuffer = false, bool slowBuffer = false); | |
| 1084 | + BulkSetBuffer2250(unsigned long int triggerPositionPre, unsigned long int triggerPositionPost); | |
| 1085 | 1085 | |
| 1086 | - unsigned short int getTriggerPositionPre(); | |
| 1087 | - void setTriggerPositionPre(unsigned short int value); | |
| 1088 | - unsigned short int getTriggerPositionPost(); | |
| 1089 | - void setTriggerPositionPost(unsigned short int value); | |
| 1090 | - unsigned char getUsedPre(); | |
| 1091 | - void setUsedPre(unsigned char value); | |
| 1092 | - unsigned char getUsedPost(); | |
| 1093 | - void setUsedPost(unsigned char value); | |
| 1094 | - bool getLargeBuffer(); | |
| 1095 | - void setLargeBuffer(bool largeBuffer); | |
| 1096 | - bool getSlowBuffer(); | |
| 1097 | - void setSlowBuffer(bool slowBuffer); | |
| 1086 | + unsigned long int getTriggerPositionPost(); | |
| 1087 | + void setTriggerPositionPost(unsigned long int value); | |
| 1088 | + unsigned long int getTriggerPositionPre(); | |
| 1089 | + void setTriggerPositionPre(unsigned long int value); | |
| 1098 | 1090 | |
| 1099 | 1091 | private: |
| 1100 | 1092 | void init(); | ... | ... |