Skip to content

Commit

Permalink
Merge pull request #221 from mndza/flash-cs
Browse files Browse the repository at this point in the history
interface.flash: allow SPI buses without bidirectional chip select line
  • Loading branch information
miek authored Oct 11, 2023
2 parents ca18ec1 + 9fc4ffb commit 5e3463b
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions luna/gateware/interface/flash.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,16 @@ def elaborate(self, platform):
self.bus.sdi .eq(self.sdi),
self.sdo .eq(self.bus.sdo)
]

if self.use_cs:
m.d.comb += [
self.bus.cs.o.eq(self.cs),
self.bus.cs.oe.eq(1)
]
else:
m.d.comb += self.bus.cs.oe.eq(0)

if hasattr(self.bus.cs, "oe"):
if self.use_cs:
m.d.comb += [
self.bus.cs.o.eq(self.cs),
self.bus.cs.oe.eq(1)
]
else:
m.d.comb += self.bus.cs.oe.eq(0)
elif self.use_cs:
m.d.comb += self.bus.cs.eq(self.cs)

return m

0 comments on commit 5e3463b

Please sign in to comment.