modified for VS1033
Dependents: 11U68_MP3Player with TFTLCD 11U68_MP3Player-with-TFTLCD Mp3_1
Fork of VS1033 by
Revision 11:da08a7b0947d, committed 2015-07-30
- Comitter:
- nameless129
- Date:
- Thu Jul 30 06:52:54 2015 +0000
- Parent:
- 10:a8594af40a50
- Commit message:
- fix stop func
Changed in this revision
VS1053.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/VS1053.cpp Fri Jul 24 11:05:54 2015 +0000 +++ b/VS1053.cpp Thu Jul 30 06:52:54 2015 +0000 @@ -141,31 +141,15 @@ return sizeSent; } -/** Send cancel request to VS1053. - * @return Zero at failure, non-zero at success. - */ -bool VS1053::sendCancel() { - uint16_t reg; - - // Set SM_CANCEL bit - reg = readReg(SCI_MODE); - if (reg & 0x0008) { - // Abort if SM_CANCEL is still set - return false; - } - writeReg(SCI_MODE, reg | 0x0008); - return true; -} - /** Attempt a termination of playing. * Please call this repeatedly during data stream tramsission until it successes. * @return Zero at failure, non-zero at success. */ bool VS1053::stop() { - size_t n, length; + uint16_t n, length; - // Send 0 2056 times - length = 257; + // Send 0 2052 byte + length = 256; sdi_en(); while (length) { n = length < 32 ? length : 32; @@ -176,6 +160,10 @@ } } sdi_dis(); + + writeReg(SCI_MODE,( (SM_SDINEW)|(SM_RESET) ) ); + writeReg(SCI_CLOCKF, 0x9800); + // Check if both HDAT0 and HDAT1 are cleared return readReg(SCI_HDAT0) == 0x0000 && readReg(SCI_HDAT1) == 0x0000; }