Skip to content

Commit

Permalink
docs: fix off-by-one error in gateware-blinky example
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinevg committed Jan 27, 2025
1 parent 7e49c39 commit 86597d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cynthion/python/examples/tutorials/gateware-blinky.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ def elaborate(self, platform):
leds: Signal(6) = Cat(platform.request("led", n).o for n in range(0, 6))

half_freq: int = int(60e6 // 2)
timer: Signal(25) = Signal(range(half_freq + 1))
timer: Signal(25) = Signal(range(half_freq))

with m.If(timer == half_freq):
with m.If(timer == half_freq - 1):
m.d.sync += leds.eq(~leds)
m.d.sync += timer.eq(0)

Expand Down
4 changes: 2 additions & 2 deletions docs/source/tutorials/gateware_blinky.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ Now that we have a state definition for our timer we can move forward to the imp
leds: Signal(6) = Cat(platform.request("led", n).o for n in range(0, 6))
half_freq: int = int(60e6 // 2)
timer: Signal(25) = Signal(range(half_freq + 1))
timer: Signal(25) = Signal(range(half_freq))
with m.If(timer == half_freq):
with m.If(timer == half_freq - 1):
m.d.sync += leds.eq(~leds)
m.d.sync += timer.eq(0)
Expand Down

0 comments on commit 86597d9

Please sign in to comment.