From ea0dc223a4fdc71666901eec74cc4740c1a84df8 Mon Sep 17 00:00:00 2001
From: Hauke Petersen <hauke.petersen@fu-berlin.de>
Date: Thu, 16 Nov 2017 15:14:31 +0100
Subject: [PATCH] boards/wsn430: cleaned up structure

---
 boards/common/wsn430/Makefile.features        | 10 +++
 boards/common/wsn430/Makefile.include         | 15 ++---
 .../include/{board_common.h => board.h}       | 26 ++++++--
 boards/common/wsn430/include/periph_conf.h    |  5 +-
 boards/wsn430-v1_3b/Makefile                  |  1 -
 boards/wsn430-v1_3b/Makefile.features         | 11 +---
 boards/wsn430-v1_3b/Makefile.include          |  1 -
 boards/wsn430-v1_3b/include/board.h           | 63 -------------------
 boards/wsn430-v1_4/Makefile                   |  1 -
 boards/wsn430-v1_4/Makefile.features          | 11 +---
 boards/wsn430-v1_4/Makefile.include           |  1 -
 boards/wsn430-v1_4/include/board.h            | 63 -------------------
 12 files changed, 42 insertions(+), 166 deletions(-)
 create mode 100644 boards/common/wsn430/Makefile.features
 rename boards/common/wsn430/include/{board_common.h => board.h} (75%)
 delete mode 100644 boards/wsn430-v1_3b/include/board.h
 delete mode 100644 boards/wsn430-v1_4/include/board.h

diff --git a/boards/common/wsn430/Makefile.features b/boards/common/wsn430/Makefile.features
new file mode 100644
index 0000000000..6d1b3acb46
--- /dev/null
+++ b/boards/common/wsn430/Makefile.features
@@ -0,0 +1,10 @@
+# Put defined MCU peripherals here (in alphabetical order)
+FEATURES_PROVIDED += periph_gpio
+FEATURES_PROVIDED += periph_timer
+FEATURES_PROVIDED += periph_spi
+FEATURES_PROVIDED += periph_uart
+
+# The board MPU family (used for grouping by the CI system)
+FEATURES_MCU_GROUP = msp430
+
+-include $(RIOTCPU)/msp430fxyz/Makefile.features
diff --git a/boards/common/wsn430/Makefile.include b/boards/common/wsn430/Makefile.include
index 3d197451b7..8bf601afa2 100644
--- a/boards/common/wsn430/Makefile.include
+++ b/boards/common/wsn430/Makefile.include
@@ -1,17 +1,18 @@
-## the cpu to build for
+# select the used CPU
 export CPU = msp430fxyz
 export CPU_MODEL = msp430f1611
 
-# set default port depending on operating system
+# include this module in the build
+USEMODULE += boards_common_wsn430
+# use common wsn430 includes
+export INCLUDES += -I$(RIOTBOARD)/common/wsn430/include
+
+# configure the serial interface
 PORT_LINUX ?= /dev/ttyUSB0
 PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
-# setup serial terminal
 include $(RIOTMAKE)/tools/serial.inc.mk
 
-# setup flash tool
+# configure the flash tool
 export OFLAGS = -O ihex
 export FLASHER = mspdebug
 export FFLAGS = -d $(PORT) -j uif "prog $(HEXFILE)"
-
-# include common wsn430 includes
-export INCLUDES += -I$(RIOTBOARD)/common/wsn430/include
diff --git a/boards/common/wsn430/include/board_common.h b/boards/common/wsn430/include/board.h
similarity index 75%
rename from boards/common/wsn430/include/board_common.h
rename to boards/common/wsn430/include/board.h
index cbcef903b7..6a39234d32 100644
--- a/boards/common/wsn430/include/board_common.h
+++ b/boards/common/wsn430/include/board.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2013 Milan Babel <babel@inf.fu-berlin.de>
- *               2016 Freie Universität Berlin
+ *               2015-2017 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
@@ -8,9 +8,9 @@
  */
 
 /**
- * @defgroup    boards_common_wsn430 WSN430 common
+ * @defgroup    boards_common_wsn430 Shared WSN430 files
  * @ingroup     boards_common
- * @brief       Shared files and configuration for all WSN430 based boards.
+ * @brief       Common files for WSN430 based boards
  * @{
  *
  * @file
@@ -21,8 +21,10 @@
  *
  */
 
