Adafruit VS1053 Arduino Library
|
#include <Adafruit_VS1053.h>
Public Member Functions | |
Adafruit_VS1053 (int8_t mosi, int8_t miso, int8_t clk, int8_t rst, int8_t cs, int8_t dcs, int8_t dreq) | |
Software SPI constructor - must specify all pins. More... | |
Adafruit_VS1053 (int8_t rst, int8_t cs, int8_t dcs, int8_t dreq) | |
Hardware SPI constructor - assumes hardware SPI pins. More... | |
uint8_t | begin (void) |
Initialize communication and (hard) reset the chip. More... | |
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. More... | |
void | sciWrite (uint8_t addr, uint16_t data) |
Writes to the specified register on the chip. More... | |
void | sineTest (uint8_t n, uint16_t ms) |
Generate a sine-wave test signal. More... | |
uint16_t | decodeTime (void) |
Reads the DECODETIME register from the chip. More... | |
void | setVolume (uint8_t left, uint8_t right) |
Set the output volume for the chip. More... | |
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. More... | |
boolean | readyForData (void) |
Test if ready for more data. More... | |
void | applyPatch (const uint16_t *patch, uint16_t patchsize) |
Apply a code patch. More... | |
uint16_t | loadPlugin (char *fn) |
Load the specified plug-in. More... | |
void | GPIO_digitalWrite (uint8_t i, uint8_t val) |
Write to a GPIO pin. More... | |
void | GPIO_digitalWrite (uint8_t i) |
Write to all 8 GPIO pins at once. More... | |
uint16_t | GPIO_digitalRead (void) |
Read all 8 GPIO pins at once. More... | |
boolean | GPIO_digitalRead (uint8_t i) |
Read a single GPIO pin. More... | |
void | GPIO_pinMode (uint8_t i, uint8_t dir) |
Set the Pin Mode (INPUT/OUTPUT) for a GPIO pin. More... | |
boolean | prepareRecordOgg (char *plugin) |
Initialize chip for OGG recording. More... | |
void | startRecordOgg (boolean mic) |
Start recording. More... | |
void | stopRecordOgg (void) |
Stop the recording. | |
uint16_t | recordedWordsWaiting (void) |
Returns the number of words recorded. More... | |
uint16_t | recordedReadWord (void) |
Reads the next word from the buffer of recorded words. More... | |
Public Attributes | |
uint8_t | mp3buffer [VS1053_DATABUFFERLEN] |
Protected Attributes | |
uint8_t | _dreq |
Data request pin. | |
boolean | usingInterrupts = false |
True if using interrupts. | |
Driver for the Adafruit VS1053
Adafruit_VS1053::Adafruit_VS1053 | ( | int8_t | mosi, |
int8_t | miso, | ||
int8_t | clk, | ||
int8_t | rst, | ||
int8_t | cs, | ||
int8_t | dcs, | ||
int8_t | dreq | ||
) |
Software SPI constructor - must specify all pins.
mosi | MOSI (Microcontroller Out Serial In) pin |
miso | MISO (Microcontroller In Serial Out) pin |
clk | Clock pin |
rst | Reset pin |
cs | SCI Chip Select pin |
dcs | SDI Chip Select pin |
dreq | Data Request pin |
Adafruit_VS1053::Adafruit_VS1053 | ( | int8_t | rst, |
int8_t | cs, | ||
int8_t | dcs, | ||
int8_t | dreq | ||
) |
Hardware SPI constructor - assumes hardware SPI pins.
rst | Reset pin |
cs | SCI Chip Select pin |
dcs | SDI Chip Select pin |
dreq | Data Request pin |
uint8_t Adafruit_VS1053::begin | ( | void | ) |
Initialize communication and (hard) reset the chip.
uint16_t Adafruit_VS1053::sciRead | ( | uint8_t | addr | ) |
Reads from the specified register on the chip.
addr | Register address to read from |
void Adafruit_VS1053::sciWrite | ( | uint8_t | addr, |
uint16_t | data | ||
) |
Writes to the specified register on the chip.
addr | Register address to write to |
data | Data to write |
void Adafruit_VS1053::sineTest | ( | uint8_t | n, |
uint16_t | ms | ||
) |
Generate a sine-wave test signal.
n | Defines the sine test to use |
ms | Delay (in ms) |
uint16_t Adafruit_VS1053::decodeTime | ( | void | ) |
Reads the DECODETIME register from the chip.
void Adafruit_VS1053::setVolume | ( | uint8_t | left, |
uint8_t | right | ||
) |
Set the output volume for the chip.
left | Desired left channel volume |
right | Desired right channel volume |
void Adafruit_VS1053::playData | ( | uint8_t * | buffer, |
uint8_t | buffsiz | ||
) |
Decode and play the contents of the supplied buffer.
buffer | Buffer to decode and play |
buffsiz | Size to decode and play |
boolean Adafruit_VS1053::readyForData | ( | void | ) |
Test if ready for more data.
void Adafruit_VS1053::applyPatch | ( | const uint16_t * | patch, |
uint16_t | patchsize | ||
) |
Apply a code patch.
patch | Patch to apply |
patchsize | Patch size |
uint16_t Adafruit_VS1053::loadPlugin | ( | char * | fn | ) |
Load the specified plug-in.
fn | Plug-in to load |
void Adafruit_VS1053::GPIO_digitalWrite | ( | uint8_t | i, |
uint8_t | val | ||
) |
Write to a GPIO pin.
i | GPIO pin to write to |
val | Value to write |
void Adafruit_VS1053::GPIO_digitalWrite | ( | uint8_t | i | ) |
Write to all 8 GPIO pins at once.
i | Value to write |
uint16_t Adafruit_VS1053::GPIO_digitalRead | ( | void | ) |
Read all 8 GPIO pins at once.
boolean Adafruit_VS1053::GPIO_digitalRead | ( | uint8_t | i | ) |
Read a single GPIO pin.
i | pin to read |
void Adafruit_VS1053::GPIO_pinMode | ( | uint8_t | i, |
uint8_t | dir | ||
) |
Set the Pin Mode (INPUT/OUTPUT) for a GPIO pin.
i | Pin to set the mode for |
dir | Mode to set |
boolean Adafruit_VS1053::prepareRecordOgg | ( | char * | plugin | ) |
Initialize chip for OGG recording.
plugin | Binary file of the plugin to use |
void Adafruit_VS1053::startRecordOgg | ( | boolean | mic | ) |
Start recording.
mic | mic=true for microphone input |
uint16_t Adafruit_VS1053::recordedWordsWaiting | ( | void | ) |
Returns the number of words recorded.
uint16_t Adafruit_VS1053::recordedReadWord | ( | void | ) |
Reads the next word from the buffer of recorded words.
uint8_t Adafruit_VS1053::mp3buffer[VS1053_DATABUFFERLEN] |
mp3 buffer that gets sent to the device