| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

Mp3

Page history last edited by David S 5 years, 2 months ago

Library Code

Download Mp3(4).zip. If you are not using a lab computer, unzip it into the Arduino "libraries" folder. It creates 2 examples under Mp3->Examples: Song and SineTest.

 

Documentation

The example files and library itself are generously commented, so they should be your go-to resource for further details.

 

Mp3 Application Interface Functions

 

General Public Functions

The following functions should be the most useful for a typical application interface.

 

  • decoder_initialize (void) - Initialize decoder with default mode, clock multiplier and volume
  • begin (unsigned char, unsigned char, unsigned char, unsigned char) - Register passed-in CS, DCS, RST and DREQ pins
  • volume (unsigned char) - Set decoder's output volume level, from min=0 to max=254
  • play (unsigned char *, unsigned int) - Transmit bytes to fill the decoder's input buffer
  • (unsigned int) avg_byte_rate (void) - Average song byte rate, updated once/sec, useful for determining remaining playtime
  • clear_buffer (void) - Clears out the decoder's buffer (already called as part of cancel_playback)
  • cancel_playback (void) - Stops playback of current song, useful for pause, rewind and fast-forward

 

Decoder Command and Data Control Functions

The following functions are available if you want to write routines that uses particular features of the decoder, such as a soft-reset button.

 

  • xmit_spi (char) - Transmit a byte to decoder via SPI
  • rcvr_spi (void) - Receive a byte from decoder via SPI
  • cmd_deselect (void) - Command deselect and release SPI bus
  • cmd_select (void) - Command chip select
  • data_deselect (void) - Data deselect and release SPI bus
  • data_select (void) - Data chip select
  • decoder_reset (void) - Hard reset the decoder
  • decoder_busy (void) - Data request is busy processing bytes
  • decoder_ready (void) - Data request is ready for more bytes

 

SPI Communication Functions

You shouldn't have much need for these, as they're called within the preceding set of command and control functions, but we made them public just in case.

 

  • void power_on (void) - Setup SPI and set pin directions
  • (unsigned int) sci_read (int) - Read SCI data
  • void sci_write (int, unsigned int) - Write SCI data

Comments (0)

You don't have permission to comment on this page.