Skip to content

Commit 788fe2d

Browse files
committed
LyraT Mini Examples: sdmmc
1 parent 055e442 commit 788fe2d

File tree

5 files changed

+91
-3
lines changed

5 files changed

+91
-3
lines changed

examples/examples-custom-boards/lyrat-mini/buttons/buttons.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/**
2+
* @file buttons.ino
3+
* @author Phil Schatzmann
4+
* @brief Demo how to use the buttons.
5+
* @version 0.1
6+
* @date 2024-11-03
7+
*
8+
* The button values are determined with an analogRead().
9+
* This demo shows how to use the integrated AudioActions class via the AudioBoardStream
10+
*
11+
* @copyright Copyright (c) 2022
12+
*/
13+
114

215
#include "AudioTools.h"
316
#include "AudioTools/AudioLibs/AudioBoardStream.h"

examples/examples-custom-boards/lyrat-mini/mic/mic.ino

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11

22
/**
3+
* @file output.ino
4+
* @author Phil Schatzmann
5+
* @brief Demo how to use the microphone.
6+
* @version 0.1
7+
* @date 2024-11-03
8+
*
39
* The microphone seems to be attached to 2 different i2s ports. In addition to the
410
* ES8311, the ES7243 is also started.
511
* The I2S pins can be selected via cfg.i2s_function: CODEC uses the ES8311 I2S pins
612
* and CODEC_ADC uses the ES7243 I2S pins; By default the CODEC value is used.
713
*
814
* Only CODEC_ADC will give a proper microphone input!
15+
*
16+
* @copyright Copyright (c) 2022
917
*/
1018

19+
1120
#include "AudioTools.h"
1221
#include "AudioTools/AudioLibs/AudioBoardStream.h"
1322

examples/examples-custom-boards/lyrat-mini/output/output.ino

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
// Demo to output audio on a lyrat-mini board: with headphone detection active
2-
// to switch the power amplifier on and off
1+
/**
2+
* @file output.ino
3+
* @author Phil Schatzmann
4+
* @brief Demo to output audio on a lyrat-mini board: with headphone detection
5+
* active to switch the power amplifier on and off.
6+
* I2S is used and the ES8311 is initialized via the driver library.
7+
* @version 0.1
8+
* @date 2024-11-03
9+
*
10+
* @copyright Copyright (c) 2022
11+
*/
312

413
#include "AudioTools.h"
514
#include "AudioTools/AudioLibs/AudioBoardStream.h"

examples/examples-custom-boards/lyrat-mini/sd/sd.ino

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11

2-
// The following should work: but unforunately it does not work for me!
2+
/**
3+
* @file sd.ino
4+
* @author Phil Schatzmann
5+
* @brief Test/Demo that SD is not working!
6+
* @version 0.1
7+
* @date 2024-11-03
8+
*
9+
* @copyright Copyright (c) 2022
10+
*/
311

412
#include <SPI.h>
513
#include <SD.h>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* @file sdmmc.ino
3+
* @author Phil Schatzmann
4+
* @brief Test/Demo how to use the SD_MMC API in Arduino with the LyraT Mini
5+
* @version 0.1
6+
* @date 2024-11-03
7+
*
8+
* @copyright Copyright (c) 2022
9+
*/
10+
11+
#include "FS.h"
12+
#include "SD_MMC.h"
13+
14+
// These pins are defined in the HAL
15+
const int PIN_SD_CARD_POWER = 13;
16+
const int PIN_SD_CARD_DET = 34;
17+
18+
19+
// Arduino Setup
20+
void setup(void) {
21+
Serial.begin(115200);
22+
23+
// Mandatory: set power pin to low
24+
pinMode(PIN_SD_CARD_POWER, OUTPUT);
25+
digitalWrite(PIN_SD_CARD_POWER, LOW);
26+
27+
// Optionally: Determin if there is an SD card
28+
pinMode(PIN_SD_CARD_DET, INPUT);
29+
if (digitalRead(PIN_SD_CARD_DET)!=0){
30+
Serial.println("No SD Card detected");
31+
}
32+
33+
// open SDMMC in 1 bit mode
34+
if (!SD_MMC.begin("/sdcard", true)) {
35+
Serial.println("Card Mount Failed");
36+
while(true);
37+
}
38+
39+
auto file = SD_MMC.open("/test.mp3", FILE_READ);
40+
if (!file){
41+
Serial.println("file open failed");
42+
while(true);
43+
}
44+
45+
Serial.println("Success");
46+
}
47+
48+
// Arduino loop - repeated processing
49+
void loop() {}

0 commit comments

Comments
 (0)