soc/cores/led: Split LED-SHIFT in LED-READ/LED-SHIFT, simplify and fix off by one error.
This commit is contained in:
parent
2c68135eb4
commit
8ac3fbc039
|
@ -165,11 +165,11 @@ class WS2812(Module):
|
|||
trst_timer.wait.eq(1),
|
||||
If(trst_timer.done,
|
||||
NextValue(led_count, 0),
|
||||
NextState("LED-SHIFT")
|
||||
NextState("LED-READ")
|
||||
)
|
||||
)
|
||||
if bus_mastering:
|
||||
fsm.act("LED-SHIFT",
|
||||
fsm.act("LED-READ",
|
||||
bus.stb.eq(1),
|
||||
bus.cyc.eq(1),
|
||||
bus.we.eq(0),
|
||||
|
@ -178,26 +178,16 @@ class WS2812(Module):
|
|||
If(bus.ack,
|
||||
NextValue(bit_count, 24-1),
|
||||
NextValue(led_data, bus.dat_r),
|
||||
NextValue(led_count, led_count + 1),
|
||||
If(led_count == (nleds-1),
|
||||
NextState("RST")
|
||||
).Else(
|
||||
NextState("BIT-TEST")
|
||||
)
|
||||
)
|
||||
)
|
||||
else:
|
||||
self.comb += port.adr.eq(led_count)
|
||||
fsm.act("LED-SHIFT",
|
||||
fsm.act("LED-READ",
|
||||
NextValue(bit_count, 24-1),
|
||||
NextValue(led_data, port.dat_r),
|
||||
NextValue(led_count, led_count + 1),
|
||||
If(led_count == (nleds-1),
|
||||
NextState("RST")
|
||||
).Else(
|
||||
NextState("BIT-TEST")
|
||||
)
|
||||
)
|
||||
|
||||
fsm.act("BIT-TEST",
|
||||
If(led_data[-1] == 0,
|
||||
|
@ -232,3 +222,11 @@ class WS2812(Module):
|
|||
NextState("BIT-TEST")
|
||||
)
|
||||
)
|
||||
fsm.act("LED-SHIFT",
|
||||
NextValue(led_count, led_count + 1),
|
||||
If(led_count == (nleds-1),
|
||||
NextState("RST")
|
||||
).Else(
|
||||
NextState("LED-READ")
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue