Skip to content

Commit 7700a4a

Browse files
committed
Dimm the green LED
1 parent 50c824a commit 7700a4a

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ $(PROJ).json: LighthouseTopLevel.v
1717
yosys -p 'read_verilog LighthouseTopLevel.v; read_verilog blackboxes.v; synth_ice40 -top LighthouseTopLevel; write_json $@'
1818

1919
%.asc: %.json $(PIN_DEF)
20-
nextpnr-ice40 --seed 19 --up5k --package sg48 --json $< --asc $@ --pcf $(PIN_DEF)
20+
nextpnr-ice40 --seed 4 --up5k --package sg48 --json $< --asc $@ --pcf $(PIN_DEF)
2121
python3 tools/update_bitstream_comment.py $@ "$(VERSION)"
2222

2323
%.bin: %.asc

src/main/scala/lighthouse/Lighthouse.scala

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,20 @@ class LighthouseTopLevel(nSensors: Int = 4,
269269
fastBlink := !fastBlink
270270
}
271271

272+
val ledDimming = RegInit(False)
273+
val ledCtr = Reg(UInt(4 bits))
274+
val ledDimmingTimer = Timeout(100000 Hz)
275+
when(ledDimmingTimer) {
276+
ledDimmingTimer.clear()
277+
ledCtr := ledCtr + 1
278+
ledDimming := ledCtr === 0
279+
}
280+
272281
val ledMux = Seq((0, False), (1, slowBlink), (2, fastBlink), (3, True))
273282

274283
io.led0 := !ledControl(0 to 1).muxListDc(ledMux)
275284
io.led1 := !ledControl(2 to 3).muxListDc(ledMux)
276-
io.led2 := !ledControl(4 to 5).muxListDc(ledMux)
285+
io.led2 := !(ledControl(4 to 5).muxListDc(ledMux) & ledDimming)
277286

278287
// Reset control
279288
val resetControl = commandHandler.io.resetCommand.toReg()
@@ -336,7 +345,7 @@ object TopLevelSim {
336345
dut.clkCtrl.coreClockDomain.waitRisingEdge(8)
337346
}
338347

339-
sleep((10*24000000) / 100)
348+
sleep((10*24000000) / 10)
340349

341350
simSuccess()
342351
}

0 commit comments

Comments
 (0)