Skip to content

Commit

Permalink
boards: efm32 boards: add support for LETIMER
Browse files Browse the repository at this point in the history
  • Loading branch information
benemorius committed Jul 11, 2020
1 parent 37a6cc6 commit 754d790
Show file tree
Hide file tree
Showing 14 changed files with 176 additions and 45 deletions.
6 changes: 5 additions & 1 deletion boards/ikea-tradfri/include/board.h
Expand Up @@ -31,10 +31,14 @@ extern "C" {
/**
* @name Xtimer configuration
*
* The timer runs at 250 KHz to increase accuracy.
* The timer runs at 250 kHz to increase accuracy or 32768 Hz for LETIMER.
* @{
*/
#ifdef EFM32_USE_LETIMER
#define XTIMER_HZ (32768UL)
#else
#define XTIMER_HZ (250000UL)
#endif
#define XTIMER_WIDTH (16)
/** @} */

Expand Down
25 changes: 20 additions & 5 deletions boards/ikea-tradfri/include/periph_conf.h
Expand Up @@ -48,7 +48,6 @@ extern "C" {
#endif
/** @} */


/**
* @name RTT configuration
* @{
Expand Down Expand Up @@ -82,25 +81,41 @@ static const spi_dev_t spi_config[] = {
/**
* @name Timer configuration
*
* The implementation uses two timers in cascade mode.
* The implementation can use one low-energy timer
* or two regular timers in cascade mode.
* @{
*/
#if EFM32_USE_LETIMER
static const timer_conf_t timer_config[] = {
{
.timer = {
.dev = LETIMER0,
.cmu = cmuClock_LETIMER0
},
.irq = LETIMER0_IRQn
}
};
#define TIMER_0_ISR isr_letimer0

#else
static const timer_conf_t timer_config[] = {
{
{
.prescaler = {
.dev = TIMER0,
.cmu = cmuClock_TIMER0
},
{
.timer = {
.dev = TIMER1,
.cmu = cmuClock_TIMER1
},
.irq = TIMER1_IRQn
}
};
#define TIMER_0_ISR isr_timer1

#endif /* EFM32_USE_LETIMER */

#define TIMER_NUMOF ARRAY_SIZE(timer_config)
#define TIMER_0_ISR isr_timer1
/** @} */

/**
Expand Down
6 changes: 5 additions & 1 deletion boards/slstk3401a/include/board.h
Expand Up @@ -32,10 +32,14 @@ extern "C" {
/**
* @name Xtimer configuration
*
* The timer runs at 250 KHz to increase accuracy.
* The timer runs at 250 KHz to increase accuracy or 32768 Hz for LETIMER.
* @{
*/
#ifdef EFM32_USE_LETIMER
#define XTIMER_HZ (32768UL)
#else
#define XTIMER_HZ (250000UL)
#endif
#define XTIMER_WIDTH (16)
/** @} */

Expand Down
24 changes: 20 additions & 4 deletions boards/slstk3401a/include/periph_conf.h
Expand Up @@ -141,25 +141,41 @@ static const spi_dev_t spi_config[] = {
/**
* @name Timer configuration
*
* The implementation uses two timers in cascade mode.
* The implementation can use one low-energy timer
* or two regular timers in cascade mode.
* @{
*/
#if EFM32_USE_LETIMER
static const timer_conf_t timer_config[] = {
{
{
.timer = {
.dev = LETIMER0,
.cmu = cmuClock_LETIMER0
},
.irq = LETIMER0_IRQn
}
};
#define TIMER_0_ISR isr_letimer0

#else
static const timer_conf_t timer_config[] = {
{
.prescaler = {
.dev = TIMER0,
.cmu = cmuClock_TIMER0
},
{
.timer = {
.dev = TIMER1,
.cmu = cmuClock_TIMER1
},
.irq = TIMER1_IRQn
}
};
#define TIMER_0_ISR isr_timer1

#endif /* EFM32_USE_LETIMER */

#define TIMER_NUMOF ARRAY_SIZE(timer_config)
#define TIMER_0_ISR isr_timer1
/** @} */

/**
Expand Down
5 changes: 5 additions & 0 deletions boards/slstk3402a/include/board.h
Expand Up @@ -33,8 +33,13 @@ extern "C" {
* @name Xtimer configuration
* @{
*/
#ifdef EFM32_USE_LETIMER
#define XTIMER_HZ (32768UL)
#define XTIMER_WIDTH (16)
#else
#define XTIMER_HZ (1000000UL)
#define XTIMER_WIDTH (32)
#endif
/** @} */

/**
Expand Down
24 changes: 20 additions & 4 deletions boards/slstk3402a/include/periph_conf.h
Expand Up @@ -132,25 +132,41 @@ static const spi_dev_t spi_config[] = {
/**
* @name Timer configuration
*
* The implementation uses two timers in cascade mode.
* The implementation can use one low-energy timer
* or two regular timers in cascade mode.
* @{
*/
#if EFM32_USE_LETIMER
static const timer_conf_t timer_config[] = {
{
{
.timer = {
.dev = LETIMER0,
.cmu = cmuClock_LETIMER0
},
.irq = LETIMER0_IRQn
}
};
#define TIMER_0_ISR isr_letimer0

#else
static const timer_conf_t timer_config[] = {
{
.prescaler = {
.dev = WTIMER0,
.cmu = cmuClock_WTIMER0
},
{
.timer = {
.dev = WTIMER1,
.cmu = cmuClock_WTIMER1
},
.irq = WTIMER1_IRQn
}
};
#define TIMER_0_ISR isr_wtimer1

#endif /* EFM32_USE_LETIMER */

#define TIMER_NUMOF ARRAY_SIZE(timer_config)
#define TIMER_0_ISR isr_wtimer1
/** @} */

/**
Expand Down
7 changes: 6 additions & 1 deletion boards/sltb001a/include/board.h
Expand Up @@ -32,11 +32,16 @@ extern "C" {
/**
* @name Xtimer configuration
*
* The timer runs at 250 KHz to increase accuracy.
* The timer runs at 250 KHz to increase accuracy or 32768 Hz for LETIMER.
* @{
*/
#ifdef EFM32_USE_LETIMER
#define XTIMER_HZ (32768UL)
#define XTIMER_WIDTH (16)
#else
#define XTIMER_HZ (250000UL)
#define XTIMER_WIDTH (16)
#endif
/** @} */

/**
Expand Down
24 changes: 20 additions & 4 deletions boards/sltb001a/include/periph_conf.h
Expand Up @@ -141,25 +141,41 @@ static const spi_dev_t spi_config[] = {
/**
* @name Timer configuration
*
* The implementation uses two timers in cascade mode.
* The implementation can use one low-energy timer
* or two regular timers in cascade mode.
* @{
*/
#if EFM32_USE_LETIMER
static const timer_conf_t timer_config[] = {
{
{
.timer = {
.dev = LETIMER0,
.cmu = cmuClock_LETIMER0
},
.irq = LETIMER0_IRQn
}
};
#define TIMER_0_ISR isr_letimer0

#else
static const timer_conf_t timer_config[] = {
{
.prescaler = {
.dev = TIMER0,
.cmu = cmuClock_TIMER0
},
{
.timer = {
.dev = TIMER1,
.cmu = cmuClock_TIMER1
},
.irq = TIMER1_IRQn
}
};
#define TIMER_0_ISR isr_timer1

#endif /* EFM32_USE_LETIMER */

#define TIMER_NUMOF ARRAY_SIZE(timer_config)
#define TIMER_0_ISR isr_timer1
/** @} */

/**
Expand Down
7 changes: 6 additions & 1 deletion boards/stk3600/include/board.h
Expand Up @@ -32,11 +32,16 @@ extern "C" {
/**
* @name Xtimer configuration
*
* The timer runs at 250 KHz to increase accuracy.
* The timer runs at 250 KHz to increase accuracy or 32768 Hz for LETIMER.
* @{
*/
#ifdef EFM32_USE_LETIMER
#define XTIMER_HZ (32768UL)
#define XTIMER_WIDTH (16)
#else
#define XTIMER_HZ (250000UL)
#define XTIMER_WIDTH (16)
#endif
/** @} */

/**
Expand Down
25 changes: 20 additions & 5 deletions boards/stk3600/include/periph_conf.h
Expand Up @@ -155,7 +155,6 @@ static const pwm_conf_t pwm_config[] = {
#define PWM_NUMOF ARRAY_SIZE(pwm_channel_config)
/** @} */


/**
* @name RTT configuration
* @{
Expand Down Expand Up @@ -196,25 +195,41 @@ static const spi_dev_t spi_config[] = {
/**
* @name Timer configuration
*
* The implementation uses two timers in cascade mode.
* The implementation can use one low-energy timer
* or two regular timers in cascade mode.
* @{
*/
#if EFM32_USE_LETIMER
static const timer_conf_t timer_config[] = {
{
.timer = {
.dev = LETIMER0,
.cmu = cmuClock_LETIMER0
},
.irq = LETIMER0_IRQn
}
};
#define TIMER_0_ISR isr_letimer0

#else
static const timer_conf_t timer_config[] = {
{
{
.prescaler = {
.dev = TIMER0,
.cmu = cmuClock_TIMER0
},
{
.timer = {
.dev = TIMER1,
.cmu = cmuClock_TIMER1
},
.irq = TIMER1_IRQn
}
};
#define TIMER_0_ISR isr_timer1

#endif /* EFM32_USE_LETIMER */

#define TIMER_NUMOF ARRAY_SIZE(timer_config)
#define TIMER_0_ISR isr_timer1
/** @} */

/**
Expand Down
7 changes: 6 additions & 1 deletion boards/stk3700/include/board.h
Expand Up @@ -32,11 +32,16 @@ extern "C" {
/**
* @name Xtimer configuration
*
* The timer runs at 250 KHz to increase accuracy.
* The timer runs at 250 KHz to increase accuracy or 32768 Hz for LETIMER.
* @{
*/
#ifdef EFM32_USE_LETIMER
#define XTIMER_HZ (32768UL)
#define XTIMER_WIDTH (16)
#else
#define XTIMER_HZ (250000UL)
#define XTIMER_WIDTH (16)
#endif
/** @} */

/**
Expand Down
25 changes: 20 additions & 5 deletions boards/stk3700/include/periph_conf.h
Expand Up @@ -155,7 +155,6 @@ static const pwm_conf_t pwm_config[] = {
#define PWM_NUMOF ARRAY_SIZE(pwm_channel_config)
/** @} */


/**
* @name RTT configuration
* @{
Expand Down Expand Up @@ -196,25 +195,41 @@ static const spi_dev_t spi_config[] = {
/**
* @name Timer configuration
*
* The implementation uses two timers in cascade mode.
* The implementation can use one low-energy timer
* or two regular timers in cascade mode.
* @{
*/
#if EFM32_USE_LETIMER
static const timer_conf_t timer_config[] = {
{
.timer = {
.dev = LETIMER0,
.cmu = cmuClock_LETIMER0
},
.irq = LETIMER0_IRQn
}
};
#define TIMER_0_ISR isr_letimer0

#else
static const timer_conf_t timer_config[] = {
{
{
.prescaler = {
.dev = TIMER0,
.cmu = cmuClock_TIMER0
},
{
.timer = {
.dev = TIMER1,
.cmu = cmuClock_TIMER1
},
.irq = TIMER1_IRQn
}
};
#define TIMER_0_ISR isr_timer1

#endif /* EFM32_USE_LETIMER */

#define TIMER_NUMOF ARRAY_SIZE(timer_config)
#define TIMER_0_ISR isr_timer1
/** @} */

/**
Expand Down

0 comments on commit 754d790

Please sign in to comment.