periph.event: clear pending bits of level-triggered events.
authorJean-François Nguyen <jf@lambdaconcept.com>
Tue, 18 May 2021 17:11:39 +0000 (19:11 +0200)
committerJean-François Nguyen <jf@lambdaconcept.com>
Mon, 31 May 2021 17:58:30 +0000 (19:58 +0200)
lambdasoc/periph/event.py

index 53df4aae54d7990162487d6310d334e49345f70f..87b631fc230c840a67782f1edca2a96ed1f950ae 100644 (file)
@@ -127,8 +127,11 @@ class InterruptSource(Elaboratable):
             else:
                 assert False # :nocov:
 
-            with m.If(event_trigger):
-                m.d.sync += self.pending.r_data[i].eq(1)
+            if event.mode == "level":
+                m.d.sync += self.pending.r_data[i].eq(event_trigger)
+            else:
+                with m.If(event_trigger):
+                    m.d.sync += self.pending.r_data[i].eq(1)
 
         m.d.comb += self.irq.eq((self.pending.r_data & self.enable.r_data).any())