Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: i2c: add i2c master #2026

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions litex/soc/integration/soc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2049,6 +2049,18 @@ def add_etherbone(self, name="etherbone", phy=None, phy_cd="eth", data_width=8,
add_ip_address_constants(self, "REMOTEIP", ethmac_remote_ip)
add_mac_address_constants(self, "MACADDR", ethmac_address)

# Add I2C Master -------------------------------------------------------------------------------
def add_i2c_master(self, name="i2cmaster", pads=None, **kwargs):
# Imports.
from litei2c import LiteI2C

# Core.
self.check_if_exists(name)
if pads is None:
pads = self.platform.request(name)
i2c = LiteI2C(self.sys_clk_freq, pads=pads, **kwargs)
self.add_module(name=name, module=i2c)

# Add SPI Master --------------------------------------------------------------------------------
def add_spi_master(self, name="spimaster", pads=None, data_width=8, spi_clk_freq=1e6, with_clk_divider=True, **kwargs):
# Imports.
Expand Down
1 change: 1 addition & 0 deletions litex_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def __init__(self, url, clone="regular", develop=True, sha1=None, branch="master
"litescope": GitRepo(url="https://github.com/enjoy-digital/", tag=True),
"litejesd204b": GitRepo(url="https://github.com/enjoy-digital/", tag=True),
"litespi": GitRepo(url="https://github.com/litex-hub/", tag=True),
"litei2c": GitRepo(url="https://github.com/litex-hub/", tag=True, branch="main"),

# LiteX Misc Cores.
# -----------------
Expand Down
Loading