Browse Source

boards/nucleo: added and use common board folder

pr/gpio
Hauke Petersen 7 years ago
parent
commit
0ccadc0f7b
  1. 3
      boards/nucleo-common/Makefile
  2. 12
      boards/nucleo-common/Makefile.include
  3. 60
      boards/nucleo-common/include/board_common.h
  4. 11
      boards/nucleo-f091/Makefile.include
  5. 41
      boards/nucleo-f091/include/board.h
  6. 11
      boards/nucleo-f103/Makefile.include
  7. 39
      boards/nucleo-f103/include/board.h
  8. 11
      boards/nucleo-f303/Makefile.include
  9. 41
      boards/nucleo-f303/include/board.h
  10. 11
      boards/nucleo-f334/Makefile.include
  11. 41
      boards/nucleo-f334/include/board.h
  12. 11
      boards/nucleo-f401/Makefile.include
  13. 39
      boards/nucleo-f401/include/board.h
  14. 11
      boards/nucleo-l1/Makefile.include
  15. 41
      boards/nucleo-l1/include/board.h

3
boards/nucleo-common/Makefile

@ -0,0 +1,3 @@
MODULE = nucleo_common
include $(RIOTBASE)/Makefile.base

12
boards/nucleo-common/Makefile.include

@ -0,0 +1,12 @@
# define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# setup serial terminal
include $(RIOTBOARD)/Makefile.include.serial
# this board uses openocd
include $(RIOTBOARD)/Makefile.include.openocd
# add the common header files to the include path
INCLUDES += -I$(RIOTBOARD)/nucleo-common/include

60
boards/nucleo-common/include/board_common.h

@ -0,0 +1,60 @@
/*
* Copyright (C) 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
* directory for more details.
*/
/**
* @defgroup boards_nucleo_common STM Nucleo Common
* @ingroup drivers_periph
* @brief Common files for STM Nucleo boards
* @{
*
* @file
* @brief Common pin definitions and board configuration options
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef BOARD_COMMON__H
#define BOARD_COMMON__H
#include "cpu.h"
#include "periph_conf.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief LED pin definitions and handlers
* @{
*/
#define LED0_PIN GPIO_PIN(PORT_A, 5)
#define LED_MASK GPIOA
#define LED0_MASK (1 << 5)
#define LED0_ON (GPIOA->BRR = ~LED0_MASK)
#define LED0_OFF (GPIOA->OSRR = LED0_MASK)
#define LED0_TOGGLE (GPIOA->ODR ^= LED0_MASK)
/** @} */
/**
* @brief User button
*/
#define BTN_B1_PIN GPIO_PIN(PORT_C, 13)
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
#ifdef __cplusplus
}
#endif
#endif /* BOARD_COMMON__H */
/** @} */

11
boards/nucleo-f091/Makefile.include

@ -2,12 +2,5 @@
export CPU = stm32f0
export CPU_MODEL = stm32f091rc
#define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
# setup serial terminal
include $(RIOTBOARD)/Makefile.include.serial
# this board uses openocd
include $(RIOTBOARD)/Makefile.include.openocd
# load the common Makefile.include for Nucleo boards
include $(RIOTBOARD)/nucleo-common/Makefile.include

41
boards/nucleo-f091/include/board.h

@ -22,54 +22,15 @@
#ifndef BOARD_H_
#define BOARD_H_
#include <stdint.h>
#include "cpu.h"
#include "periph_conf.h"
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name LED pin definitions
* @{
*/
#define LED_GREEN_PORT (GPIOA)
#define LED_GREEN_PIN (5)
/** @} */
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_RED_ON
#define LED_RED_OFF
#define LED_RED_TOGGLE
#define LED_GREEN_ON (LED_GREEN_PORT->BSRR = (1 << LED_GREEN_PIN))
#define LED_GREEN_OFF (LED_GREEN_PORT->BSRR = ((1 << LED_GREEN_PIN) << 16))
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->ODR ^= (1 << LED_GREEN_PIN))
#define LED_ORANGE_ON
#define LED_ORANGE_OFF
#define LED_ORANGE_TOGGLE
/** @} */
/**
* @brief User button
*/
#define BTN_B1_PIN GPIO_PIN(PORT_C, 13)
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H_ */
/** @} */
/** @} */

