Commit 616dae19 authored by Projects's avatar Projects

pulsegen: Emit at least the requested number of pulses when rounding

parent 4165734a
...@@ -118,7 +118,7 @@ class PulseGen: ...@@ -118,7 +118,7 @@ class PulseGen:
# deal with the limitation described above # deal with the limitation described above
# number of pulses in the arbitrary waveform # number of pulses in the arbitrary waveform
div = int(math.floor(count / self.MAX_PULSE_COUNT)) + 1 div = math.ceil(count / self.MAX_PULSE_COUNT)
period = 1.0 / freq period = 1.0 / freq
if width > period * 0.9: if width > period * 0.9:
...@@ -142,7 +142,7 @@ class PulseGen: ...@@ -142,7 +142,7 @@ class PulseGen:
# update all variables basing on the divider # update all variables basing on the divider
freq = freq / div freq = freq / div
count = int(count / div) count = math.ceil(count / div)
width = duty_cycle * period width = duty_cycle * period
# the actual number of pulses is rounded to the number of pulses in # the actual number of pulses is rounded to the number of pulses in
# the arbitrary waveform # the arbitrary waveform
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment