Skip to content

Commit

Permalink
boards/nucleo: use shard board.h and board.c files
Browse files Browse the repository at this point in the history
  • Loading branch information
haukepetersen committed Nov 30, 2017
1 parent fcdd687 commit 74bd1b5
Show file tree
Hide file tree
Showing 96 changed files with 171 additions and 2,293 deletions.
3 changes: 3 additions & 0 deletions boards/common/nucleo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MODULE = boards_common_nucleo

include $(RIOTBASE)/Makefile.base
50 changes: 50 additions & 0 deletions boards/common/nucleo/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2014-2017 Freie Universität Berlin
* 2015 Lari Lehtomäki
* 2015 TriaGnoSys GmbH
* 2016-2017 Inria
* 2016-2017 OTA keys
*
* 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 boards_nucleo
* @{
*
* @file
* @brief Board initialization code for all Nucleo boards
*
* @author Hauke Petersen <[email protected]>
* @author Thomas Eichinger <[email protected]>
* @author Lari Lehtomäki <[email protected]>
* @author Alexandre Abadie <[email protected]>
* @author Víctor Ariño <[email protected]>
* @author José Alamos <[email protected]>
* @author Vincent Dupont <[email protected]>
*
* @}
*/

#include "board.h"
#include "periph/gpio.h"

void board_init(void)
{
/* initialize the CPU */
cpu_init();

/* initialization of on-board LEDs
* NOTE: LED0 must be explicitly enabled as it is also used for SPI_DEV(0) */
#ifdef AUTO_INIT_LED0
gpio_init(LED0_PIN, GPIO_OUT);
#endif
#ifdef LED1_PIN
gpio_init(LED1_PIN, GPIO_OUT);
#endif
#ifdef LED2_PIN
gpio_init(LED2_PIN, GPIO_OUT);
#endif
}
71 changes: 71 additions & 0 deletions boards/common/nucleo/include/board_nucleo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright (C) 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 details.
*/

/**
* @defgroup boards_nucleo STM Nucleo boards
* @ingroup boards
* @brief STM Nucleo boards
* @{
*
* @file
* @brief Global common Nucleo board configuration
*
* @author Hauke Petersen <[email protected]>
*/

#ifndef BOARD_NUCLEO_H
#define BOARD_NUCLEO_H

#include "cpu.h"
#include "periph_conf.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @name Xtimer configuration
* @{
*/
#if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32L0) && \
!defined(CPU_MODEL_STM32F042K6) && !defined(CPU_MODEL_STM32F031K6)
#define XTIMER_WIDTH (16)
#endif

#if defined(CPU_MODEL_STM32F334R8)
#define XTIMER_SHOOT_EARLY (2)
#define XTIMER_OVERHEAD (5)
#endif

#if defined(CPU_FAM_STM32F1)
#define XTIMER_WIDTH (16)
#define XTIMER_BACKOFF (5)
#endif

#if defined(CPU_FAM_STM32L1)
#define XTIMER_BACKOFF (3)
#define XTIMER_OVERHEAD (6)
#endif

#if defined(CPU_FAM_STM32F4) || defined(CPU_MODEL_STM32F303ZE)
#define XTIMER_BACKOFF (5)
#define XTIMER_OVERHEAD (6)
#endif
/** @} */

/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);

#ifdef __cplusplus
}
#endif

#endif /* BOARD_NUCLEO_H */
/** @} */
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
* @author Sebastian Meiling <[email protected]>
*/

#ifndef BOARD_COMMON_H
#define BOARD_COMMON_H
#ifndef BOARD_H
#define BOARD_H

#include "cpu.h"
#include "periph_conf.h"
#include "board_nucleo.h"
#include "arduino_pinmap.h"

#ifdef __cplusplus
Expand Down Expand Up @@ -63,14 +62,9 @@ extern "C" {
#define BTN0_MODE GPIO_IN_PD
/** @} */

/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);

#ifdef __cplusplus
}
#endif

#endif /* BOARD_COMMON_H */
#endif /* BOARD_H */
/** @} */
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

/**
* @defgroup boards_nucleo32-common STM Nucleo-32 Common
* @defgroup boards_common_nucleo32 STM Nucleo-32 Common
* @ingroup boards_nucleo
* @brief Common files for STM Nucleo-32 boards
* @{
Expand All @@ -18,11 +18,10 @@
* @author Alexandre Abadie <[email protected]>
*/

#ifndef BOARD_COMMON_H
#define BOARD_COMMON_H
#ifndef BOARD_H
#define BOARD_H

#include "cpu.h"
#include "periph_conf.h"
#include "board_nucleo.h"
#include "arduino_pinmap.h"

#ifdef __cplusplus
Expand All @@ -40,14 +39,9 @@ extern "C" {
#define LED0_TOGGLE (GPIOB->ODR ^= LED0_MASK)
/** @} */

/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);

#ifdef __cplusplus
}
#endif

#endif /* BOARD_COMMON_H */
#endif /* BOARD_H */
/** @} */
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
/*
* Copyright (C) 2016 Freie Universität Berlin
* Copyright (C) 2016-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 details.
*/

/**
* @defgroup boards_nucleo STM Nucleo boards
* @ingroup boards
* @brief STM Nucleo boards
*/

/**
* @defgroup boards_nucleo64_common STM Nucleo 64 boards common
* @defgroup boards_nucleo64_common STM Nucleo-64 Common
* @ingroup boards_nucleo
* @brief Common files for STM Nucleo 64 boards
* @brief Common files for STM Nucleo-64 boards
* @{
*
* @file
Expand All @@ -25,19 +19,18 @@
* @author Sebastian Meiling <[email protected]>
*/

#ifndef BOARD_COMMON_H
#define BOARD_COMMON_H
#ifndef BOARD_H
#define BOARD_H

#include "cpu.h"
#include "periph_conf.h"
#include "board_nucleo.h"
#include "arduino_pinmap.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief LED pin definitions and handlers
* @name LED pin definitions and handlers
* @{
*/
#ifdef CPU_MODEL_STM32F302R8
Expand All @@ -63,14 +56,9 @@ extern "C" {
#define BTN0_MODE GPIO_IN_PU
/** @} */

/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);

#ifdef __cplusplus
}
#endif

#endif /* BOARD_COMMON_H */
#endif /* BOARD_H */
/** @} */
1 change: 1 addition & 0 deletions boards/nucleo-f030/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
MODULE = board
DIRS = $(RIOTBOARD)/common/nucleo

include $(RIOTBASE)/Makefile.base
37 changes: 0 additions & 37 deletions boards/nucleo-f030/board.c

This file was deleted.

45 changes: 0 additions & 45 deletions boards/nucleo-f030/include/board.h

This file was deleted.

1 change: 1 addition & 0 deletions boards/nucleo-f070/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
MODULE = board
DIRS = $(RIOTBOARD)/common/nucleo

include $(RIOTBASE)/Makefile.base
37 changes: 0 additions & 37 deletions boards/nucleo-f070/board.c

This file was deleted.

Loading

0 comments on commit 74bd1b5

Please sign in to comment.