11
boards/nucleo-f103/Makefile.include

@ -2,12 +2,5 @@
export CPU = stm32f1
export CPU_MODEL = stm32f103rb
#define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
# setup serial terminal
include $(RIOTBOARD)/Makefile.include.serial
# this board uses openocd
include $(RIOTBOARD)/Makefile.include.openocd
# load the common Makefile.include for Nucleo boards
include $(RIOTBOARD)/nucleo-common/Makefile.include

39
boards/nucleo-f103/include/board.h

@ -21,10 +21,7 @@
#ifndef BOARD_H_
#define BOARD_H_
#include <stdint.h>
#include "cpu.h"
#include "periph_conf.h"
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
@ -42,40 +39,6 @@ extern "C" {
#define XTIMER_BACKOFF 5
/** @} */
/**
* @name LED pin definitions
* @{
*/
#define LED_GREEN_GPIO GPIO_PIN(PORT_A, 5)
/** @} */
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_RED_ON
#define LED_RED_OFF
#define LED_RED_TOGGLE
#define LED_GREEN_ON (GPIOA->BSRR = (1 << 5))
#define LED_GREEN_OFF (GPIOA->BRR = (1 << 5))
#define LED_GREEN_TOGGLE (GPIOA->ODR ^= (1 << 5))
#define LED_ORANGE_ON
#define LED_ORANGE_OFF
#define LED_ORANGE_TOGGLE
/** @} */
/**
* @brief User button
*/
#define BTN_B1_PIN GPIO_PIN(PORT_C, 13)
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
#ifdef __cplusplus
}
#endif

11
boards/nucleo-f303/Makefile.include

@ -2,12 +2,5 @@
export CPU = stm32f3
export CPU_MODEL = stm32f303re
#define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
# setup serial terminal
include $(RIOTBOARD)/Makefile.include.serial
# this board uses openocd
include $(RIOTBOARD)/Makefile.include.openocd
# load the common Makefile.include for Nucleo boards
include $(RIOTBOARD)/nucleo-common/Makefile.include

41
boards/nucleo-f303/include/board.h

@ -23,54 +23,15 @@
#ifndef BOARD_H_
#define BOARD_H_
#include <stdint.h>
#include "cpu.h"
#include "periph_conf.h"
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name LED pin definitions
* @{
*/
#define LED_GREEN_PORT (GPIOA)
#define LED_GREEN_PIN (5)
/** @} */
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_RED_ON
#define LED_RED_OFF
#define LED_RED_TOGGLE
#define LED_GREEN_ON (LED_GREEN_PORT->BSRRL = (1 << LED_GREEN_PIN))
#define LED_GREEN_OFF (LED_GREEN_PORT->BSRRH = (1 << LED_GREEN_PIN))
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->ODR ^= (1 << LED_GREEN_PIN))
#define LED_ORANGE_ON
#define LED_ORANGE_OFF
#define LED_ORANGE_TOGGLE
/** @} */
/**
* @brief User button
*/
#define BTN_B1_PIN GPIO_PIN(PORT_C, 13)
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H_ */
/** @} */
/** @} */

11
boards/nucleo-f334/Makefile.include

@ -2,12 +2,5 @@
export CPU = stm32f3
export CPU_MODEL = stm32f334r8
#define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
# setup serial terminal
include $(RIOTBOARD)/Makefile.include.serial
# this board uses openocd
include $(RIOTBOARD)/Makefile.include.openocd
# load the common Makefile.include for Nucleo boards
include $(RIOTBOARD)/nucleo-common/Makefile.include

41
boards/nucleo-f334/include/board.h

