forked from PowerBroker2/DFPlayerMini_Fast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDFPlayerMini_Fast.h
More file actions
50 lines (40 loc) · 1.13 KB
/
DFPlayerMini_Fast.h
File metadata and controls
50 lines (40 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "Arduino.h"
#ifndef DFPlayerMini_Fast_cpp
#define DFPlayerMini_Fast_cpp
#define DFPLAYER_SEND_LENGTH 10
#define SB 0x7E //start byte
#define VER 0xFF //version
#define LEN 0x6 //number of bytes after "LEN" (except for checksum data and EB)
#define FEEDBACK 0 //no feedback requested
#define EB 0xEF //end byte
#define PLAY_COMMAND 0x03
#define VOLUME_COMMAND 0x06
#define EQ_COMMAND 0x07
#define RESUME_COMMAND 0x0D
#define PAUSE_COMMAND 0x0E
#define EQ_NORMAL 0
#define EQ_POP 1
#define EQ_ROCK 2
#define EQ_JAZZ 3
#define EQ_CLASSIC 4
#define EQ_Base 5
class DFPlayerMini_Fast
{
public:
Stream* _serial;
uint8_t _sending[DFPLAYER_SEND_LENGTH] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint8_t commandValue = 0;
uint8_t paramMSB = 0;
uint8_t paramLSB = 0;
uint8_t checksumMSB = 0;
uint8_t checksumLSB = 0;
void begin(Stream& stream);
void findChecksum();
void volume(uint8_t volume);
void play(uint16_t fileNum);
void EQSelect(uint8_t setting);
void pause();
void resume();
void sendData();
};
#endif