Skip to content

Commit 31f0092

Browse files
author
Jasper van Bourgognie
committed
Add digital waveform "Pulse"
1 parent e04fe80 commit 31f0092

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Devices/DummyScopeWaves.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public enum AnalogWaveForm { SINE, COSINE, SQUARE, SAWTOOTH, TRIANGLE, SAWTOOTH_
1111
HALF_BIG_HALF_UGLY
1212
#endif
1313
};
14-
public enum DigitalWaveForm { Counter, OneHot, Marquee };
14+
public enum DigitalWaveForm { Counter, OneHot, Marquee, Pulse };
1515

1616
partial class DummyScope
1717
{
@@ -224,6 +224,15 @@ public static byte[] WaveMarquee(int numberOfBits)
224224
counter[i] = (byte)((full >> (numberOfBits * 2 - i)) & mask);
225225
return counter;
226226
}
227+
228+
public static byte[] WavePulse(double dutyCycle)
229+
{
230+
byte[] pulse = new byte[100];
231+
int highUntilIndex = (int)Math.Floor (dutyCycle * pulse.Length);
232+
for (int i = 0; i < highUntilIndex; i++)
233+
pulse [i] = 0xff;
234+
return pulse;
235+
}
227236

228237
public bool Ready { get { return true; } }
229238

0 commit comments

Comments
 (0)