1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 22:13:52 +01:00

board/samr21-xpro: enabled PWM feature

This commit is contained in:
Hauke Petersen 2015-05-31 00:46:24 +02:00 committed by haukepetersen
parent d9deb569b2
commit 92e37e4392
2 changed files with 67 additions and 5 deletions

View File

@ -1,11 +1,15 @@
FEATURES_PROVIDED += transceiver
FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += periph_gpio
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_pwm
FEATURES_MCU_GROUP = cortex_m0

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 Freie Universität Berlin
* Copyright (C) 2014-2015 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
@ -15,12 +15,16 @@
* Pro board
*
* @author Thomas Eichinger <thomas.eichinger@fu-berlin.de>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>s
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* @author Peter Kietzmann <peter.kietzmann@haw-hamburg.de>
*/
#ifndef __PERIPH_CONF_H
#define __PERIPH_CONF_H
#include <stdint.h>
#include "cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -112,6 +116,60 @@ extern "C" {
#define UART_0_PINS (PORT_PA04 | PORT_PA05)
/** @} */
/**
* @name PWM configuration
* @{
*/
#define PWM_NUMOF (PWM_0_EN + PWM_1_EN)
#define PWM_0_EN 1
#define PWM_1_EN 1
#define PWM_MAX_CHANNELS 2
/* for compatibility with test application */
#define PWM_0_CHANNELS PWM_MAX_CHANNELS
#define PWM_1_CHANNELS PWM_MAX_CHANNELS
/**
* @brief PWM channel configuration data structure
*
* TODO: this should be moved into the CPU folder
*/
typedef struct {
PortGroup *port; /**< GPIO port */
uint8_t pin; /**< GPIO pin */
uint8_t fnct; /**< pin function multiplex value */
uint8_t chan; /**< TCC channel to use */
} pwm_conf_chan_t;
/**
* @brief PWM device configuration data structure
*
* TODO: this should be moved into the CPU folder
*/
typedef struct {
Tcc *dev; /*< TCC device to use */
pwm_conf_chan_t chan[2]; /**< channel configuration */
} pwm_conf_t;
/* PWM device configuration */
#if PWM_NUMOF
static const pwm_conf_t pwm_config[] = {
#if PWM_0_EN
{TCC1, {
/* port , pin, AF, chan */
{(PortGroup *)0x41004400, 6, 4, 0},
{(PortGroup *)0x41004400, 7, 4, 1}
}},
#endif
#if PWM_1_EN
{TCC0, {
/* port , pin, AF, chan */
{(PortGroup *)0x41004400, 18, 5, 2},
{(PortGroup *)0x41004400, 19, 5, 3}
}},
#endif
};
#endif
/** @} */
/**
* @name SPI configuration
@ -241,8 +299,8 @@ extern "C" {
#define GPIO_2_PIN (15)
#define GPIO_2_EXTINT (15)
/* GPIO channel 3 config */
#define GPIO_3_DEV PORT->Group[0]
#define GPIO_3_PIN (19)
#define GPIO_3_DEV PORT->Group[1]
#define GPIO_3_PIN (3)
#define GPIO_3_EXTINT (3)
/* GPIO 4-7 Internal radio pins*/
/* GPIO channel 4 config radio CS*/