diff --git a/drivers/periph_common/init.c b/drivers/periph_common/init.c index 6473205fc88a148fb083f4e9f93d6d687718b962..726f92bb133f5444015ace602f1bfd8136bebdaf 100644 --- a/drivers/periph_common/init.c +++ b/drivers/periph_common/init.c @@ -23,6 +23,9 @@ #ifdef MODULE_PERIPH_SPI #include "periph/spi.h" #endif +#ifdef MODULE_PERIPH_RTC +#include "periph/rtc.h" +#endif void periph_init(void) { @@ -32,4 +35,9 @@ void periph_init(void) spi_init(SPI_DEV(i)); } #endif + + /* Initialize RTC */ +#ifdef MODULE_PERIPH_RTC + rtc_init(); +#endif } diff --git a/examples/default/main.c b/examples/default/main.c index 427c7ec840dc84c9fb57d19e3b3469a241f62150..9d6542d0fd8b3affb3ee24caed0f88d3f7cbbd9c 100644 --- a/examples/default/main.c +++ b/examples/default/main.c @@ -29,10 +29,6 @@ #include "shell.h" #include "shell_commands.h" -#if FEATURE_PERIPH_RTC -#include "periph/rtc.h" -#endif - #ifdef MODULE_NETIF #include "net/gnrc/pktdump.h" #include "net/gnrc.h" @@ -40,10 +36,6 @@ int main(void) { -#ifdef FEATURE_PERIPH_RTC - rtc_init(); -#endif - #ifdef MODULE_NETIF gnrc_netreg_entry_t dump = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL, gnrc_pktdump_pid); diff --git a/sys/auto_init/auto_init.c b/sys/auto_init/auto_init.c index fa1248e3a6bea2703fd9ed331914c42aca1db8c8..582214fe2df8e46583285b9794ac3b3951580b60 100644 --- a/sys/auto_init/auto_init.c +++ b/sys/auto_init/auto_init.c @@ -32,10 +32,6 @@ #include "xtimer.h" #endif -#ifdef MODULE_RTC -#include "periph/rtc.h" -#endif - #ifdef MODULE_GNRC_SIXLOWPAN #include "net/gnrc/sixlowpan.h" #endif @@ -102,10 +98,6 @@ void auto_init(void) DEBUG("Auto init xtimer module.\n"); xtimer_init(); #endif -#ifdef MODULE_RTC - DEBUG("Auto init rtc module.\n"); - rtc_init(); -#endif #ifdef MODULE_SHT11 DEBUG("Auto init SHT11 module.\n"); sht11_init(); diff --git a/sys/shell/commands/sc_rtc.c b/sys/shell/commands/sc_rtc.c index 2dd7103af8f9a99a62120e9e295a7e7fb83260c1..268f57361e4fd016dda6dce83a8bdfe2b1bcf0c9 100644 --- a/sys/shell/commands/sc_rtc.c +++ b/sys/shell/commands/sc_rtc.c @@ -139,7 +139,6 @@ static int _rtc_usage(void) { puts("usage: rtc <command> [arguments]"); puts("commands:"); - puts("\tinit\t\tinitialize the interface"); puts("\tpoweron\t\tpower the interface on"); puts("\tpoweroff\tpower the interface off"); puts("\tclearalarm\tdeactivate the current alarm"); @@ -156,9 +155,6 @@ int _rtc_handler(int argc, char **argv) _rtc_usage(); return 1; } - else if (strncmp(argv[1], "init", 4) == 0) { - rtc_init(); - } else if (strncmp(argv[1], "poweron", 7) == 0) { rtc_poweron(); } diff --git a/sys/shell/commands/shell_commands.c b/sys/shell/commands/shell_commands.c index 96bb932aa8507497bd4cf7a775e09ebf00f9d1a0..c14034b6e04ca30817ee1b27715001518d4395cd 100644 --- a/sys/shell/commands/shell_commands.c +++ b/sys/shell/commands/shell_commands.c @@ -57,7 +57,7 @@ extern int _at30tse75x_handler(int argc, char **argv); extern int _saul(int argc, char **argv); #endif -#if FEATURE_PERIPH_RTC +#ifdef MODULE_PERIPH_RTC extern int _rtc_handler(int argc, char **argv); #endif @@ -187,7 +187,7 @@ const shell_command_t _shell_command_list[] = { { "random_init", "initializes the PRNG", _random_init }, { "random_get", "returns 32 bit of pseudo randomness", _random_get }, #endif -#if FEATURE_PERIPH_RTC +#ifdef MODULE_PERIPH_RTC {"rtc", "control RTC peripheral interface", _rtc_handler}, #endif #ifdef CPU_X86 diff --git a/tests/periph_rtc/main.c b/tests/periph_rtc/main.c index 0bad4f09db96c60f7f1d2fab4bc48998977b1143..3da6dedf0500887fbdf65e73d34304be5a1b9ee7 100644 --- a/tests/periph_rtc/main.c +++ b/tests/periph_rtc/main.c @@ -83,9 +83,6 @@ int main(void) printf("This test will display 'Alarm!' every %u seconds for %u times\n", PERIOD, REPEAT); - /* initialize RTC */ - rtc_init(); - /* set RTC */ print_time(" Setting clock to ", &time); rtc_set_time(&time); diff --git a/tests/pkg_fatfs/main.c b/tests/pkg_fatfs/main.c index 57a25b85e6cb3515bd33789cdfbd6e15fa98f406..6faaa8789897d2e6e5c84e7e5868e0e37a47f684 100644 --- a/tests/pkg_fatfs/main.c +++ b/tests/pkg_fatfs/main.c @@ -354,7 +354,6 @@ int main(void) /* the rtc is used in diskio.c for timestamps of files */ puts("Initializing the RTC driver"); rtc_poweron(); - rtc_init(); struct tm time; time.tm_year = TEST_FATFS_RTC_YEAR - RTC_YEAR_OFFSET; /* years are counted from 1900 */