From 00e13e5713715839655acdb17ab9c278c8864fa2 Mon Sep 17 00:00:00 2001
From: Bas Stottelaar <basstottelaar@gmail.com>
Date: Sun, 30 Dec 2018 23:55:59 +0100
Subject: [PATCH] boards: slstk3402a: use wtimer by default

---
 boards/slstk3402a/doc.txt               | 26 ++++++++++++-------------
 boards/slstk3402a/include/board.h       |  6 ++----
 boards/slstk3402a/include/periph_conf.h | 12 ++++++------
 3 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/boards/slstk3402a/doc.txt b/boards/slstk3402a/doc.txt
index 0461637167..0bf006f90f 100644
--- a/boards/slstk3402a/doc.txt
+++ b/boards/slstk3402a/doc.txt
@@ -55,19 +55,19 @@ This is the pinout of the expansion header on the right side of the board. PIN 1
 **Note:** some pins are connected to the board controller, when enabled!
 
 ### Peripheral mapping
-| Peripheral | Number  | Hardware        | Pins                            | Comments                                                  |
-|------------|---------|-----------------|---------------------------------|-----------------------------------------------------------|
-| ADC        | 0       | ADC0            | CHAN0: internal temperature     | Ports are fixed, 14/16-bit resolution not supported       |
-| I2C        | 0       | I2C0            | SDA: PC10, CLK: PC11            | `I2C_SPEED_LOW` and `I2C_SPEED_HIGH` clock speed deviate  |
-| HWCRYPTO   | &mdash; | &mdash;         |                                 | AES128/AES256, SHA1, SHA256                               |
-| HWRNG      | &mdash; | TNRG0           |                                 | Hardware-based true random number generator               |
-| RTT        | &mdash; | RTCC            |                                 | 1 Hz interval. Either RTT or RTC (see below)              |
-| RTC        | &mdash; | RTCC            |                                 | 1 Hz interval. Either RTC or RTT (see below)              |
-| SPI        | 0       | USART1          | MOSI: PC6, MISO: PC7, CLK: PC8  |                                                           |
-| Timer      | 0       | TIMER0 + TIMER1 |                                 | TIMER0 is used as prescaler (must be adjecent)            |
-| UART       | 0       | USART0          | RX: PA1, TX: PA0                | Default STDIO output                                      |
-|            | 1       | USART1          | RX: PC6, TX: PC7                |                                                           |
-|            | 2       | LEUART0         | RX: PD11, TX: PD10              | Baud rate limited (see below)                             |
+| Peripheral | Number  | Hardware          | Pins                            | Comments                                                  |
+|------------|---------|-------------------|---------------------------------|-----------------------------------------------------------|
+| ADC        | 0       | ADC0              | CHAN0: internal temperature     | Ports are fixed, 14/16-bit resolution not supported       |
+| I2C        | 0       | I2C0              | SDA: PC10, CLK: PC11            | `I2C_SPEED_LOW` and `I2C_SPEED_HIGH` clock speed deviate  |
+| HWCRYPTO   | &mdash; | &mdash;           |                                 | AES128/AES256, SHA1, SHA256                               |
+| HWRNG      | &mdash; | TNRG0             |                                 | Hardware-based true random number generator               |
+| RTT        | &mdash; | RTCC              |                                 | 1 Hz interval. Either RTT or RTC (see below)              |
+| RTC        | &mdash; | RTCC              |                                 | 1 Hz interval. Either RTC or RTT (see below)              |
+| SPI        | 0       | USART1            | MOSI: PC6, MISO: PC7, CLK: PC8  |                                                           |
+| Timer      | 0       | WTIMER0 + WTIMER1 |                                 | WTIMER0 is used as prescaler (must be adjecent)            |
+| UART       | 0       | USART0            | RX: PA1, TX: PA0                | Default STDIO output                                      |
+|            | 1       | USART1            | RX: PC6, TX: PC7                |                                                           |
+|            | 2       | LEUART0           | RX: PD11, TX: PD10              | Baud rate limited (see below)                             |
 
 ### User interface
 | Peripheral | Mapped to | Pin  | Comments   |
diff --git a/boards/slstk3402a/include/board.h b/boards/slstk3402a/include/board.h
index 3c50a9fcfd..53c5565ccb 100644
--- a/boards/slstk3402a/include/board.h
+++ b/boards/slstk3402a/include/board.h
@@ -31,12 +31,10 @@ extern "C" {
 
 /**
  * @name    Xtimer configuration
- *
- * The timer runs at 250 KHz to increase accuracy.
  * @{
  */
-#define XTIMER_HZ           (250000UL)
-#define XTIMER_WIDTH        (16)
+#define XTIMER_HZ           (1000000UL)
+#define XTIMER_WIDTH        (32)
 /** @} */
 
 /**
diff --git a/boards/slstk3402a/include/periph_conf.h b/boards/slstk3402a/include/periph_conf.h
index 0abf737176..4c0f40e042 100644
--- a/boards/slstk3402a/include/periph_conf.h
+++ b/boards/slstk3402a/include/periph_conf.h
@@ -150,19 +150,19 @@ static const spi_dev_t spi_config[] = {
 static const timer_conf_t timer_config[] = {
     {
         {
-            .dev = TIMER0,
-            .cmu = cmuClock_TIMER0
+            .dev = WTIMER0,
+            .cmu = cmuClock_WTIMER0
         },
         {
-            .dev = TIMER1,
-            .cmu = cmuClock_TIMER1
+            .dev = WTIMER1,
+            .cmu = cmuClock_WTIMER1
         },
-        .irq = TIMER1_IRQn
+        .irq = WTIMER1_IRQn
     }
 };
 
 #define TIMER_NUMOF         PERIPH_NUMOF(timer_config)
-#define TIMER_0_ISR         isr_timer1
+#define TIMER_0_ISR         isr_wtimer1
 /** @} */
 
 /**
-- 
GitLab