11 Commits
1.0.1 ... 1.0.2

Author SHA1 Message Date
jimaobian
beeba2c69d Update 2017-11-20 13:53:10 +08:00
jimaobian
cfb9428978 Merge pull request #6 from jandelgado/add_travis_ci_support
added support for travis ci
2017-11-20 13:46:35 +08:00
jimaobian
c36911d7b3 Merge pull request #5 from jandelgado/make_call_to_init_optional
Made the call to init() in DFRobotDFPlayerMini::begin() optional.
2017-11-20 13:39:01 +08:00
jimaobian
0cf620c20d Merge pull request #4 from jandelgado/adding_missing_return_statements
added missing "return" statements
2017-11-20 13:35:52 +08:00
Jan Delgado
7b5087e1af added support for travis ci 2017-06-13 20:01:49 +02:00
Jan Delgado
c0bd68111b added missing "return" statements 2017-06-13 19:08:52 +02:00
Jan Delgado
20343d62ed Made the call to init() in DFRobotDFPlayerMini::begin() optional.
Ratio: calling init() after the module is initially powered on is not necessary
and leads a) to an additional startup latency and b) (more annoying) to a loud
"plop" sound on the speaker output of the DFPlayerMini module.

By adding an optional parameter doReset to the begin() method, the user can now
decide, if the reset should be peformed.  Default is true, which is same
behaviour as now (i.e. perform reset()).
2017-06-13 19:05:51 +02:00
Angelo
31d5ec18d6 Fix compatible problem on nodeMCU (ESP8266)
add delay(0) to reset the soft wdt
2017-03-08 19:27:55 +08:00
jimaobian
6f4f402c71 Merge pull request #3 from redPanther/master
add function for query folder count + added datasheet
2017-03-08 17:34:23 +08:00
redpanther
c9f758979b add docs 2017-02-23 09:19:18 +01:00
redpanther
6111ae2018 add function to count folders on current device 2017-02-23 09:17:45 +01:00
6 changed files with 58 additions and 16 deletions

17
.travis.yml Normal file
View File

@@ -0,0 +1,17 @@
language: python
python:
- "2.7"
env:
- BOARD=uno
- BOARD=leonardo
- BOARD=esp01
install:
- python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
script:
- cd examples/FullFunction
- platformio ci -l ../.. FullFunction.ino --board=$BOARD
- cd ../GetStarted
- platformio ci -l ../.. getStarted.ino --board=$BOARD

View File

@@ -33,6 +33,7 @@ uint16_t DFRobotDFPlayerMini::calculateCheckSum(uint8_t *buffer){
void DFRobotDFPlayerMini::sendStack(){
if (_sending[Stack_ACK]) {
while (_isSending) {
delay(0);
available();
}
}
@@ -81,11 +82,13 @@ void DFRobotDFPlayerMini::disableACK(){
bool DFRobotDFPlayerMini::waitAvailable(){
_isSending = true;
while (!available());
while (!available()){
delay(0);
}
return _handleType != TimeOut;
}
bool DFRobotDFPlayerMini::begin(Stream &stream, bool isACK){
bool DFRobotDFPlayerMini::begin(Stream &stream, bool isACK, bool doReset){
if (isACK) {
enableACK();
}
@@ -94,11 +97,18 @@ bool DFRobotDFPlayerMini::begin(Stream &stream, bool isACK){
}
_serial = &stream;
_timeOutDuration += 3000;
reset();
waitAvailable();
_timeOutDuration -= 3000;
delay(200);
if (doReset) {
_timeOutDuration += 3000;
reset();
waitAvailable();
_timeOutDuration -= 3000;
delay(200);
} else {
// assume same state as with reset(): online
_handleType = DFPlayerCardOnline;
}
return (readType() == DFPlayerCardOnline) || !isACK;
}
@@ -123,6 +133,7 @@ bool DFRobotDFPlayerMini::handleMessage(uint8_t type, uint16_t parameter){
bool DFRobotDFPlayerMini::handleError(uint8_t type, uint16_t parameter){
handleMessage(type, parameter);
_isSending = false;
return false;
}
uint8_t DFRobotDFPlayerMini::readCommand(){
@@ -195,6 +206,7 @@ bool DFRobotDFPlayerMini::validateStack(){
bool DFRobotDFPlayerMini::available(){
while (_serial->available()) {
delay(0);
if (_receivedIndex == 0) {
_received[Stack_Header] = _serial->read();
#ifdef _DEBUG
@@ -394,7 +406,6 @@ int DFRobotDFPlayerMini::readVolume(){
uint8_t DFRobotDFPlayerMini::readEQ(){
sendStack(0x44);
while (!available());
if (waitAvailable()) {
return read();
}
@@ -458,12 +469,22 @@ int DFRobotDFPlayerMini::readFileCountsInFolder(int folderNumber){
}
}
int DFRobotDFPlayerMini::readFolderCounts(){
sendStack(0x4F);
if (waitAvailable()) {
return read();
}
else{
return -1;
}
}
int DFRobotDFPlayerMini::readFileCounts(){
readFileCounts(DFPLAYER_DEVICE_SD);
return readFileCounts(DFPLAYER_DEVICE_SD);
}
int DFRobotDFPlayerMini::readCurrentFileNumber(){
readCurrentFileNumber(DFPLAYER_DEVICE_SD);
return readCurrentFileNumber(DFPLAYER_DEVICE_SD);
}

View File

@@ -105,7 +105,7 @@ class DFRobotDFPlayerMini {
uint8_t readCommand();
bool begin(Stream& stream, bool isACK = true);
bool begin(Stream& stream, bool isACK = true, bool doReset = true);
bool waitAvailable();
@@ -186,6 +186,8 @@ class DFRobotDFPlayerMini {
int readFileCountsInFolder(int folderNumber);
int readFileCounts();
int readFolderCounts();
int readCurrentFileNumber();

Binary file not shown.

View File

@@ -1,11 +1,11 @@
/***************************************************
DFPlayer - A Mini MP3 Player For Arduino
<https://www.dfrobot.com/index.php?route=product/product&product_id=1121>
<https://www.dfrobot.com/index.php?route=product/product&search=mp3&description=true&product_id=1121>
***************************************************
This example shows the basic function of library for DFPlayer.
Created 2016-12-07
Created 2014-8-28
By [Angelo qiao](Angelo.qiao@dfrobot.com)
GNU Lesser General Public License.
@@ -15,7 +15,7 @@ DFPlayer - A Mini MP3 Player For Arduino
/***********Notice and Trouble shooting***************
1.Connection and Diagram can be found here
<https://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299#Connection_Diagram>
<>
2.This code is tested on Arduino Uno, Leonardo, Mega boards.
****************************************************/
@@ -40,7 +40,9 @@ void setup()
Serial.println(F("Unable to begin:"));
Serial.println(F("1.Please recheck the connection!"));
Serial.println(F("2.Please insert the SD card!"));
while(true);
while(true){
delay(0); // Code to compatible with ESP8266 watch dog.
}
}
Serial.println(F("DFPlayer Mini online."));

View File

@@ -1,5 +1,5 @@
name=DFRobotDFPlayerMini
version=1.0.1
version=1.0.2
author=DFRobot
maintainer=Angelo <angelo.qiao@dfrobot.com>
sentence=Driver for DFPlayer Mini from DFRobot