dfplayer_constants.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Marian Buschsieweke
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef DFPLAYER_CONSTANTS_H
20 #define DFPLAYER_CONSTANTS_H
21 
22 #include <stdint.h>
23 #include <periph/gpio.h>
24 #include <mutex.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
34 #define DFPLAYER_START (0x7e)
35 #define DFPLAYER_VERSION (0xff)
36 #define DFPLAYER_LEN (0x06)
37 #define DFPLAYER_NO_ACK (0x00)
38 #define DFPLAYER_ACK (0x01)
39 #define DFPLAYER_END (0xef)
46 #define DFPLAYER_BAUD (9600)
47 #define DFPLAYER_DATA_BITS (UART_DATA_BITS_8)
48 #define DFPLAYER_PARITY (UART_PARITY_NONE)
49 #define DFPLAYER_STOP_BITS (UART_STOP_BITS_1)
56 #define DFPLAYER_CMD_NEXT (0x01)
57 #define DFPLAYER_CMD_PREV (0x02)
58 #define DFPLAYER_CMD_VOLUME_INC (0x04)
59 #define DFPLAYER_CMD_VOLUME_DEC (0x05)
60 #define DFPLAYER_CMD_SET_VOLUME (0x06)
61 #define DFPLAYER_CMD_SET_EQUALIZER (0x07)
62 #define DFPLAYER_CMD_SET_SOURCE (0x09)
63 #define DFPLAYER_CMD_STANDBY_ENTER (0x0a)
64 #define DFPLAYER_CMD_STANDBY_EXIT (0x0b)
65 #define DFPLAYER_CMD_RESET (0x0c)
66 #define DFPLAYER_CMD_PLAY (0x0d)
67 #define DFPLAYER_CMD_PAUSE (0x0e)
68 #define DFPLAYER_CMD_FILE (0x0f)
69 #define DFPLAYER_CMD_PLAY_FROM_MP3 (0x12)
70 #define DFPLAYER_CMD_PLAY_ADVERT (0x13)
71 #define DFPLAYER_CMD_ABORT_ADVERT (0x15)
72 #define DFPLAYER_CMD_REPEAT_FOLDER (0x17)
73 #define DFPLAYER_CMD_RANDOM (0x18)
74 #define DFPLAYER_CMD_REPEAT (0x19)
75 #define DFPLAYER_CMD_GET_STATUS (0x42)
76 #define DFPLAYER_CMD_GET_VOLUME (0x43)
77 #define DFPLAYER_CMD_GET_EQUALIZER (0x44)
78 #define DFPLAYER_CMD_GET_MODE (0x45)
79 #define DFPLAYER_CMD_GET_VERSION (0x46)
80 #define DFPLAYER_CMD_FILES_USB (0x47)
81 #define DFPLAYER_CMD_FILES_SDCARD (0x48)
82 #define DFPLAYER_CMD_FILES_FLASH (0x49)
83 #define DFPLAYER_CMD_FILENO_USB (0x4b)
84 #define DFPLAYER_CMD_FILENO_SDCARD (0x4c)
85 #define DFPLAYER_CMD_FILENO_FLASH (0x4d)
92 #define DFPLAYER_CLASS_MASK (0xf0)
93 #define DFPLAYER_CLASS_NOTIFY (0x30)
94 #define DFPLAYER_CLASS_RESPONSE (0x40)
101 #define DFPLAYER_NOTIFY_INSERT (0x3a)
102 #define DFPLAYER_NOTIFY_EJECT (0x3b)
103 #define DFPLAYER_NOTIFY_DONE_USB (0x3c)
104 #define DFPLAYER_NOTIFY_DONE_SDCARD (0x3d)
105 #define DFPLAYER_NOTIFY_DONE_FLASH (0x3e)
113 #define DFPLAYER_NOTIFY_READY (0x3f)
120 #define DFPLAYER_MASK_USB (0x01)
121 #define DFPLAYER_MASK_SDCARD (0x02)
122 #define DFPLAYER_MASK_PC (0x04)
123 #define DFPLAYER_MASK_FLASH (0x08)
130 #define DFPLAYER_RESPONSE_ERROR (0x40)
131 #define DFPLAYER_RESPONSE_OK (0x41)
132 /* Beware: Handle every code of class response (0x4*) that does not indicate
133  * an error (0x40) as success */
140 #define DFPLAYER_ERROR_BUSY (0x00)
141 #define DFPLAYER_ERROR_FRAME (0x01)
142 #define DFPLAYER_ERROR_FCS (0x02)
150 #define DFPLAYER_ERROR_NO_SUCH_FILE (0x06)
157 #define DFPLAYER_DEVICE_USB (0x01)
158 #define DFPLAYER_DEVICE_SDCARD (0x02)
168 #define DFPLAYER_STATUS_PLAYING (0x01)
169 #define DFPLAYER_STATUS_PAUSE (0x02)
185 #define DFPLAYER_FLAG_NO_ACK_BUG (0x01)
188 #define DFPLAYER_BOOTUP_TIME_MS (3000)
189 #define DFPLAYER_TIMEOUT_MS (100)
190 #define DFPLAYER_SEND_DELAY_MS (100)
191 #ifndef DFPLAYER_RETRIES
192 #define DFPLAYER_RETRIES (5)
193 #endif /* DFPLAYER_RETRIES */
194 #define DFPLAYER_MAX_VOLUME (30)
195 #define DFPLAYER_MAX_FOLDER (99)
196 #define DFPLAYER_MAX_MP3_FILE (9999)
197 #define DFPLAYER_MAX_ADVERT_FILE (9999)
198 #define DFPLAYER_LOWEST_QUERY (0x40)
200 #ifdef __cplusplus
201 }
202 #endif
203 #endif /* DFPLAYER_CONSTANTS_H */
Low-level GPIO peripheral driver interface definitions.
Mutex for thread synchronization.