Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a DIN pin to Audio::setPinout. #35

Merged
merged 1 commit into from
Apr 25, 2020

Conversation

CelliesProjects
Copy link
Contributor

Hi Wolle
This PR aims to add support for boards with I2S recording capability.

Currently I am testing it on a M5Stack Node.
Support for I2S_DIN is working.
These boards also need a MCLK signal on GPIO0.
That is not yet working in this PR.

Maybe you can shed some light on how to solve that.
I use this sketch to setup the board now:

// M5Stack Node pins https://github.com/m5stack/Bases-Node

#define I2C_SDA  21
#define I2C_SCL  22

/* M5Stack Node WM8978 pins */ 
//      codec pin    esp32 pin
#define I2S_BCK      5
#define I2S_WS      13
#define I2S_DOUT     2  
#define I2S_DIN     34   
#define I2S_MCLK     0

#include "Audio.h"
#include "WM8978.h"
#include "I2S.h"

Audio audio;

void setup() {
  WiFi.begin("xxx", "xxx");
  while (!WiFi.isConnected()) {
    delay(10);
  }
  ESP_LOGI(TAG, "Connected");

  //init wm8978 I2C interface
  wm8978Setup(I2C_SDA, I2C_SCL);

  //set clock on pin 0 - https://www.esp32.com/viewtopic.php?t=3060
  PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1);
  //REG_WRITE(PIN_CTRL, 0xFFFFFFF0);
  REG_WRITE(PIN_CTRL, 0);
  
  audio.setPinout(I2S_BCK, I2S_WS, I2S_DOUT, I2S_DIN);

  ESP_LOGI(TAG, "Starting MP3...\n");
  audio.connecttohost("http://icecast.omroep.nl/3fm-bb-mp3");
  
  WM8978_SPKvol_Set(40); /* max 63? */
  WM8978_HPvol_Set(32,32);  
}

void loop() {
  audio.loop();
  //delay(2);
}

@schreibfaul1 schreibfaul1 merged commit 470fd26 into schreibfaul1:master Apr 25, 2020
@schreibfaul1
Copy link
Owner

Thank you for this extension and the extended use of my library

@CelliesProjects CelliesProjects deleted the support_wm8978 branch June 16, 2020 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants