Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion boards/airfy-beacon/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
#define PERIPH_CONF_H

#include "periph_cpu.h"
#include "periph_conf_common.h"
#include "cfg_clock_16_1.h"
#include "cfg_timer_012.h"
#include "cfg_rtt_default.h"

#ifdef __cplusplus
extern "C" {
Expand Down
37 changes: 2 additions & 35 deletions boards/calliope-mini/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,46 +22,13 @@

#include "periph_cpu.h"
#include "cfg_clock_16_0.h"
#include "cfg_timer_012.h"
#include "cfg_rtt_default.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @name Timer configuration
* @{
*/
static const timer_conf_t timer_config[] = {
{
.dev = NRF_TIMER0,
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_24Bit,
.irqn = TIMER0_IRQn
},
{
.dev = NRF_TIMER1,
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_16Bit,
.irqn = TIMER1_IRQn
}
};

#define TIMER_0_ISR isr_timer0
#define TIMER_1_ISR isr_timer1

#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
* @{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 Inria
* 2019 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
Expand All @@ -11,34 +12,19 @@
* @{
*
* @file
* @brief Common peripheral MCU configuration for some nrf51 based boards
* @brief Shared default RTT configuration for nRF51-based boards
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/

#ifndef PERIPH_CONF_COMMON_H
#define PERIPH_CONF_COMMON_H

#include "periph_cpu.h"
#ifndef CFG_RTT_DEFAULT_H
#define CFG_RTT_DEFAULT_H

#ifdef __cplusplus
extern "C" {
extern "C" {
#endif

/**
* @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
* @{
Expand All @@ -53,4 +39,4 @@ static const timer_conf_t timer_config[] = {
} /* end extern "C" */
#endif

#endif /* PERIPH_CONF_COMMON_H */
#endif /* CFG_RTT_DEFAULT_H */
59 changes: 59 additions & 0 deletions boards/common/nrf51/include/cfg_timer_01.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright (C) 2018 Inria
* 2019 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.
*/

/**
* @ingroup boards_common_nrf51
* @{
*
* @file
* @brief Shared timer peripheral configuration mapping timers 0 and 1
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/

#ifndef CFG_TIMER_01_H
#define CFG_TIMER_01_H

#include "periph_cpu.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @name Timer configuration
* @{
*/
static const timer_conf_t timer_config[] = {
{
.dev = NRF_TIMER0,
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_24Bit,
.irqn = TIMER0_IRQn,
},
{
.dev = NRF_TIMER1,
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_16Bit,
.irqn = TIMER1_IRQn,
}
};

#define TIMER_0_ISR isr_timer0
#define TIMER_1_ISR isr_timer1

#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0]))
/** @} */

#ifdef __cplusplus
} /* end extern "C" */
#endif

#endif /* CFG_TIMER_01_H */
66 changes: 66 additions & 0 deletions boards/common/nrf51/include/cfg_timer_012.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright (C) 2018 Inria
* 2019 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.
*/

/**
* @ingroup boards_common_nrf51
* @{
*
* @file
* @brief Shared timer peripheral configuration mapping timers 0, 1, and 2
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/

#ifndef CFG_TIMER_012_H
#define CFG_TIMER_012_H

#include "periph_cpu.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @name Timer configuration
* @{
*/
static const timer_conf_t timer_config[] = {
{
.dev = NRF_TIMER0,
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_24Bit,
.irqn = TIMER0_IRQn,
},
{
.dev = NRF_TIMER1,
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_16Bit,
.irqn = TIMER1_IRQn,
},
{
.dev = NRF_TIMER2,
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_16Bit,
.irqn = TIMER2_IRQn,
}
};

#define TIMER_0_ISR isr_timer0
#define TIMER_1_ISR isr_timer1
#define TIMER_2_ISR isr_timer2

#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0]))
/** @} */

#ifdef __cplusplus
} /* end extern "C" */
#endif

#endif /* CFG_TIMER_012_H */
44 changes: 2 additions & 42 deletions boards/microbit/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,53 +21,13 @@

#include "periph_cpu.h"
#include "cfg_clock_16_0.h"
#include "cfg_timer_012.h"
#include "cfg_rtt_default.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @name Timer configuration
* @{
*/
static const timer_conf_t timer_config[] = {
{
.dev = NRF_TIMER0,
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_24Bit,
.irqn = TIMER0_IRQn
},
{
.dev = NRF_TIMER1,
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_16Bit,
.irqn = TIMER1_IRQn
},
{
.dev = NRF_TIMER2,
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_16Bit,
.irqn = TIMER2_IRQn
}
};

#define TIMER_0_ISR isr_timer0
#define TIMER_1_ISR isr_timer1
#define TIMER_2_ISR isr_timer2

#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
* @{
Expand Down
3 changes: 2 additions & 1 deletion boards/nrf51dk/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
#define PERIPH_CONF_H

#include "periph_cpu.h"
#include "periph_conf_common.h"
#include "cfg_clock_16_1.h"
#include "cfg_timer_012.h"
#include "cfg_rtt_default.h"

#ifdef __cplusplus
extern "C" {
Expand Down
3 changes: 2 additions & 1 deletion boards/nrf51dongle/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
#define PERIPH_CONF_H

#include "periph_cpu.h"
#include "periph_conf_common.h"
#include "cfg_clock_16_1.h"
#include "cfg_timer_012.h"
#include "cfg_rtt_default.h"

#ifdef __cplusplus
extern "C" {
Expand Down
3 changes: 2 additions & 1 deletion boards/nrf6310/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
#define PERIPH_CONF_H

#include "periph_cpu.h"
#include "periph_conf_common.h"
#include "cfg_clock_16_1.h"
#include "cfg_timer_012.h"
#include "cfg_rtt_default.h"

#ifdef __cplusplus
extern "C" {
Expand Down
3 changes: 2 additions & 1 deletion boards/yunjia-nrf51822/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
#define PERIPH_CONF_H

#include "periph_cpu.h"
#include "periph_conf_common.h"
#include "cfg_clock_16_0.h"
#include "cfg_timer_012.h"
#include "cfg_rtt_default.h"

#ifdef __cplusplus
extern "C" {
Expand Down