Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
dfplayer_constants.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2019 Marian Buschsieweke
3
* SPDX-License-Identifier: LGPL-2.1-only
4
*/
5
6
#pragma once
7
17
18
#include <stdint.h>
19
#include <
periph/gpio.h
>
20
#include <
mutex.h
>
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
30
#define DFPLAYER_START (0x7e)
31
#define DFPLAYER_VERSION (0xff)
32
#define DFPLAYER_LEN (0x06)
33
#define DFPLAYER_NO_ACK (0x00)
34
#define DFPLAYER_ACK (0x01)
35
#define DFPLAYER_END (0xef)
37
42
#define DFPLAYER_BAUD (9600)
43
#define DFPLAYER_DATA_BITS (UART_DATA_BITS_8)
44
#define DFPLAYER_PARITY (UART_PARITY_NONE)
45
#define DFPLAYER_STOP_BITS (UART_STOP_BITS_1)
47
52
#define DFPLAYER_CMD_NEXT (0x01)
53
#define DFPLAYER_CMD_PREV (0x02)
54
#define DFPLAYER_CMD_VOLUME_INC (0x04)
55
#define DFPLAYER_CMD_VOLUME_DEC (0x05)
56
#define DFPLAYER_CMD_SET_VOLUME (0x06)
57
#define DFPLAYER_CMD_SET_EQUALIZER (0x07)
58
#define DFPLAYER_CMD_SET_SOURCE (0x09)
59
#define DFPLAYER_CMD_STANDBY_ENTER (0x0a)
60
#define DFPLAYER_CMD_STANDBY_EXIT (0x0b)
61
#define DFPLAYER_CMD_RESET (0x0c)
62
#define DFPLAYER_CMD_PLAY (0x0d)
63
#define DFPLAYER_CMD_PAUSE (0x0e)
64
#define DFPLAYER_CMD_FILE (0x0f)
65
#define DFPLAYER_CMD_PLAY_FROM_MP3 (0x12)
66
#define DFPLAYER_CMD_PLAY_ADVERT (0x13)
67
#define DFPLAYER_CMD_ABORT_ADVERT (0x15)
68
#define DFPLAYER_CMD_REPEAT_FOLDER (0x17)
69
#define DFPLAYER_CMD_RANDOM (0x18)
70
#define DFPLAYER_CMD_REPEAT (0x19)
71
#define DFPLAYER_CMD_GET_STATUS (0x42)
72
#define DFPLAYER_CMD_GET_VOLUME (0x43)
73
#define DFPLAYER_CMD_GET_EQUALIZER (0x44)
74
#define DFPLAYER_CMD_GET_MODE (0x45)
75
#define DFPLAYER_CMD_GET_VERSION (0x46)
76
#define DFPLAYER_CMD_FILES_USB (0x47)
77
#define DFPLAYER_CMD_FILES_SDCARD (0x48)
78
#define DFPLAYER_CMD_FILES_FLASH (0x49)
79
#define DFPLAYER_CMD_FILENO_USB (0x4b)
80
#define DFPLAYER_CMD_FILENO_SDCARD (0x4c)
81
#define DFPLAYER_CMD_FILENO_FLASH (0x4d)
83
88
#define DFPLAYER_CLASS_MASK (0xf0)
89
#define DFPLAYER_CLASS_NOTIFY (0x30)
90
#define DFPLAYER_CLASS_RESPONSE (0x40)
92
97
#define DFPLAYER_NOTIFY_INSERT (0x3a)
98
#define DFPLAYER_NOTIFY_EJECT (0x3b)
99
#define DFPLAYER_NOTIFY_DONE_USB (0x3c)
100
#define DFPLAYER_NOTIFY_DONE_SDCARD (0x3d)
101
#define DFPLAYER_NOTIFY_DONE_FLASH (0x3e)
109
#define DFPLAYER_NOTIFY_READY (0x3f)
111
116
#define DFPLAYER_MASK_USB (0x01)
117
#define DFPLAYER_MASK_SDCARD (0x02)
118
#define DFPLAYER_MASK_PC (0x04)
119
#define DFPLAYER_MASK_FLASH (0x08)
121
126
#define DFPLAYER_RESPONSE_ERROR (0x40)
127
#define DFPLAYER_RESPONSE_OK (0x41)
128
/* Beware: Handle every code of class response (0x4*) that does not indicate
129
* an error (0x40) as success */
131
136
#define DFPLAYER_ERROR_BUSY (0x00)
137
#define DFPLAYER_ERROR_FRAME (0x01)
138
#define DFPLAYER_ERROR_FCS (0x02)
146
#define DFPLAYER_ERROR_NO_SUCH_FILE (0x06)
148
153
#define DFPLAYER_DEVICE_USB (0x01)
154
#define DFPLAYER_DEVICE_SDCARD (0x02)
156
164
#define DFPLAYER_STATUS_PLAYING (0x01)
165
#define DFPLAYER_STATUS_PAUSE (0x02)
167
181
#define DFPLAYER_FLAG_NO_ACK_BUG (0x01)
183
184
#define DFPLAYER_BOOTUP_TIME_MS (3000)
185
#define DFPLAYER_TIMEOUT_MS (100)
186
#define DFPLAYER_SEND_DELAY_MS (100)
187
#ifndef DFPLAYER_RETRIES
188
#define DFPLAYER_RETRIES (5)
189
#endif
/* DFPLAYER_RETRIES */
190
#define DFPLAYER_MAX_VOLUME (30)
191
#define DFPLAYER_MAX_FOLDER (99)
192
#define DFPLAYER_MAX_MP3_FILE (9999)
193
#define DFPLAYER_MAX_ADVERT_FILE (9999)
194
#define DFPLAYER_LOWEST_QUERY (0x40)
195
196
#ifdef __cplusplus
197
}
198
#endif
gpio.h
Low-level GPIO peripheral driver interface definitions.
mutex.h
Mutex for thread synchronization.
Generated on Wed Apr 15 2026 11:03:03 by
1.13.2