Skip to content
Snippets Groups Projects
Commit 5e8c92d6 authored by Alexandre Abadie's avatar Alexandre Abadie
Browse files

boards/nrf51dongle: factorize common code

parent a4463be1
No related branches found
No related tags found
No related merge requests found
ifneq (,$(filter gnrc_netdev_default netdev_default,$(USEMODULE))) include $(RIOTBOARD)/common/nrf51/Makefile.dep
USEMODULE += nrfmin
endif
# Put defined MCU peripherals here (in alphabetical order) # Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_gpio periph_gpio_irq
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart FEATURES_PROVIDED += periph_uart
# Various other features (if any) # include common nrf51 based boards features
include $(RIOTBOARD)/common/nrf51/Makefile.features
# The board MPU family (used for grouping by the CI system)
FEATURES_MCU_GROUP = cortex_m0_1
include $(RIOTCPU)/nrf51/Makefile.features
# define the used CPU # define the used CPU
export CPU = nrf51
export CPU_MODEL = nrf51x22xxab export CPU_MODEL = nrf51x22xxab
# define the default port depending on the host OS # define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyACM0 PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# setup JLink for flashing # use jlink to program this board
export JLINK_DEVICE := nrf51822 PROGRAMMER ?= jlink
include $(RIOTMAKE)/tools/jlink.inc.mk
# setup serial terminal # set required jlink debug adapter for openocd if it's used
include $(RIOTMAKE)/tools/serial.inc.mk ifeq (openocd,$(PROGRAMMER))
DEBUG_ADAPTER = jlink
endif
# include nrf51 boards common configuration
include $(RIOTBOARD)/common/nrf51/Makefile.include
...@@ -19,21 +19,12 @@ ...@@ -19,21 +19,12 @@
#ifndef BOARD_H #ifndef BOARD_H
#define BOARD_H #define BOARD_H
#include "cpu.h" #include "board_common.h"
#include "periph_conf.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/**
* @name Xtimer configuration
* @{
*/
#define XTIMER_WIDTH (24)
#define XTIMER_BACKOFF (40)
/** @} */
/** /**
* @name LED pin definitions and handlers * @name LED pin definitions and handlers
* @{ * @{
...@@ -59,11 +50,6 @@ extern "C" { ...@@ -59,11 +50,6 @@ extern "C" {
#define LED2_TOGGLE (NRF_GPIO->OUT ^= LED2_MASK) #define LED2_TOGGLE (NRF_GPIO->OUT ^= LED2_MASK)
/** @} */ /** @} */
/**
* @brief Initialize the board, also triggers the CPU initialization
*/
void board_init(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define PERIPH_CONF_H #define PERIPH_CONF_H
#include "periph_cpu.h" #include "periph_cpu.h"
#include "periph_conf_common.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
...@@ -40,30 +41,6 @@ extern "C" { ...@@ -40,30 +41,6 @@ extern "C" {
* 2: derived from HFCLK */ * 2: derived from HFCLK */
/** @} */ /** @} */
/**
* @name Timer configuration
* @{
*/
static const timer_conf_t timer_config[] = {
/* dev, channels, width */
{ NRF_TIMER0, 3, TIMER_BITMODE_BITMODE_24Bit, TIMER0_IRQn }
};
#define TIMER_0_ISR isr_timer0
#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0]))
/** @} */
/**
* @name Real time counter configuration
* @{
*/
#define RTT_NUMOF (1U)
#define RTT_DEV (1) /* NRF_RTC1 */
#define RTT_MAX_VALUE (0x00ffffff)
#define RTT_FREQUENCY (1024)
/** @} */
/** /**
* @name UART configuration * @name UART configuration
* @{ * @{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment