diff --git a/cpu/samd21/cpu.c b/cpu/samd21/cpu.c index bfb7acaa7db9d..1a17fb8a76442 100644 --- a/cpu/samd21/cpu.c +++ b/cpu/samd21/cpu.c @@ -21,32 +21,9 @@ #include "cpu.h" #include "periph_conf.h" +#include "periph_clock_config.h" #include "periph/init.h" -#ifndef CLOCK_8MHZ -#define CLOCK_8MHZ (8000000UL) -#endif - -#ifndef CLOCK_XOSC32K -#define CLOCK_XOSC32K (0) -#endif - -#ifndef XOSC32_RUNSTDBY -#define XOSC32_RUNSTDBY (0) -#endif - -#ifndef GEN1_1MHZ -#define GEN1_1MHZ (1) -#endif - -#ifndef GEN2_XOSC32 -#define GEN2_XOSC32 (0) -#endif - -#ifndef GEN3_ULP32K -#define GEN3_ULP32K (1) -#endif - #ifndef VDD /** * @brief Set system voltage level in mV (determines flash wait states) diff --git a/cpu/samd21/include/periph_clock_config.h b/cpu/samd21/include/periph_clock_config.h new file mode 100644 index 0000000000000..6d0bc8c18fd3e --- /dev/null +++ b/cpu/samd21/include/periph_clock_config.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2017 Daniel Evans + * + * 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 cpu_samd21 + * @{ + * + * @file + * @brief CPU specific definitions for default clock configuration + * + * @author Daniel Evans + */ + +#ifndef PERIPH_CLOCK_CONFIG_H +#define PERIPH_CLOCK_CONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif + + /** + * @brief Default Clock configurations + */ +#ifndef CLOCK_8MHZ +#define CLOCK_8MHZ (8000000UL) +#endif + +#ifndef CLOCK_XOSC32K +#define CLOCK_XOSC32K (0) +#endif + +#ifndef XOSC32_RUNSTDBY +#define XOSC32_RUNSTDBY (0) +#endif + +#ifndef GEN1_1MHZ +#define GEN1_1MHZ (1) +#endif + +#ifndef GEN2_XOSC32 +#define GEN2_XOSC32 (0) +#endif + +#ifndef GEN3_ULP32K +#define GEN3_ULP32K (1) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* PERIPH_CLOCK_CONFIG_H */ +/** @} */ diff --git a/cpu/samd21/periph/rtc.c b/cpu/samd21/periph/rtc.c index 6daa2030f3a1d..eeb5eab37a73c 100644 --- a/cpu/samd21/periph/rtc.c +++ b/cpu/samd21/periph/rtc.c @@ -23,6 +23,8 @@ #include "cpu.h" #include "periph/rtc.h" #include "periph_conf.h" +#include "periph_clock_config.h" + /* guard file in case no RTC device was specified */ #if RTC_NUMOF diff --git a/cpu/samd21/periph/rtt.c b/cpu/samd21/periph/rtt.c index 8ca5aafbf2636..f69768a146635 100644 --- a/cpu/samd21/periph/rtt.c +++ b/cpu/samd21/periph/rtt.c @@ -23,6 +23,7 @@ #include "cpu.h" #include "periph/rtt.h" #include "periph_conf.h" +#include "periph_clock_config.h" /* guard file in case no RTT device was specified */ #if RTT_NUMOF diff --git a/cpu/samd21/periph/timer.c b/cpu/samd21/periph/timer.c index ea33e35fa4f85..4acffe91af37a 100644 --- a/cpu/samd21/periph/timer.c +++ b/cpu/samd21/periph/timer.c @@ -27,6 +27,7 @@ #include "periph/timer.h" #include "periph_conf.h" +#include "periph_clock_config.h" #define ENABLE_DEBUG (0) #include "debug.h"