adafruit / Adafruit_VS1053_Library

This is a Arduino library for the Adafruit VS1053 Codec Breakout and Music Maker Shields
https://www.adafruit.com/products/1381
133 stars 112 forks source link

Update to BusIO #82

Closed caternuson closed 1 year ago

caternuson commented 1 year ago

For #81. Updates SPI to use BusIO.

Hardware SPI tested and works on Feather M4 and Feather ESP32 V2 using feather_player example.

Software SPI is still essentially broken since this library's current usage of SD is hard coded for hardware SPI. SD management is also split between user sketch code and library code.

Also, interrupt playback appears to still be not working for ESP32. Even attaching the interrupt pin will cause the sketch to fail. This seems to be a combination of ESP32's WDT and the behavior of DREQ with current library code. DREQ can toggle for reasons other than "feed buffer" (ex: sci write), which causes eventual grief. For ESP32, these lines were commented out in the sketch:

//#if defined(__AVR_ATmega32U4__) 
//  // Timer interrupts are not suggested, better to use DREQ interrupt!
//  // but we don't have them on the 32u4 feather...
//  musicPlayer.useInterrupt(VS1053_FILEPLAYER_TIMER0_INT); // timer int
//#else
//  // If DREQ is on an interrupt pin we can do background
//  // audio playing
//  musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT);  // DREQ int
//#endif