From bbe0c941670ab236f3739115b3261b391e950b25 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Sun, 21 Jun 2020 18:26:14 +0200 Subject: [PATCH] sys/auto_init: add mechanism for auto_init_screen --- makefiles/pseudomodules.inc.mk | 1 + sys/auto_init/Makefile | 4 +++ sys/auto_init/auto_init.c | 6 +++++ sys/auto_init/screen/Makefile | 3 +++ sys/auto_init/screen/init.c | 46 ++++++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 sys/auto_init/screen/Makefile create mode 100644 sys/auto_init/screen/init.c diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index c4e4673ebf..e6c4f6ba1f 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -305,5 +305,6 @@ NO_PSEUDOMODULES += auto_init_loramac NO_PSEUDOMODULES += auto_init_multimedia NO_PSEUDOMODULES += auto_init_security NO_PSEUDOMODULES += auto_init_usbus +NO_PSEUDOMODULES += auto_init_screen # Packages may also add modules to PSEUDOMODULES in their `Makefile.include`. diff --git a/sys/auto_init/Makefile b/sys/auto_init/Makefile index 7c5a9c9e23..f1ac62ab8a 100644 --- a/sys/auto_init/Makefile +++ b/sys/auto_init/Makefile @@ -26,4 +26,8 @@ ifneq (,$(filter auto_init_security,$(USEMODULE))) DIRS += security endif +ifneq (,$(filter auto_init_screen,$(USEMODULE))) + DIRS += screen +endif + include $(RIOTBASE)/Makefile.base diff --git a/sys/auto_init/auto_init.c b/sys/auto_init/auto_init.c index 3479ff3602..bad383816f 100644 --- a/sys/auto_init/auto_init.c +++ b/sys/auto_init/auto_init.c @@ -270,4 +270,10 @@ void auto_init(void) auto_init_dfplayer(); } } + + if (IS_USED(MODULE_AUTO_INIT_SCREEN)) { + LOG_DEBUG("Auto init screen devices\n"); + extern void auto_init_screen(void); + auto_init_screen(); + } } diff --git a/sys/auto_init/screen/Makefile b/sys/auto_init/screen/Makefile new file mode 100644 index 0000000000..848e9e1442 --- /dev/null +++ b/sys/auto_init/screen/Makefile @@ -0,0 +1,3 @@ +MODULE = auto_init_screen + +include $(RIOTMAKE)/auto_init.inc.mk diff --git a/sys/auto_init/screen/init.c b/sys/auto_init/screen/init.c new file mode 100644 index 0000000000..501db6ef49 --- /dev/null +++ b/sys/auto_init/screen/init.c @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2020 Inria + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup sys_auto_init + * @{ + * @file + * @brief automatically initializes screen display and touch devices + * + * @author Alexandre Abadie + * @} + */ + +#include + +#define ENABLE_DEBUG (0) +#include "debug.h" + +void auto_init_screen(void) +{ + if (IS_USED(MODULE_DISP_DEV)) { + DEBUG("auto_init_screen: init display drivers\n"); + if (IS_USED(MODULE_ILI9341)) { + extern void auto_init_ili9341(void); + auto_init_ili9341(); + } + } + + if (IS_USED(MODULE_TOUCH_DEV)) { + DEBUG("auto_init_screen: init touch drivers\n"); + if (IS_USED(MODULE_STMPE811)) { + extern void auto_init_stmpe811(void); + auto_init_stmpe811(); + } + } + + if (IS_USED(MODULE_LVGL)) { + extern void auto_init_lvgl(void); + auto_init_lvgl(); + } +}