-#ifndef BOARD_COMMON_H
-#define BOARD_COMMON_H
+#ifndef BOARD_H
+#define BOARD_H
+
+#include "cpu.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -41,6 +43,18 @@ extern "C" {
 #define XTIMER_BACKOFF              (40)
 /** @} */
 
+/**
+ * @name    CPU core configuration
+ * @{
+ */
+/** @todo   Move this to the periph_conf.h */
+#define MSP430_INITIAL_CPU_SPEED    800000uL
+#define F_CPU                       MSP430_INITIAL_CPU_SPEED
+#define F_RC_OSCILLATOR             32768
+#define MSP430_HAS_DCOR             0
+#define MSP430_HAS_EXTERNAL_CRYSTAL 1
+/** @} */
+
 /**
  * @name    LED pin definitions and handlers
  * @{
@@ -71,5 +85,5 @@ extern "C" {
 }
 #endif
 
-#endif /* BOARD_COMMON_H */
+#endif /* BOARD_H */
 /** @} */
diff --git a/boards/common/wsn430/include/periph_conf.h b/boards/common/wsn430/include/periph_conf.h
index e0f32a5e43..879518e821 100644
--- a/boards/common/wsn430/include/periph_conf.h
+++ b/boards/common/wsn430/include/periph_conf.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 INRIA
- *               2015 Freie Universität Berlin
+ *               2015,2017 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
@@ -12,7 +12,7 @@
  * @{
  *
  * @file
- * @brief       WSN30 peripheral configuration
+ * @brief       WSN430 peripheral configuration
  *
  * @author      Oliver Hahm <oliver.hahm@inria.fr>
  *              Hauke Petersen <hauke.petersen@fu-berlin.de>
@@ -29,7 +29,6 @@ extern "C" {
  * @name    Clock configuration
  * @{
  */
-/** @todo   Move all clock configuration code here from the board.h */
 #define CLOCK_CORECLOCK     (8000000U)
 
 #define CLOCK_CMCLK         CLOCK_CORECLOCK     /* no divider programmed */
diff --git a/boards/wsn430-v1_3b/Makefile b/boards/wsn430-v1_3b/Makefile
index 77db0c1908..3bf2d5cd3c 100644
--- a/boards/wsn430-v1_3b/Makefile
+++ b/boards/wsn430-v1_3b/Makefile
@@ -1,5 +1,4 @@
 MODULE = board
-
 DIRS = $(RIOTBOARD)/common/wsn430
 
 include $(RIOTBASE)/Makefile.base
diff --git a/boards/wsn430-v1_3b/Makefile.features b/boards/wsn430-v1_3b/Makefile.features
index 6d1b3acb46..41bb7f2863 100644
--- a/boards/wsn430-v1_3b/Makefile.features
+++ b/boards/wsn430-v1_3b/Makefile.features
@@ -1,10 +1 @@
-# Put defined MCU peripherals here (in alphabetical order)
-FEATURES_PROVIDED += periph_gpio
-FEATURES_PROVIDED += periph_timer
-FEATURES_PROVIDED += periph_spi
-FEATURES_PROVIDED += periph_uart
-
-# The board MPU family (used for grouping by the CI system)
-FEATURES_MCU_GROUP = msp430
-
--include $(RIOTCPU)/msp430fxyz/Makefile.features
+include $(RIOTBOARD)/common/wsn430/Makefile.features
diff --git a/boards/wsn430-v1_3b/Makefile.include b/boards/wsn430-v1_3b/Makefile.include
index 54a6472f9a..e63bf64dd2 100644
--- a/boards/wsn430-v1_3b/Makefile.include
+++ b/boards/wsn430-v1_3b/Makefile.include
@@ -1,2 +1 @@
-USEMODULE += boards_common_wsn430
 include $(RIOTBOARD)/common/wsn430/Makefile.include
diff --git a/boards/wsn430-v1_3b/include/board.h b/boards/wsn430-v1_3b/include/board.h
deleted file mode 100644
index 3836c71056..0000000000
--- a/boards/wsn430-v1_3b/include/board.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2013 Milan Babel <babel@inf.fu-berlin.de>
- *               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.
- */
-
-/**
- * @defgroup    boards_wsn430-v1_3b WSN430 v1.3b
- * @ingroup     boards
- * @brief       Support for the Senslab WSN430 v1.3b board
- *
- * <h2>Compontents</h2>
- * \li MSP430
- * \li CC1100
- *
- * @{
- *
- * @file
- * @brief       Basic definitions for the Senslab WSN430 v1.3b board
- *
- * @author      Milan Babel <babel@inf.fu-berlin.de>
- * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
- */
-
-#ifndef BOARD_H
-#define BOARD_H
-
-#include "board_common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief   Define the CPU model for the <msp430.h>
- */
-#ifndef __MSP430F1611__
-#define __MSP430F1611__
-#endif
-
-/**
- * @name    CPU core configuration
- * @{
- */
-/** @todo   Move this to the periph_conf.h */
-#define MSP430_INITIAL_CPU_SPEED    800000uL
-#define F_CPU                       MSP430_INITIAL_CPU_SPEED
-#define F_RC_OSCILLATOR             32768
-#define MSP430_HAS_DCOR             0
-#define MSP430_HAS_EXTERNAL_CRYSTAL 1
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#include <msp430x16x.h>
-
-/** @} */
-#endif /* BOARD_H */
diff --git a/boards/wsn430-v1_4/Makefile b/boards/wsn430-v1_4/Makefile
index 77db0c1908..3bf2d5cd3c 100644
--- a/boards/wsn430-v1_4/Makefile
+++ b/boards/wsn430-v1_4/Makefile
@@ -1,5 +1,4 @@
 MODULE = board
-
 DIRS = $(RIOTBOARD)/common/wsn430
 
 include $(RIOTBASE)/Makefile.base
diff --git a/boards/wsn430-v1_4/Makefile.features b/boards/wsn430-v1_4/Makefile.features
index 6d1b3acb46..41bb7f2863 100644
--- a/boards/wsn430-v1_4/Makefile.features
+++ b/boards/wsn430-v1_4/Makefile.features
@@ -1,10 +1 @@
-# Put defined MCU peripherals here (in alphabetical order)
-FEATURES_PROVIDED += periph_gpio
-FEATURES_PROVIDED += periph_timer
-FEATURES_PROVIDED += periph_spi
-FEATURES_PROVIDED += periph_uart
-
-# The board MPU family (used for grouping by the CI system)
-FEATURES_MCU_GROUP = msp430
-
--include $(RIOTCPU)/msp430fxyz/Makefile.features
+include $(RIOTBOARD)/common/wsn430/Makefile.features
diff --git a/boards/wsn430-v1_4/Makefile.include b/boards/wsn430-v1_4/Makefile.include
index 54a6472f9a..e63bf64dd2 100644
--- a/boards/wsn430-v1_4/Makefile.include
+++ b/boards/wsn430-v1_4/Makefile.include
@@ -1,2 +1 @@
-USEMODULE += boards_common_wsn430
 include $(RIOTBOARD)/common/wsn430/Makefile.include
diff --git a/boards/wsn430-v1_4/include/board.h b/boards/wsn430-v1_4/include/board.h
deleted file mode 100644
index 9771516bc3..0000000000
--- a/boards/wsn430-v1_4/include/board.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2013 Milan Babel <babel@inf.fu-berlin.de>
- *               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.
- */
-
-/**
- * @defgroup    boards_wsn430-v1_4 WSN430 v1.4
- * @ingroup     boards
- * @brief       Support for the Senslab WSN430 v1.4 board
- *
- * <h2>Compontents</h2>
- * \li MSP430
- * \li CC2420
- *
- * @{
- *
- * @file
- * @brief       Basic definitions for the Senslab WSN430 v1.4 board
- *
- * @author      Milan Babel <babel@inf.fu-berlin.de>
- * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
- */
-
-#ifndef BOARD_H
-#define BOARD_H
-
-#include "board_common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief   Define the CPU model for the <msp430.h>
- */
-#ifndef __MSP430F1611__
-#define __MSP430F1611__
-#endif
-
-/**
- * @name    CPU core configuration
- * @{
- */
-/** @todo   Move this to the periph_conf.h */
-#define MSP430_INITIAL_CPU_SPEED    800000uL
-#define F_CPU                       MSP430_INITIAL_CPU_SPEED
-#define F_RC_OSCILLATOR             32768
-#define MSP430_HAS_DCOR             0
-#define MSP430_HAS_EXTERNAL_CRYSTAL 1
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#include <msp430x16x.h>
-
-/** @} */
-#endif /* BOARD_H */
-- 
GitLab