Skip to content

Commit 64343ef

Browse files
authored
Add files via upload
1 parent 83c2f51 commit 64343ef

2 files changed

Lines changed: 15 additions & 18 deletions

File tree

avdweb_scope.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Publ
1313
Version 1-1-2016
1414
Version 14-1-2016 sample0_us
1515
Version 10-2-2017 1, 2, 3, 4 channels
16-
Version 10-2-2017 sampleA sampleB sampleABC sampleABCD to avoid mistakes
17-
all unsigned int -> int
18-
added stop()
19-
sizeof(int)
20-
SerialUSB -> Serial (incl. <Albert.h>)
16+
Version 10-2-2017 sampleA sampleB sampleABC sampleABCD to avoid mistakes, all unsigned int -> int, added stop(), sizeof(int)
17+
SerialUSB -> Serial (incl. <Albert.h>), short
2118
2219
start ___|____________________________________|________
2320
@@ -44,7 +41,7 @@ void Scope::start(byte _channels, int _preSamples, unsigned int _recordLenght)
4441
stopPtr=32767;
4542
samplingOn=1;
4643
channels = _channels;
47-
recordLenght = maxBytes/(sizeof(int)*channels);
44+
recordLenght = maxBytes/(sizeof(short)*channels);
4845
if(_recordLenght <= recordLenght) recordLenght = _recordLenght;
4946
if(abs(_preSamples) <= recordLenght) preSamples = _preSamples;
5047
}
@@ -73,22 +70,22 @@ void Scope::show()
7370
stopPtr = 32767;
7471
}
7572

76-
void Scope::sampleA(int valueA) // 1 channel
73+
void Scope::sampleA(short valueA) // 1 channel
7774
{ if(samplingOn)
7875
{ ringBuffer.chA[ptr] = valueA;
7976
sampleControl();
8077
}
8178
}
8279

83-
void Scope::sampleAB(int valueA, int valueB) // 2 channels
80+
void Scope::sampleAB(short valueA, short valueB) // 2 channels
8481
{ if(samplingOn)
8582
{ ringBuffer.chAB[ptr][0] = valueA;
8683
ringBuffer.chAB[ptr][1] = valueB;
8784
sampleControl();
8885
}
8986
}
9087

91-
void Scope::sampleABC(int valueA, int valueB, int valueC) // 3 channels
88+
void Scope::sampleABC(short valueA, short valueB, short valueC) // 3 channels
9289
{ if(samplingOn)
9390
{ ringBuffer.chABC[ptr][0] = valueA;
9491
ringBuffer.chABC[ptr][1] = valueB;
@@ -97,7 +94,7 @@ void Scope::sampleABC(int valueA, int valueB, int valueC) // 3 channels
9794
}
9895
}
9996

100-
void Scope::sampleABCD(int valueA, int valueB, int valueC, int valueD) // 4 channels
97+
void Scope::sampleABCD(short valueA, short valueB, short valueC, short valueD) // 4 channels
10198
{ if(samplingOn)
10299
{ ringBuffer.chABCD[ptr][0] = valueA;
103100
ringBuffer.chABCD[ptr][1] = valueB;

avdweb_scope.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class Scope
2323
{
2424
public:
2525
void start(byte _channels, int _preSamples=0, unsigned int _recordLenght=65535);
26-
void sampleA(int valueA);
27-
void sampleAB(int valueA, int valueB);
28-
void sampleABC(int valueA, int valueB, int valueC);
29-
void sampleABCD(int valueA, int valueB, int valueC, int valueD);
26+
void sampleA(short valueA);
27+
void sampleAB(short valueA, short valueB);
28+
void sampleABC(short valueA, short valueB, short valueC);
29+
void sampleABCD(short valueA, short valueB, short valueC, short valueD);
3030
void trigger();
3131
void stop();
3232
void testBuffer();
@@ -36,10 +36,10 @@ class Scope
3636
unsigned int calcPtr(int ptr);
3737
void show();
3838

39-
union{int chA[maxBytes/2];
40-
int chAB[maxBytes/4][2];
41-
int chABC[maxBytes/3][3];
42-
int chABCD[maxBytes/8][4];} ringBuffer;
39+
union{short chA[maxBytes/2];
40+
short chAB[maxBytes/4][2];
41+
short chABC[maxBytes/3][3];
42+
short chABCD[maxBytes/8][4];} ringBuffer;
4343

4444
unsigned long sample0_us;
4545
bool triggered, samplingOn;

0 commit comments

Comments
 (0)