Skip to content

Instantly share code, notes, and snippets.

@boochow
Created October 28, 2018 12:07
Show Gist options
  • Save boochow/41f98b80636b42218d5b2d546de2d668 to your computer and use it in GitHub Desktop.
Save boochow/41f98b80636b42218d5b2d546de2d668 to your computer and use it in GitHub Desktop.
from mcu import mem32
from machine import Pin,Clock
# GPIO alternate functions
ALT0 = const(4)
def set_PCM_pin():
for pin in (18, 19, 20, 21):
reg = 0x20200000 + 4 * (pin // 10)
bit = (pin % 10) * 3
mem32[reg] = (mem32[reg] & ~(7 << bit)) | ALT0 << bit
Clock(Clock.PCM, source=Clock.OSC, divi=75, divf=0, mash=0, enable=1)
set_PCM_pin()
CS_A = const(0x20203000)
FIFO_A = const(0x20203004)
MODE_A = const(0x20203008)
TXC_A = const(0x20203010)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment