The full library reference documentation can be access via the link below:
The information here is a brief overview of the main functions of interest.
Adafruit_VS1053_FilePlayer
The Adafruit_VS1053_FilePlayer
class is derived from the Adafruit_VS1053
class and provides high level functions for playing files stored on the VS1053 breakout SD Card reader. Use this class for easy access and playback of files stored on an SD card.
There are two general methods of playback:
- Non-interrupt / blocking playback via
playFullFile()
- Interrupt based / non-blocking playback via
startPlayingFile()
Public Methods:
Adafruit_VS1053_FilePlayer (int8_t mosi, int8_t miso, int8_t clk, int8_t rst, int8_t cs, int8_t dcs, int8_t dreq, int8_t cardCS) - Software SPI constructor. Uses Software SPI, so you must specify all SPI pins.
Adafruit_VS1053_FilePlayer (int8_t rst, int8_t cs, int8_t dcs, int8_t dreq, int8_t cardCS) - Hardware SPI constructor. Uses Hardware SPI and assumes the default SPI pins. This is what you'll likely use if you're using the shield.
boolean begin(void) - Initialize communication and reset the chip. Returns true if a VS1053 is found
boolean useInterrupt(uint8_t type) - Specifies the interrupt to use for interrupt-driven playback. Valid arguments are:
- VS1053_FILEPLAYER_TIMER0_INT
- VS1053_FILEPLAYER_PIN_INT
boolean startPlayingFile(char *trackname) - Begin playing the specified file from the SD card using interrupt-driven playback. This allows your program to perform other tasks as the file is playing.
boolean playFullFile(char *trackname) - Play the complete file. This function will not return until the playback is complete.
Public Member Variables:
File currentTrack - File currently being played
boolean playingMusic - True if playback in progress
Adafruit_VS1053
The Adafruit_VS1053
class implements an interface to the basic VS1053 functionality. For more detail on the operation of the VS1053 chip, please refer to the documentation on the Downloads page (see the link to the left). Its a little more powerful but it's also harder to use. We suggest sticking to the FilePlayer class (previous section) which abstracts a lot of this out for you.
public Methods:
Adafruit_VS1053(uint8_t mosi, uint8_t miso, uint8_t clk, uint8_t rst, uint8_t cs, uint8_t dcs, uint8_t dreq) - Software SPI constructor - must specify all pins.
Adafruit_VS1053(uint8_t rst, uint8_t cs, uint8_t dcs, uint8_t dreq) - Hardware SPI constructor - assumes hardware SPI pins.
uint8_t begin(void) - Initialize SPI communication and (hard) reset the chip.
void reset(void) - Performs a hard reset of the chip.
void softReset(void) - Attempts a soft reset of the chip.
uint16_t sciRead(uint8_t addr) - Reads from the specified register on the chip.
void sciWrite(uint8_t addr, uint16_t data) - Writes to the specified register on the chip.
void sineTest(uint8_t n, uint16_t ms) - Generate a sine-wave test signal.
void spiwrite(uint8_t d) - Low-level SPI write operation.
uint8_t spiread(void) - Low-level SPI read operation.
uint16_t decodeTime(void) - Reads the DECODETIME register from the chip.
void setVolume(uint8_t left, uint8_t right) - Set the output volume for the chip.
void dumpRegs(void) - Prints the contents of the MODE, STATUS, CLOCKF and VOLUME registers.
void playData(uint8_t *buffer, uint8_t buffsiz) - Decode and play the contents of the supplied buffer.
boolean readyForData(void) - Test if ready for more data.
void applyPatch(const uint16_t *patch, uint16_t patchsize) - Apply a code patch (See datasheet for details).
uint16_t loadPlugin(char *fn) - Load the specified plug-in.
void GPIO_digitalWrite(uint8_t i, uint8_t val) - Write to a GPIO pin.
void GPIO_digitalWrite(uint8_t i) - Write to all 8 GPIO pins at once.
uint16_t GPIO_digitalRead(void) - Read all 8 GPIO pins at once.
boolean GPIO_digitalRead(uint8_t i) - Read a single GPIO pin.
void GPIO_pinMode(uint8_t i, uint8_t dir) - Set the Pin Mode (INPUT/OUTPUT) for a GPIO pin.
boolean prepareRecordOgg(char *plugin) - Initialize chip for OGG recording.
void startRecordOgg(boolean mic) - Start recording (mic = true for microphone input).
void stopRecordOgg(void) - Stop the recording.
uint16_t recordedWordsWaiting(void) - Returns the number of words recorded.
uint16_t recordedReadWord(void) - Reads the next word from the buffer of recorded words.
uint16_t recordedReadWord(void) - Reads the next word from the buffer of recorded words.
Text editor powered by tinymce.