1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +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. # directory for more details.
# #
config MODULE_DFPLAYER menuconfig MODULE_DFPLAYER
bool "DFPlayer Mini MP3 Player" bool "DFPlayer Mini MP3 Player"
depends on HAS_PERIPH_UART depends on HAS_PERIPH_UART
depends on HAS_PERIPH_GPIO depends on HAS_PERIPH_GPIO
@ -16,3 +16,14 @@ config MODULE_DFPLAYER
select HAVE_MULTIMEDIA_DEVICE select HAVE_MULTIMEDIA_DEVICE
# Perhaps this could be moved to its own symbol to enable the dfplayer commands # Perhaps this could be moved to its own symbol to enable the dfplayer commands
select MODULE_FMT if MODULE_SHELL_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))) ifneq (,$(filter arch_avr8 arch_msp430,$(FEATURES_USED)))
# no strerror() on AVR and MSP430 # no strerror() on AVR and MSP430
CFLAGS += -DDFPLAYER_NO_STRERROR CFLAGS += -DCONFIG_DFPLAYER_NO_STRERROR
endif endif

View File

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