Loading...
Searching...
No Matches
dfplayer_internal.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
18#ifndef DFPLAYER_INTERNAL_H
19#define DFPLAYER_INTERNAL_H
20
21#include <stdint.h>
22
23#include "dfplayer_types.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
93int dfplayer_transceive(dfplayer_t *dev, uint16_t *resp,
94 uint8_t cmd, uint8_t p1, uint8_t p2);
95
117int dfplayer_file_cmd(dfplayer_t *dev, uint8_t cmd, uint8_t p1, uint8_t p2);
118
131
138void dfplayer_uart_rx_cb(void *dev, uint8_t data);
139
153static inline int dfplayer_cmd_2param(dfplayer_t *dev, uint8_t cmd,
154 uint8_t p1, uint8_t p2)
155{
156 return dfplayer_transceive(dev, NULL, cmd, p1, p2);
157}
158
171static inline int dfplayer_cmd_1param(dfplayer_t *dev, uint8_t cmd, uint8_t param)
172{
173 return dfplayer_transceive(dev, NULL, cmd, 0, param);
174}
175
187static inline int dfplayer_cmd(dfplayer_t *dev, uint8_t cmd)
188{
189 return dfplayer_transceive(dev, NULL, cmd, 0, 0);
190}
191
204static inline int dfplayer_query(dfplayer_t *dev, uint16_t *resp, uint8_t cmd)
205{
206 return dfplayer_transceive(dev, resp, cmd, 0, 0);
207}
208
209#ifdef __cplusplus
210}
211#endif
212
213#endif /* DFPLAYER_INTERNAL_H */
static int dfplayer_cmd(dfplayer_t *dev, uint8_t cmd)
Send a command without parameters to the DFPlayer Mini.
int dfplayer_reset(dfplayer_t *dev)
Reset the DFPlayer Mini MP3 player.
static int dfplayer_cmd_2param(dfplayer_t *dev, uint8_t cmd, uint8_t p1, uint8_t p2)
Send a command with two parameters to the DFPlayer Mini.
void dfplayer_uart_rx_cb(void *dev, uint8_t data)
UART-ISR handler of the DFPLayer driver.
static int dfplayer_query(dfplayer_t *dev, uint16_t *resp, uint8_t cmd)
Send a query and receive the response.
int dfplayer_transceive(dfplayer_t *dev, uint16_t *resp, uint8_t cmd, uint8_t p1, uint8_t p2)
Exchange a frame with the DFPlayer Mini.
static int dfplayer_cmd_1param(dfplayer_t *dev, uint8_t cmd, uint8_t param)
Send a command with one parameter to the DFPlayer Mini.
int dfplayer_file_cmd(dfplayer_t *dev, uint8_t cmd, uint8_t p1, uint8_t p2)
Send a command selecting a playback file.
Types used in the DFPlayer Mini Device Driver.
A DFPlayer Mini device descriptor.