1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/nrf51dongle: factorize common code

This commit is contained in:
Alexandre Abadie 2018-10-24 17:59:02 +02:00
parent a4463be1e3
commit 5e8c92d69c
5 changed files with 14 additions and 57 deletions

View File

@ -1,3 +1 @@
ifneq (,$(filter gnrc_netdev_default netdev_default,$(USEMODULE)))
USEMODULE += nrfmin
endif
include $(RIOTBOARD)/common/nrf51/Makefile.dep

View File

@ -1,12 +1,5 @@
# 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
# Various other features (if any)
# The board MPU family (used for grouping by the CI system)
FEATURES_MCU_GROUP = cortex_m0_1
include $(RIOTCPU)/nrf51/Makefile.features
# include common nrf51 based boards features
include $(RIOTBOARD)/common/nrf51/Makefile.features

View File

@ -1,14 +1,17 @@
# define the used CPU
export CPU = nrf51
export CPU_MODEL = nrf51x22xxab
# define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# setup JLink for flashing
export JLINK_DEVICE := nrf51822
include $(RIOTMAKE)/tools/jlink.inc.mk
# use jlink to program this board
PROGRAMMER ?= jlink
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk
# set required jlink debug adapter for openocd if it's used
ifeq (openocd,$(PROGRAMMER))
DEBUG_ADAPTER = jlink
endif
# include nrf51 boards common configuration
include $(RIOTBOARD)/common/nrf51/Makefile.include

View File

@ -19,21 +19,12 @@
#ifndef BOARD_H
#define BOARD_H
#include "cpu.h"
#include "periph_conf.h"
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Xtimer configuration
* @{
*/
#define XTIMER_WIDTH (24)
#define XTIMER_BACKOFF (40)
/** @} */
/**
* @name LED pin definitions and handlers
* @{
@ -59,11 +50,6 @@ extern "C" {
#define LED2_TOGGLE (NRF_GPIO->OUT ^= LED2_MASK)
/** @} */
/**
* @brief Initialize the board, also triggers the CPU initialization
*/
void board_init(void);
#ifdef __cplusplus
}
#endif

View File

@ -20,6 +20,7 @@
#define PERIPH_CONF_H
#include "periph_cpu.h"
#include "periph_conf_common.h"
#ifdef __cplusplus
extern "C" {
@ -40,30 +41,6 @@ extern "C" {
* 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
* @{