Skip to content

Commit 1c4be61

Browse files
authored
Clean up examples (#14)
* Remove unused ArduinoLog dependency from platformio.ini * Add standard logging to the example * Clean up examples
1 parent 1a707b4 commit 1c4be61

File tree

5 files changed

+10
-91
lines changed

5 files changed

+10
-91
lines changed

examples/SimpleMp3Player/SimpleMp3Player.ino renamed to examples/Mp3PlayerDemo/Mp3PlayerDemo.ino

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
https://github.com/baldram/ESP_VS1053_Library
44
If you like this project, please add a star.
55
6-
Copyright (C) 2017 Marcin Szalomski (github.com/baldram)
6+
Copyright (C) 2018 Marcin Szalomski (github.com/baldram)
77
Licensed under GNU GPL v3
88
99
The circuit (example wiring for ESP8266 based board like eg. LoLin NodeMCU V3):
@@ -41,7 +41,7 @@
4141
#include <VS1053.h>
4242

4343
// Please find helloMp3.h file here:
44-
// github.com/baldram/ESP_VS1053_Library/blob/master/examples/SimpleMp3Player/helloMp3.h
44+
// github.com/baldram/ESP_VS1053_Library/blob/master/examples/Mp3PlayerDemo/helloMp3.h
4545
#include "helloMp3.h"
4646

4747
// Wiring of VS1053 board (SPI connected in a standard way)
@@ -54,16 +54,21 @@
5454
VS1053 player(VS1053_CS, VS1053_DCS, VS1053_DREQ);
5555

5656
void setup () {
57+
Serial.begin(115200);
58+
5759
// initialize SPI
5860
SPI.begin();
5961

62+
Serial.println("Hello VS1053!\n");
6063
// initialize a player
6164
player.begin();
6265
player.switchToMp3Mode(); // optional, some boards require this
6366
player.setVolume(VOLUME);
6467
}
6568

6669
void loop() {
70+
Serial.println("Playing sound... ");
71+
6772
// play mp3 flow each 3s
6873
player.playChunk(helloMp3, sizeof(helloMp3));
6974
delay(3000);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* https://github.com/baldram/ESP_VS1053_Library
44
* If you like this project, please add a star.
55
*
6-
* Copyright (C) 2017 Marcin Szalomski
6+
* Copyright (C) 2018 Marcin Szalomski
77
* Licensed under GNU GPL v3
88
*/
99
unsigned char helloMp3[] = {

examples/SimpleMp3PlayerWithDebug/SimpleMp3PlayerWithDebug.ino

Lines changed: 0 additions & 85 deletions
This file was deleted.

platformio.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,3 @@ framework = arduino
1717
platform = espressif32
1818
framework = espidf
1919
board = esp32dev
20-
21-
lib_deps =
22-
ArduinoLog

src/VS1053.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ void VS1053::stopSong() {
243243
}
244244

245245
void VS1053::softReset() {
246+
LOG("Performing soft-reset\n");
246247
write_register(SCI_MODE, _BV(SM_SDINEW) | _BV(SM_RESET));
247248
delay(10);
248249
await_data_request();
@@ -276,5 +277,6 @@ void VS1053::switchToMp3Mode() {
276277
wram_write(0xC017, 3); // GPIO DDR = 3
277278
wram_write(0xC019, 0); // GPIO ODATA = 0
278279
delay(100);
280+
LOG("Switched to mp3 mode\n");
279281
softReset();
280282
}

0 commit comments

Comments
 (0)