Skip to content

Commit

Permalink
samr21: implemented 32 bit hwtimer
Browse files Browse the repository at this point in the history
  • Loading branch information
Troels51 committed Dec 17, 2014
1 parent 17d2f57 commit 7124ec6
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 175 deletions.
4 changes: 2 additions & 2 deletions boards/samr21-xpro/include/board.h
Expand Up @@ -30,12 +30,12 @@ extern "C" {
/**
* Define the nominal CPU core clock in this board
*/
#define F_CPU (48000000UL)
#define F_CPU (8000000UL)

/**
* Assign the hardware timer
*/
#define HW_TIMER TIMER_0
#define HW_TIMER TIMER_1

/**
* @name Define UART device and baudrate for stdio
Expand Down
31 changes: 12 additions & 19 deletions boards/samr21-xpro/include/periph_conf.h
Expand Up @@ -27,30 +27,23 @@ extern "C" {
* @name Timer peripheral configuration
* @{
*/
#define TIMER_NUMOF (3U)
#define TIMER_0_EN 1
#define TIMER_1_EN 1
#define TIMER_2_EN 1
#define TIMER_NUMOF (2U)
#define TIMER_0_EN 1
#define TIMER_1_EN 1

/* Timer 0 configuration */
#define TIMER_0_DEV TC3->COUNT16
#define TIMER_0_CHANNELS 2
#define TIMER_0_MAX_VALUE (0xffff)
#define TIMER_0_ISR isr_tc3
#define TIMER_0_DEV TC3->COUNT16
#define TIMER_0_CHANNELS 2
#define TIMER_0_MAX_VALUE (0xffff)
#define TIMER_0_ISR isr_tc3

/* Timer 1 configuration */
#define TIMER_1_DEV TC4->COUNT16
#define TIMER_1_CHANNELS 2
#define TIMER_1_MAX_VALUE (0xffff)
#define TIMER_1_ISR isr_tc4

/* Timer 2 configuration */
#define TIMER_2_DEV TC5->COUNT16
#define TIMER_2_CHANNELS 2
#define TIMER_2_MAX_VALUE (0xffff)
#define TIMER_2_ISR isr_tc5
/** @} */
#define TIMER_1_DEV TC4->COUNT32
#define TIMER_1_CHANNELS 2
#define TIMER_1_MAX_VALUE (0xffffffff)
#define TIMER_1_ISR isr_tc4

/** @} */

/**
* @name UART configuration
Expand Down
6 changes: 3 additions & 3 deletions cpu/samd21/include/hwtimer_cpu.h
Expand Up @@ -27,9 +27,9 @@ extern "C" {
* @name Hardware timer configuration
* @{
*/
#define HWTIMER_MAXTIMERS 2 /**< the CPU implementation supports 2 HW timers */
#define HWTIMER_SPEED (124999U) /**< the HW timer runs with 125kHz */
#define HWTIMER_MAXTICKS (0xFFFF) /**< 16-bit timer */
#define HWTIMER_MAXTIMERS 2 /**< the CPU implementation supports 1 HW timer */
#define HWTIMER_SPEED (1000000U) /**< the HW timer runs with 1MHz */
#define HWTIMER_MAXTICKS (0xFFFFFFFF) /**< 32-bit timer */
/** @} */

#ifdef __cplusplus
Expand Down

0 comments on commit 7124ec6

Please sign in to comment.