Loading...
Searching...
No Matches
dfplayer_types.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_TYPES_H
20#define DFPLAYER_TYPES_H
21
22#include <stdbool.h>
23#include <stdint.h>
24
25#include "mutex.h"
26#include "periph/gpio.h"
27#include "periph/uart.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
43
56
68
80
90
99
103typedef uint8_t dfplayer_source_set_t;
104
108typedef struct dfplayer dfplayer_t;
109
120 uint16_t track);
121
131
135typedef struct {
137 gpio_t busy_pin;
138 uint8_t volume;
140
169typedef struct {
170 union {
171 uint16_t number;
172 struct {
173 uint8_t folder;
174 uint8_t file;
175 };
176 };
179
198
199#ifdef __cplusplus
200}
201#endif
202
203#endif /* DFPLAYER_TYPES_H */
dfplayer_mode_t
Enumeration of the playback modes supported by the DFPlayer.
@ DFPLAYER_MODE_REPEAT
Repeating a single file.
@ DFPLAYER_MODE_REPEAT_DIR
Repeating a directory.
@ DFPLAYER_MODE_NUMOF
Number of supported playback modes.
@ DFPLAYER_MODE_NORMAL
Normal playback.
@ DFPLAYER_MODE_UNKOWN
No idea, the data sheet is vague.
@ DFPLAYER_MODE_RANDOM
Playing all files in random order.
dfplayer_scheme_t
Enumeration of the different naming schemes.
@ DFPLAYER_SCHEME_FOLDER_FILE
Naming scheme <folder>/<file>
@ DFPLAYER_SCHEME_NUMOF
Number of naming schemes supported.
@ DFPLAYER_SCHEME_MP3_FILE
Naming scheme MP3/<number>
dfplayer_source_t
Enumeration of the different sources for playback supported.
@ DFPLAYER_SOURCE_NUMOF
Number of supported playback modes.
@ DFPLAYER_SOURCE_SDCARD
Read files from SD card.
@ DFPLAYER_SOURCE_FLASH
Read files from NOR flash.
@ DFPLAYER_SOURCE_AUX
No idea, the data sheet never mentions AUX again.
@ DFPLAYER_SOURCE_SLEEP
No idea, the data sheet is extremely vague on this.
@ DFPLAYER_SOURCE_USB
Read files from USB storage.
dfplayer_rx_state_t
Enumeration of the RX states of the DFPlayer driver.
@ DFPLAYER_RX_STATE_DATA
Receiving data.
@ DFPLAYER_RX_STATE_VERSION
Waiting for version (0xff)
@ DFPLAYER_RX_STATE_LENGTH
Waiting for length (0x06)
@ DFPLAYER_RX_STATE_START
Waiting for start symbol (0x7e)
@ DFPLAYER_RX_STATE_NUMOF
Number of RX states.
uint8_t dfplayer_source_set_t
Set of DFPlayer playback sources.
dfplayer_eq_t
Enumeration of the equalizer settings supported by the DFPlayer.
@ DFPLAYER_EQ_NUMOF
Number of supported equalizer settings.
@ DFPLAYER_EQ_CLASSIC
The "Classic" equalizer setting.
@ DFPLAYER_EQ_NORMAL
The "Normal" equalizer setting.
@ DFPLAYER_EQ_BASE
The "Base" equalizer setting.
@ DFPLAYER_EQ_ROCK
The "Rock" equalizer setting.
@ DFPLAYER_EQ_JAZZ
The "Jazz" equalizer setting.
@ DFPLAYER_EQ_POP
The "Pop" equalizer setting.
void(* dfplayer_cb_src_t)(dfplayer_t *dev, dfplayer_source_set_t srcs)
Signature of the function called when a medium was inserted/ejected.
void(* dfplayer_cb_done_t)(dfplayer_t *dev, dfplayer_source_t src, uint16_t track)
Signature of the function called when a playback of track completed.
dfplayer_state_t
Enumeration of the detectable states of the DFPlayer.
@ DFPLAYER_STATE_PAUSED
Playback is paused, can be resumed.
@ DFPLAYER_STATE_PLAYING
Currently playing a file.
@ DFPLAYER_STATE_STOPPED
No file playing.
@ DFPLAYER_STATE_NUMOF
Number of DFPlayer states supported by the driver.
Low-level GPIO peripheral driver interface definitions.
Low-level UART peripheral driver interface definition.
uint_fast8_t uart_t
Define default UART type identifier.
Definition uart.h:85
Mutex for thread synchronization.
Data structure representing a file on the DFPlayer.
uint8_t file
Name of the file (naming scheme "42/123.mp3")
uint8_t folder
Folder of the file (naming scheme "42/123.mp3")
dfplayer_scheme_t scheme
Used naming scheme.
uint16_t number
Number of the file (naming scheme "MP3/1337.mp3")
Initialization parameters of a DFPlayer Mini device descriptor.
gpio_t busy_pin
GPIO connected to the DFPlayer's busy pin.
uint8_t volume
Initial volume.
uart_t uart
UART interface connected to the DFPlayer.
A DFPlayer Mini device descriptor.
dfplayer_source_set_t srcs
Set of available playback sources.
mutex_t mutex
Used to mutual exclusive access.
dfplayer_file_t file
Currently played song.
dfplayer_cb_done_t cb_done
Function to call when playing a track completed.
uint8_t flags
Flags storing info about the driver state.
uart_t uart
UART interface connected to the DFPlayer.
gpio_t busy_pin
GPIO connected to the DFPlayer's busy pin.
dfplayer_cb_src_t cb_src
Function to call when set of available playback sources changes.
uint8_t buf[6]
Data buffer for response from DFPlayer.
mutex_t sync
Used to wait on ISR.
dfplayer_rx_state_t state
Current state of the DFPlayer.
uint32_t last_event_us
Time stamp of the last event in µs.
uint8_t len
Length of the frame in the buffer.
Mutex structure.
Definition mutex.h:146