1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/dfplayer: add no_strerror option to Kconfig

This commit is contained in:
Leandro Lanzieri 2021-11-11 14:13:55 +01:00
parent 92b7e5ea53
commit e525e23143
No known key found for this signature in database
GPG Key ID: F4E9A721761C7593
3 changed files with 14 additions and 3 deletions

View File

@ -5,7 +5,7 @@
# directory for more details.
#
config MODULE_DFPLAYER
menuconfig MODULE_DFPLAYER
bool "DFPlayer Mini MP3 Player"
depends on HAS_PERIPH_UART
depends on HAS_PERIPH_GPIO
@ -16,3 +16,14 @@ config MODULE_DFPLAYER
select HAVE_MULTIMEDIA_DEVICE
# Perhaps this could be moved to its own symbol to enable the dfplayer commands
select MODULE_FMT if MODULE_SHELL_COMMANDS
config DFPLAYER_NO_STRERROR
bool
prompt "Avoid using strerror in shell command" if !(HAS_ARCH_AVR8 || HAS_ARCH_MSP430)
depends on MODULE_DFPLAYER
depends on MODULE_SHELL_COMMANDS
# no strerror() on AVR and MSP430
default y if (HAS_ARCH_AVR8 || HAS_ARCH_MSP430)
help
Say y to print error codes as numbers when using the shell, instead of the corresponding
standard error string.

View File

@ -3,5 +3,5 @@ USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_dfplayer)
ifneq (,$(filter arch_avr8 arch_msp430,$(FEATURES_USED)))
# no strerror() on AVR and MSP430
CFLAGS += -DDFPLAYER_NO_STRERROR
CFLAGS += -DCONFIG_DFPLAYER_NO_STRERROR
endif

View File

@ -56,7 +56,7 @@ static const char *_states[] = {
static void _print_error(int retval)
{
print_str("Error: ");
#ifdef DFPLAYER_NO_STRERROR
#ifdef CONFIG_DFPLAYER_NO_STRERROR
print_s32_dec(retval);
#else
print_str(strerror(-retval));