File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -279,4 +279,15 @@ void VS1053::switchToMp3Mode() {
279279 delay (100 );
280280 LOG (" Switched to mp3 mode\n " );
281281 softReset ();
282- }
282+ }
283+
284+ /* *
285+ * A lightweight method to check if VS1053 is correctly wired up (power supply and connection to SPI interface).
286+ *
287+ * @return true if the chip is wired up correctly
288+ */
289+ bool VS1053::isChipConnected () {
290+ uint16_t status = read_register (SCI_STATUS);
291+
292+ return !(status == 0 || status == 0xFFFF );
293+ }
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ class VS1053 {
4747 const uint8_t vs1053_chunk_size = 32 ;
4848 // SCI Register
4949 const uint8_t SCI_MODE = 0x0 ;
50+ const uint8_t SCI_STATUS = 0x1 ;
5051 const uint8_t SCI_BASS = 0x2 ;
5152 const uint8_t SCI_CLOCKF = 0x3 ;
5253 const uint8_t SCI_AUDATA = 0x5 ;
@@ -132,6 +133,8 @@ class VS1053 {
132133 }
133134
134135 void switchToMp3Mode ();
136+
137+ bool isChipConnected ();
135138};
136139
137140#endif
You can’t perform that action at this time.
0 commit comments