Created
October 28, 2018 12:07
-
-
Save boochow/41f98b80636b42218d5b2d546de2d668 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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