From 648d38da7efa421c47919488607da9065a0c68a4 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Fri, 12 Nov 2021 11:43:28 +0100 Subject: [PATCH] quicklogic_quickfeather: add button and GPIOIn Signed-off-by: Gwenhael Goavec-Merou --- litex_boards/platforms/quicklogic_quickfeather.py | 9 ++++++--- litex_boards/targets/quicklogic_quickfeather.py | 12 ++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/litex_boards/platforms/quicklogic_quickfeather.py b/litex_boards/platforms/quicklogic_quickfeather.py index d0004a4..7d6e62f 100644 --- a/litex_boards/platforms/quicklogic_quickfeather.py +++ b/litex_boards/platforms/quicklogic_quickfeather.py @@ -11,9 +11,12 @@ from litex.build.quicklogic import QuickLogicPlatform _io = [ # Leds - ("user_led", 0, Pins("38"), IOStandard("LVCMOS33")), # blue - ("user_led", 1, Pins("39"), IOStandard("LVCMOS33")), # green - ("user_led", 2, Pins("34"), IOStandard("LVCMOS33")), # red + ("user_led", 0, Pins("38"), IOStandard("LVCMOS33")), # blue + ("user_led", 1, Pins("39"), IOStandard("LVCMOS33")), # green + ("user_led", 2, Pins("34"), IOStandard("LVCMOS33")), # red + + # Button + ("user_btn_n", 0, Pins("62"), IOStandard("LVCMOS33")), ] # Platform ----------------------------------------------------------------------------------------- diff --git a/litex_boards/targets/quicklogic_quickfeather.py b/litex_boards/targets/quicklogic_quickfeather.py index 0daf2ad..c57f83c 100755 --- a/litex_boards/targets/quicklogic_quickfeather.py +++ b/litex_boards/targets/quicklogic_quickfeather.py @@ -18,6 +18,7 @@ from litex.soc.cores.clock import * from litex.soc.integration.soc_core import * from litex.soc.integration.builder import * from litex.soc.cores.led import LedChaser +from litex.soc.cores.gpio import * # CRG ---------------------------------------------------------------------------------------------- @@ -44,7 +45,7 @@ class _CRG(Module): # BaseSoC ------------------------------------------------------------------------------------------ class BaseSoC(SoCCore): - def __init__(self, sys_clk_freq=int(10e6), with_led_chaser=True, **kwargs): + def __init__(self, sys_clk_freq=int(10e6), with_led_chaser=True, with_gpioin=True, **kwargs): platform = quicklogic_quickfeather.Platform() # SoCCore ---------------------------------------------------------------------------------- @@ -62,12 +63,19 @@ class BaseSoC(SoCCore): # CRG -------------------------------------------------------------------------------------- self.submodules.crg = _CRG(platform, is_eoss3_cpu) + # GPIOIn -> interrupt test + if with_gpioin: + self.submodules.gpio = GPIOIn( + pads = platform.request_all("user_btn_n"), with_irq=True) + self.add_csr("gpio") + self.irq.add("gpio", use_loc_if_exists=True) # Leds ------------------------------------------------------------------------------------- if with_led_chaser: self.submodules.leds = LedChaser( pads = platform.request_all("user_led"), sys_clk_freq = sys_clk_freq) - self.add_csr("leds") + if is_eoss3_cpu: + self.add_csr("leds") # Build --------------------------------------------------------------------------------------------