digilent_arty: Add buttons support.

This commit is contained in:
Florent Kermarrec 2022-08-05 15:25:42 +02:00
parent f143fae2d0
commit bf458e388e
1 changed files with 6 additions and 1 deletions

View File

@ -22,7 +22,7 @@ from litex.soc.integration.soc import SoCRegion
from litex.soc.integration.soc_core import * from litex.soc.integration.soc_core import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
from litex.soc.cores.led import LedChaser from litex.soc.cores.led import LedChaser
from litex.soc.cores.gpio import GPIOTristate from litex.soc.cores.gpio import GPIOIn, GPIOTristate
from litex.soc.cores.xadc import XADC from litex.soc.cores.xadc import XADC
from litex.soc.cores.dna import DNA from litex.soc.cores.dna import DNA
@ -78,6 +78,7 @@ class BaseSoC(SoCCore):
with_led_chaser = True, with_led_chaser = True,
with_jtagbone = True, with_jtagbone = True,
with_spi_flash = False, with_spi_flash = False,
with_buttons = True,
with_pmod_gpio = False, with_pmod_gpio = False,
**kwargs): **kwargs):
platform = digilent_arty.Platform(variant=variant, toolchain=toolchain) platform = digilent_arty.Platform(variant=variant, toolchain=toolchain)
@ -135,6 +136,10 @@ class BaseSoC(SoCCore):
sys_clk_freq = sys_clk_freq, sys_clk_freq = sys_clk_freq,
) )
# Buttons ----------------------------------------------------------------------------------
if with_buttons:
self.submodules.buttons = GPIOIn(pads=platform.request_all("user_btn"))
# GPIOs ------------------------------------------------------------------------------------ # GPIOs ------------------------------------------------------------------------------------
if with_pmod_gpio: if with_pmod_gpio:
platform.add_extension(digilent_arty.raw_pmod_io("pmoda")) platform.add_extension(digilent_arty.raw_pmod_io("pmoda"))