From 87f56a3355dfc6401a297b20383241d0cf63e17b Mon Sep 17 00:00:00 2001 From: Henri Date: Fri, 11 Nov 2022 18:04:41 +0100 Subject: [PATCH 1/5] Add I2S example for M5Core2 in readme --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 7894ad7b..cb432406 100644 --- a/README.md +++ b/README.md @@ -366,6 +366,24 @@ var pin5 = M5StickC.GpioController.OpenPin(36, PinMode.Output); The M5Core, M5Core2, Fire and Atom Lite/Matrix exposes 2 DAC and you can access them thru the `Dac1` and `Dac2` properties. Refer to the [DAC documentation](https://github.com/nanoframework/System.Device.Dac) for more information. +### I2S (sound) +On the M5Core2, wav files can be played using I2S by installing the package [nanoFramework.System.Device.I2s](https://github.com/nanoframework/System.Device.I2S). +To play wav files on the M5Core2, use following initialization: +```csharp + +int bckPin = 12; +int dataPin = 2; +int wsPin = 0; +I2sWavPlayer.Bus bus = I2sWavPlayer.Bus.One; +var audioFile = "D:\\Variation-CLJ013901.wav"; +using (var player = new I2sWavPlayer(bus, audioFile, bckPin, dataPin, wsPin)) +{ + M5Core2.Power.Gpio2Value = PinValue.High; //speaker power on + player.Play(); + M5Core2.Power.Gpio2Value = PinValue.Low; //speaker power off +} +``` + ### Led The M5StickC/CPlus exposes a led. You can access it thru the `Led` property: From 3f02b609590d5fe2598f44dc3debdd4c28f863b3 Mon Sep 17 00:00:00 2001 From: Henri Date: Sun, 20 Nov 2022 14:45:58 +0100 Subject: [PATCH 2/5] implemented remarks by reviewers --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cb432406..33665ec9 100644 --- a/README.md +++ b/README.md @@ -367,10 +367,11 @@ var pin5 = M5StickC.GpioController.OpenPin(36, PinMode.Output); The M5Core, M5Core2, Fire and Atom Lite/Matrix exposes 2 DAC and you can access them thru the `Dac1` and `Dac2` properties. Refer to the [DAC documentation](https://github.com/nanoframework/System.Device.Dac) for more information. ### I2S (sound) + On the M5Core2, wav files can be played using I2S by installing the package [nanoFramework.System.Device.I2s](https://github.com/nanoframework/System.Device.I2S). To play wav files on the M5Core2, use following initialization: -```csharp +```csharp int bckPin = 12; int dataPin = 2; int wsPin = 0; From 4b6f8ebdd37fa809cd7e87f2157446058ee757ca Mon Sep 17 00:00:00 2001 From: henrivw <56387068+henrivw@users.noreply.github.com> Date: Fri, 16 Dec 2022 16:01:54 +0100 Subject: [PATCH 3/5] Update README.md Co-authored-by: Laurent Ellerbach --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 33665ec9..c99f6591 100644 --- a/README.md +++ b/README.md @@ -368,6 +368,7 @@ The M5Core, M5Core2, Fire and Atom Lite/Matrix exposes 2 DAC and you can access ### I2S (sound) + On the M5Core2, wav files can be played using I2S by installing the package [nanoFramework.System.Device.I2s](https://github.com/nanoframework/System.Device.I2S). To play wav files on the M5Core2, use following initialization: From 79c55fe42a04e363c8467fbd722c24ea96deaff7 Mon Sep 17 00:00:00 2001 From: henrivw <56387068+henrivw@users.noreply.github.com> Date: Fri, 16 Dec 2022 16:03:01 +0100 Subject: [PATCH 4/5] Update README.md Co-authored-by: Laurent Ellerbach --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index c99f6591..82d6ae83 100644 --- a/README.md +++ b/README.md @@ -371,7 +371,6 @@ The M5Core, M5Core2, Fire and Atom Lite/Matrix exposes 2 DAC and you can access On the M5Core2, wav files can be played using I2S by installing the package [nanoFramework.System.Device.I2s](https://github.com/nanoframework/System.Device.I2S). To play wav files on the M5Core2, use following initialization: - ```csharp int bckPin = 12; int dataPin = 2; From 2ca9488fb20e79c6c6ec07687d065ebee9bcbea9 Mon Sep 17 00:00:00 2001 From: henrivw <56387068+henrivw@users.noreply.github.com> Date: Fri, 16 Dec 2022 16:03:29 +0100 Subject: [PATCH 5/5] Update README.md Co-authored-by: Laurent Ellerbach --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 82d6ae83..c99f6591 100644 --- a/README.md +++ b/README.md @@ -371,6 +371,7 @@ The M5Core, M5Core2, Fire and Atom Lite/Matrix exposes 2 DAC and you can access On the M5Core2, wav files can be played using I2S by installing the package [nanoFramework.System.Device.I2s](https://github.com/nanoframework/System.Device.I2S). To play wav files on the M5Core2, use following initialization: + ```csharp int bckPin = 12; int dataPin = 2;