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

boards/nrf51-based: split shared timer/rtt config

This commit is contained in:
Hauke Petersen 2019-06-04 12:59:59 +02:00
parent fcd7f2233a
commit 44625ecc1b
10 changed files with 146 additions and 103 deletions

View File

@ -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" {

View File

@ -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
* @{

View File

@ -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
@ -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
* @{
@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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
* @{

View File

@ -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" {

View File

@ -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" {

View File

@ -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" {

View File

@ -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" {