@ -21,45 +21,12 @@
#ifndef BOARD_H_
#define BOARD_H_
#include <stdint.h>
#include "cpu.h"
#include "periph_conf.h"
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name LED pin definitions
* @{
*/
#define LED_GREEN_PORT (GPIOA)
#define LED_GREEN_PIN (5)
/** @} */
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_RED_ON
#define LED_RED_OFF
#define LED_RED_TOGGLE
#define LED_GREEN_ON (LED_GREEN_PORT->BSRRL = (1<<LED_GREEN_PIN))
#define LED_GREEN_OFF (LED_GREEN_PORT->BSRRH = (1<<LED_GREEN_PIN))
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->ODR ^= (1<<LED_GREEN_PIN))
#define LED_ORANGE_ON
#define LED_ORANGE_OFF
#define LED_ORANGE_TOGGLE
/** @} */
/**
* @brief User button
*/
#define BTN_B1_PIN GPIO_PIN(PORT_C, 13)
/**
* @name xtimer tuning values
* @{
@ -68,15 +35,9 @@ extern "C" {
#define XTIMER_SHOOT_EARLY 2
/** @} */
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H_ */
/** @} */
/** @} */

11
boards/nucleo-f401/Makefile.include

@ -2,12 +2,5 @@
export CPU = stm32f4
export CPU_MODEL = stm32f401re
# define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
# setup serial terminal
include $(RIOTBOARD)/Makefile.include.serial
# this board uses openocd
include $(RIOTBOARD)/Makefile.include.openocd
# load the common Makefile.include for Nucleo boards
include $(RIOTBOARD)/nucleo-common/Makefile.include

39
boards/nucleo-f401/include/board.h

@ -21,8 +21,7 @@
#ifndef BOARD_H_
#define BOARD_H_
#include "cpu.h"
#include "periph_conf.h"
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
@ -38,42 +37,6 @@ extern "C" {
#define XTIMER_BACKOFF (5)
/** @} */
/**
* @name LED pin definitions
* @{
*/
#define LED_GREEN_PORT (GPIOA)
#define LED_GREEN_PIN (5)
#define LED_GREEN_GPIO GPIO_PIN(PORT_A,5)
/** @} */
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_RED_ON
#define LED_RED_OFF
#define LED_RED_TOGGLE
#define LED_GREEN_ON (LED_GREEN_PORT->BSRRL = (1<<LED_GREEN_PIN))
#define LED_GREEN_OFF (LED_GREEN_PORT->BSRRH = (1<<LED_GREEN_PIN))
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->ODR ^= (1<<LED_GREEN_PIN))
#define LED_ORANGE_ON
#define LED_ORANGE_OFF
#define LED_ORANGE_TOGGLE
/** @} */
/**
* @brief User button
*/
#define BTN_B1_PIN GPIO_PIN(PORT_C, 13)
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
#ifdef __cplusplus
}
#endif

11
boards/nucleo-l1/Makefile.include

@ -2,12 +2,5 @@
export CPU = stm32l1
export CPU_MODEL = stm32l152ret6
# define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# setup serial terminal
include $(RIOTBOARD)/Makefile.include.serial
# this board uses openocd
include $(RIOTBOARD)/Makefile.include.openocd
# load the common Makefile.include for Nucleo boards
include $(RIOTBOARD)/nucleo-common/Makefile.include

41
boards/nucleo-l1/include/board.h

@ -21,10 +21,7 @@
#ifndef BOARD_H_
#define BOARD_H_
#include <stdint.h>
#include "cpu.h"
#include "periph_conf.h"
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
@ -40,45 +37,9 @@ extern "C" {
#define XTIMER_BACKOFF (3)
/** @} */
/**
* @name LED pin definitions
* @{
*/
#define LED_GREEN_PORT (GPIOA)
#define LED_GREEN_PIN (5)
/** @} */
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_RED_ON
#define LED_RED_OFF
#define LED_RED_TOGGLE
#define LED_GREEN_ON (LED_GREEN_PORT->ODR &= ~(1<<LED_GREEN_PIN))
#define LED_GREEN_OFF (LED_GREEN_PORT->ODR |= (1<<LED_GREEN_PIN))
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->ODR ^= (1<<LED_GREEN_PIN))
#define LED_ORANGE_ON
#define LED_ORANGE_OFF
#define LED_ORANGE_TOGGLE
/** @} */
/**
* @brief User button
*/
#define BTN_B1_PIN GPIO_PIN(PORT_C, 13)
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H_ */
/** @} */
/** @} */

Loading…
Cancel
Save