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

core/init: add early_init()

Add a function to initialize LEDs and UART in early boot.
This commit is contained in:
Benjamin Valentin 2023-01-02 18:07:56 +01:00
parent 441b69964c
commit 092b235845
3 changed files with 21 additions and 5 deletions

View File

@ -56,6 +56,15 @@ void kernel_init(void);
*/
void board_init(void);
/**
* @brief Initialize debug LEDs and stdio
*/
#ifdef MODULE_CORE_INIT
void early_init(void);
#else
static inline void early_init(void) {}
#endif
#ifdef __cplusplus
}
#endif

View File

@ -29,6 +29,7 @@
#include "log.h"
#include "periph/pm.h"
#include "thread.h"
#include "stdio_base.h"
#define ENABLE_DEBUG 0
#include "debug.h"
@ -102,3 +103,14 @@ void kernel_init(void)
cpu_switch_context_exit();
}
void early_init(void)
{
/* initialize leds */
if (IS_USED(MODULE_PERIPH_INIT_LEDS)) {
extern void led_init(void);
led_init();
}
stdio_init();
}

View File

@ -58,11 +58,6 @@
void periph_init(void)
{
#ifdef MODULE_PERIPH_INIT
/* initialize leds */
if (IS_USED(MODULE_PERIPH_INIT_LEDS)) {
extern void led_init(void);
led_init();
}
/* initialize buttonss */
if (IS_USED(MODULE_PERIPH_INIT_BUTTONS)) {
extern void button_init(void);