Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: GlasgowEmbedded/glasgow
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5a53dc1649a2
Choose a base ref
...
head repository: GlasgowEmbedded/glasgow
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d67503cf35ef
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Jan 13, 2020

  1. Copy the full SHA
    d67503c View commit details
Showing with 7 additions and 3 deletions.
  1. +7 −3 software/glasgow/applet/interface/i2c_initiator/__init__.py
10 changes: 7 additions & 3 deletions software/glasgow/applet/interface/i2c_initiator/__init__.py
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
import math
from nmigen.compat import *

from ....support.pyrepl import *
from ....gateware.pads import *
from ....gateware.i2c import I2CInitiator
from ... import *
@@ -259,9 +260,9 @@ async def scan(self, addresses=range(0b0001_000, 0b1111_000), *, read=True, writ

class I2CInitiatorApplet(GlasgowApplet, name="i2c-initiator"):
logger = logging.getLogger(__name__)
help = "initiate I2C transactions"
help = "initiate I²C transactions"
description = """
Initiate transactions on the I2C bus.
Initiate transactions on the I²C bus.
Maximum transaction length is 65535 bytes.
"""
@@ -327,7 +328,7 @@ def add_interact_arguments(cls, parser):
help="read device ID from devices responding to scan")

p_repl = p_operation.add_parser(
"repl", help="drop into Python shell; use `i2c_iface` to communicate")
"repl", help="drop into Python shell; use `iface` to communicate")

async def interact(self, device, args, i2c_iface):
if args.operation == "scan":
@@ -349,6 +350,9 @@ async def interact(self, device, args, i2c_iface):
self.logger.info("device %s ID: manufacturer %s, part %s, revision %s",
bin(addr), bin(manufacturer), bin(part_ident), bin(revision))

if args.operation == "repl":
await AsyncInteractiveConsole(locals={"iface":i2c_iface}).interact()

# -------------------------------------------------------------------------------------------------

class I2CInitiatorAppletTestCase(GlasgowAppletTestCase, applet=I2CInitiatorApplet):