mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
boards/common/saml1x: enable PWM
The PWM for the on-board LED can only be used if xTimer is not sourced from TC0_TC1.
This commit is contained in:
parent
0437461812
commit
fc6d1f9122
@ -9,6 +9,7 @@ config BOARD_COMMON_SAML1X
|
||||
select HAS_PERIPH_ADC
|
||||
select HAS_PERIPH_DAC
|
||||
select HAS_PERIPH_I2C
|
||||
select HAS_PERIPH_PWM
|
||||
select HAS_PERIPH_RTC
|
||||
select HAS_PERIPH_RTT
|
||||
select HAS_PERIPH_SPI
|
||||
|
@ -4,6 +4,7 @@ CPU = saml1x
|
||||
FEATURES_PROVIDED += periph_adc
|
||||
FEATURES_PROVIDED += periph_dac
|
||||
FEATURES_PROVIDED += periph_i2c
|
||||
FEATURES_PROVIDED += periph_pwm
|
||||
FEATURES_PROVIDED += periph_rtc
|
||||
FEATURES_PROVIDED += periph_rtt
|
||||
FEATURES_PROVIDED += periph_spi
|
||||
|
@ -103,6 +103,52 @@ static const uart_conf_t uart_config[] = {
|
||||
#define UART_NUMOF ARRAY_SIZE(uart_config)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name PWM configuration
|
||||
* @{
|
||||
*/
|
||||
#define PWM_0_EN 1
|
||||
#define PWM_1_EN 0
|
||||
|
||||
#if PWM_0_EN
|
||||
/* PWM0 channels */
|
||||
static const pwm_conf_chan_t pwm_chan0_config[] = {
|
||||
/* GPIO pin, MUX value, TC channel */
|
||||
{ GPIO_PIN(PA, 18), GPIO_MUX_E, 0 },
|
||||
{ GPIO_PIN(PA, 19), GPIO_MUX_E, 1 },
|
||||
};
|
||||
#endif
|
||||
#if PWM_1_EN
|
||||
/* PWM1 channels */
|
||||
static const pwm_conf_chan_t pwm_chan1_config[] = {
|
||||
/* GPIO pin, MUX value, TC channel */
|
||||
{ GPIO_PIN(PA, 7), GPIO_MUX_E, 1 }, /* LED */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* PWM device configuration */
|
||||
static const pwm_conf_t pwm_config[] = {
|
||||
#if PWM_0_EN
|
||||
{ .tim = TC_CONFIG(TC2),
|
||||
.chan = pwm_chan0_config,
|
||||
.chan_numof = ARRAY_SIZE(pwm_chan0_config),
|
||||
.gclk_src = SAM0_GCLK_MAIN,
|
||||
},
|
||||
#endif
|
||||
#if PWM_1_EN
|
||||
/* conflicts with xtimer config (TC0_TC1) */
|
||||
{ .tim = TC_CONFIG(TC1),
|
||||
.chan = pwm_chan1_config,
|
||||
.chan_numof = ARRAY_SIZE(pwm_chan0_config),
|
||||
.gclk_src = SAM0_GCLK_MAIN,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
/* number of devices that are actually defined */
|
||||
#define PWM_NUMOF ARRAY_SIZE(pwm_config)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name SPI configuration
|
||||
* @{
|
||||
|
Loading…
Reference in New Issue
Block a user