From 33132c8a607b5a931cd37f25b58c1b06ec69516a Mon Sep 17 00:00:00 2001 From: Hauke Petersen <hauke.petersen@fu-berlin.de> Date: Sun, 7 Feb 2016 12:52:55 +0100 Subject: [PATCH] cpu: added common cpu for the nRF5x family --- cpu/nrf51/include/periph_cpu.h | 69 ------------------- cpu/nrf5x_common/Makefile | 3 + cpu/nrf5x_common/Makefile.include | 6 ++ cpu/nrf5x_common/doc.txt | 5 ++ .../include/periph_cpu.h | 4 +- cpu/nrf5x_common/periph/Makefile | 3 + 6 files changed, 19 insertions(+), 71 deletions(-) delete mode 100644 cpu/nrf51/include/periph_cpu.h create mode 100644 cpu/nrf5x_common/Makefile create mode 100644 cpu/nrf5x_common/Makefile.include create mode 100644 cpu/nrf5x_common/doc.txt rename cpu/{nrf52 => nrf5x_common}/include/periph_cpu.h (94%) create mode 100644 cpu/nrf5x_common/periph/Makefile diff --git a/cpu/nrf51/include/periph_cpu.h b/cpu/nrf51/include/periph_cpu.h deleted file mode 100644 index 21d2e60205..0000000000 --- a/cpu/nrf51/include/periph_cpu.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2015 Freie Universität Berlin - * - * 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_nrf51822 - * @{ - * - * @file - * @brief CPU specific definitions for handling peripherals - * - * @author Hauke Petersen <hauke.peterse@fu-berlin.de> - */ - -#ifndef CPU_PERIPH_H_ -#define CPU_PERIPH_H_ - -#include "periph/dev_enums.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Mandatory macro for defining GPIO pins - * - * The port definition is used (and zeroed) to suppress compiler warnings - */ -#define GPIO_PIN(x,y) ((x & 0) | y) - -/** - * @brief Length of the CPU_ID in octets - */ -#define CPUID_LEN (8U) - -/** - * @brief Override GPIO pull register select values - * @{ - */ -#define HAVE_GPIO_PP_T -typedef enum { - GPIO_NOPULL = 0, /**< do not use internal pull resistors */ - GPIO_PULLUP = 2, /**< enable internal pull-up resistor */ - GPIO_PULLDOWN = 1 /**< enable internal pull-down resistor */ -} gpio_pp_t; -/** @} */ - -/** - * @brief Override GPIO active flank values - * @{ - */ -#define HAVE_GPIO_FLANK_T -typedef enum { - GPIO_FALLING = 2, /**< emit interrupt on falling flank */ - GPIO_RISING = 1, /**< emit interrupt on rising flank */ - GPIO_BOTH = 3 /**< emit interrupt on both flanks */ -} gpio_flank_t; -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* CPU_PERIPH_H_ */ -/** @} */ diff --git a/cpu/nrf5x_common/Makefile b/cpu/nrf5x_common/Makefile new file mode 100644 index 0000000000..e09377cd1e --- /dev/null +++ b/cpu/nrf5x_common/Makefile @@ -0,0 +1,3 @@ +DIRS = periph + +include $(RIOTBASE)/Makefile.base diff --git a/cpu/nrf5x_common/Makefile.include b/cpu/nrf5x_common/Makefile.include new file mode 100644 index 0000000000..2992156ed4 --- /dev/null +++ b/cpu/nrf5x_common/Makefile.include @@ -0,0 +1,6 @@ +# export the CPU family so we can differentiate between them in the code +FAM = $(shell echo $(CPU_FAM) | tr 'a-z-' 'A-Z_') +export CFLAGS += -DCPU_FAM_$(FAM) + +# export the common include directory +export INCLUDES += -I$(RIOTCPU)/nrf5x_common/include diff --git a/cpu/nrf5x_common/doc.txt b/cpu/nrf5x_common/doc.txt new file mode 100644 index 0000000000..41687f4231 --- /dev/null +++ b/cpu/nrf5x_common/doc.txt @@ -0,0 +1,5 @@ +/** + * @defgroup cpu_nrf5x_common + * @ingroup cpu + * @brief Common implementations for the nRF5x family of CPUs + */ diff --git a/cpu/nrf52/include/periph_cpu.h b/cpu/nrf5x_common/include/periph_cpu.h similarity index 94% rename from cpu/nrf52/include/periph_cpu.h rename to cpu/nrf5x_common/include/periph_cpu.h index 31e3728565..17eeb16be6 100644 --- a/cpu/nrf52/include/periph_cpu.h +++ b/cpu/nrf5x_common/include/periph_cpu.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 Freie Universität Berlin + * Copyright (C) 2015-2016 Freie Universität Berlin * * 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 @@ -7,7 +7,7 @@ */ /** - * @ingroup cpu_nrf52 + * @ingroup cpu_nrf5x_common * @{ * * @file diff --git a/cpu/nrf5x_common/periph/Makefile b/cpu/nrf5x_common/periph/Makefile new file mode 100644 index 0000000000..6d1887b640 --- /dev/null +++ b/cpu/nrf5x_common/periph/Makefile @@ -0,0 +1,3 @@ +MODULE = periph + +include $(RIOTBASE)/Makefile.base -- GitLab