Skip to content

Instantly share code, notes, and snippets.

@attie

attie/build.py Secret

Last active October 4, 2020 22:05
Show Gist options
  • Save attie/3241b0ca5f14177559411298283c3899 to your computer and use it in GitHub Desktop.
Save attie/3241b0ca5f14177559411298283c3899 to your computer and use it in GitHub Desktop.
Glasgow I2S
def build(self, target, args):
self.mux_interface = iface = target.multiplexer.claim_interface(self, args)
iface.add_subtarget(AudioI2SCaptureSubtarget(
pads=iface.get_pads(args, pins=self.__pins),
in_fifo=iface.get_in_fifo(),
clk_edge=args.clk_edge,
mode=args.mode,
frame_size=args.frame_size,
))
frame_buf_len = 4
buf = []
if len(buf) < frame_buf_len:
await iface._in_tasks.wait_one()
if len(iface._in_buffer) > 0:
buf.extend(await iface.read())
if len(buf) < frame_buf_len:
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment