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: whitequark/glasgow
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: def497370abd
Choose a base ref
...
head repository: whitequark/glasgow
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f70d556fc1f4
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Feb 19, 2019

  1. Copy the full SHA
    b1b8af0 View commit details
  2. Copy the full SHA
    756808a View commit details
  3. Copy the full SHA
    f70d556 View commit details
Showing with 8 additions and 6 deletions.
  1. +2 −0 software/glasgow/access/direct/arguments.py
  2. +5 −5 software/glasgow/applet/audio_output/__init__.py
  3. +1 −1 software/glasgow/cli.py
2 changes: 2 additions & 0 deletions software/glasgow/access/direct/arguments.py
Original file line number Diff line number Diff line change
@@ -109,6 +109,8 @@ def add_pin_set_argument(self, parser, name, width, default=None, required=False
width = range(width, width + 1)
if default is True and len(self._free_pins) >= width.start:
default = ",".join([str(self._get_free(self._free_pins)) for _ in width])
if isinstance(default, int) and len(self._free_pins) >= default:
default = ",".join([str(self._get_free(self._free_pins)) for _ in range(default)])
self._add_pin_set_argument(parser, name, width, default, required)

def add_run_arguments(self, parser):
10 changes: 5 additions & 5 deletions software/glasgow/applet/audio_output/__init__.py
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ def __init__(self, pads, out_fifo, sample_cyc, width):
)
self.fsm.act("WAIT",
If(timer == 0,
NextValue(timer, sample_cyc - width - 1),
NextValue(timer, sample_cyc - len(channels) * width - 1),
NextState("CHANNEL-0-READ-1")
).Else(
NextValue(timer, timer - 1)
@@ -97,12 +97,12 @@ class AudioOutputApplet(GlasgowApplet, name="audio-output"):
Other formats may be converted to it using:
sox <input> -c <channels> -r <rate> <output>.<u8|u16>
$ sox <input> -c <channels> -r <rate> <output>.<u8|u16>
For example, to play an ogg file:
sox samples.ogg -c 2 -r 48000 samples.u16
glasgow run audio-output --pins-o 0,1 -r 48000 -w 2 samples.u16
$ sox samples.ogg -c 2 -r 48000 samples.u16
$ glasgow run audio-output --pins-o 0,1 -r 48000 -w 2 samples.u16
"""

__pin_sets = ("o",)
@@ -111,7 +111,7 @@ class AudioOutputApplet(GlasgowApplet, name="audio-output"):
def add_build_arguments(cls, parser, access):
super().add_build_arguments(parser, access)

access.add_pin_set_argument(parser, "o", width=range(1, 17), default=True)
access.add_pin_set_argument(parser, "o", width=range(1, 17), default=1)

parser.add_argument(
"-r", "--sample-rate", metavar="FREQ", type=int, default=8000,
2 changes: 1 addition & 1 deletion software/glasgow/cli.py
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ def filler(match):
return text

text = textwrap.dedent(text).strip()
return re.sub(r"((?!\n\n)(?!\n\s+(?:\*|\d+\.)).)+(\n*)?", filler, text, flags=re.S)
return re.sub(r"((?!\n\n)(?!\n\s+(?:\*|\$|\d+\.)).)+(\n*)?", filler, text, flags=re.S)


def create_argparser():