Last active
January 6, 2023 02:48
-
-
Save audionerd/564c7c7997b4ab836bc67723f9dc65d3 to your computer and use it in GitHub Desktop.
Playing Audio from the M5Stack RCA Module 13.2
This file contains 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
// M5Stack Core Basic + RCA Module 13.2 (PCM5102) | |
// based on https://github.com/m5stack/M5Stack/blob/b3e801f/examples/Unit/RCA/RCA.ino | |
#include <M5Unified.h> | |
void setup() { | |
auto cfg = M5.config(); | |
cfg.external_spk = true; | |
cfg.internal_spk = false; | |
M5.begin(); | |
auto spk_cfg = M5.Speaker.config(); | |
spk_cfg.i2s_port = I2S_NUM_1; | |
spk_cfg.sample_rate = 96000; | |
// via schematic at https://docs.m5stack.com/en/module/RCA%20Module%2013.2 | |
// LRCK 23 (G0/IIS_MK) | |
// DIN 24 (G15/IIS_OUT) | |
// BCK 21 (G13/IIS_WS) | |
spk_cfg.pin_data_out = 15; | |
spk_cfg.pin_bck = 13; | |
spk_cfg.pin_ws = 0; // LRCK | |
spk_cfg.stereo = true; | |
spk_cfg.buzzer = false; | |
spk_cfg.use_dac = false; | |
spk_cfg.magnification = 16; | |
M5.Speaker.config(spk_cfg); | |
M5.Speaker.begin(); | |
M5.Speaker.tone(661, 1000); //Set the speaker to tone at 661Hz for 1000ms | |
} | |
void loop() { | |
M5.update(); | |
delay(100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment