From a6f9a865976e40974abfed92ffd922b71fecca93 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke <marian.buschsieweke@ovgu.de> Date: Mon, 21 May 2018 22:59:46 +0200 Subject: [PATCH] drivers/cc110x: Moved cc110x_params.h from boards to driver - Replaced magic numbers in the CC110X configuration of the MSBA2 with SPI_DEV(x) and GPIO_PIN(x, y) macros - Adjusted implementation of `cc110x_params.h` to match the code of `at86rf2xx` - Made MSBA2's CC110X parameters the default configuration --- boards/msba2/Makefile.dep | 4 ++ boards/msba2/Makefile.include | 4 -- boards/msba2/include/cc110x_params.h | 44 -------------- drivers/cc110x/include/cc110x_params.h | 79 ++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 48 deletions(-) delete mode 100644 boards/msba2/include/cc110x_params.h create mode 100644 drivers/cc110x/include/cc110x_params.h diff --git a/boards/msba2/Makefile.dep b/boards/msba2/Makefile.dep index 130eea588a..e5d94f2d25 100644 --- a/boards/msba2/Makefile.dep +++ b/boards/msba2/Makefile.dep @@ -1 +1,5 @@ include $(RIOTBOARD)/common/msba2/Makefile.dep + +ifneq (,$(filter netdev_default gnrc_netdev_default,$(USEMODULE))) + USEMODULE += cc110x +endif diff --git a/boards/msba2/Makefile.include b/boards/msba2/Makefile.include index b4929e955a..8c26e275d0 100644 --- a/boards/msba2/Makefile.include +++ b/boards/msba2/Makefile.include @@ -1,7 +1,3 @@ -ifneq (,$(filter netdev_default gnrc_netdev_default,$(USEMODULE))) - USEMODULE += cc110x -endif - USEMODULE += boards_common_msba2 include $(RIOTBOARD)/common/msba2/Makefile.include diff --git a/boards/msba2/include/cc110x_params.h b/boards/msba2/include/cc110x_params.h deleted file mode 100644 index 54236e2abe..0000000000 --- a/boards/msba2/include/cc110x_params.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de> - * - * 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 board_msba2 - * @{ - * - * @file - * @brief cc110x board specific configuration - * - * @author Kaspar Schleiser <kaspar@schleiser.de> - */ - -#ifndef CC110X_PARAMS_H -#define CC110X_PARAMS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @name CC110X configuration - */ -const cc110x_params_t cc110x_params[] = { - { - .spi = 0, - .cs = 53, - .gdo0 = 27, - .gdo1 = 55, - .gdo2 = 28 - }, -}; -/** @} */ - -#ifdef __cplusplus -} -#endif -#endif /* CC110X_PARAMS_H */ -/** @} */ diff --git a/drivers/cc110x/include/cc110x_params.h b/drivers/cc110x/include/cc110x_params.h new file mode 100644 index 0000000000..e9f0130c2a --- /dev/null +++ b/drivers/cc110x/include/cc110x_params.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2017 Marian Buschsieweke <marian.buschsieweke@ovgu.de> + * + * 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 drivers_cc110x + * @{ + * + * @file + * @brief cc110x board specific configuration + * + * @author Marian Buschsieweke <marian.buschsieweke@ovgu.de> + */ + +#ifndef CC110X_PARAMS_H +#define CC110X_PARAMS_H + +#include "board.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name Default parameters for the cc110x driver + * + * These values are based on the msba2 board + * @{ + */ +#ifndef CC110X_PARAM_SPI +#define CC110X_PARAM_SPI SPI_DEV(0) +#endif + +#ifndef CC110X_PARAM_CS +#define CC110X_PARAM_CS GPIO_PIN(1, 21) +#endif + +#ifndef CC110X_PARAM_GDO0 +#define CC110X_PARAM_GDO0 GPIO_PIN(0, 27) +#endif + +#ifndef CC110X_PARAM_GDO1 +#define CC110X_PARAM_GDO1 GPIO_PIN(1, 23) +#endif + +#ifndef CC110X_PARAM_GDO2 +#define CC110X_PARAM_GDO2 GPIO_PIN(0, 28) +#endif + +#ifndef CC110X_PARAMS +#define CC110X_PARAMS { \ + .spi = CC110X_PARAM_SPI, \ + .cs = CC110X_PARAM_CS, \ + .gdo0 = CC110X_PARAM_GDO0, \ + .gdo1 = CC110X_PARAM_GDO1, \ + .gdo2 = CC110X_PARAM_GDO2, \ + } + +#endif +/** @} */ + + +/** + * @name CC110X configuration + * @brief Specifies the SPI bus and GPIOs connected to the CC110X transceiver + */ +const cc110x_params_t cc110x_params[] = { + CC110X_PARAMS +}; + +#ifdef __cplusplus +} +#endif +#endif /* CC110X_PARAMS_H */ +/** @} */ -- GitLab