/* * Copyright (C) 2017 Bas Stottelaar * * 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 * directory for more details. */ /** * @ingroup boards_ikea-tradfri * @{ * * @file * @brief Configuration of CPU peripherals for the IKEA TRÅDFRI modules * * @author Bas Stottelaar */ #ifndef PERIPH_CONF_H #define PERIPH_CONF_H #include "cpu.h" #include "periph_cpu.h" #include "em_cmu.h" #ifdef __cplusplus extern "C" { #endif /** * @name Clock configuration * @{ */ #ifndef CLOCK_HF #define CLOCK_HF cmuSelect_HFRCO #endif #ifndef CLOCK_CORE_DIV #define CLOCK_CORE_DIV cmuClkDiv_1 #endif #ifndef CLOCK_LFA #define CLOCK_LFA cmuSelect_LFRCO #endif #ifndef CLOCK_LFB #define CLOCK_LFB cmuSelect_LFRCO #endif #ifndef CLOCK_LFE #define CLOCK_LFE cmuSelect_LFRCO #endif /** @} */ /** * @name RTC configuration * @{ */ #define RTC_NUMOF (1U) /** @} */ /** * @name RTT configuration * @{ */ #define RTT_NUMOF (1U) #define RTT_MAX_VALUE (0xFFFFFFFF) #define RTT_FREQUENCY (1U) /** @} */ /** * @name SPI configuration * @{ */ static const spi_dev_t spi_config[] = { { .dev = USART1, .mosi_pin = GPIO_PIN(PD, 15), .miso_pin = GPIO_PIN(PD, 14), .clk_pin = GPIO_PIN(PD, 13), .loc = USART_ROUTELOC0_RXLOC_LOC21 | USART_ROUTELOC0_TXLOC_LOC23 | USART_ROUTELOC0_CLKLOC_LOC19, .cmu = cmuClock_USART1, .irq = USART1_RX_IRQn } }; #define SPI_NUMOF ARRAY_SIZE(spi_config) /** @} */ /** * @name Timer configuration * * The implementation uses two timers in cascade mode. * @{ */ static const timer_conf_t timer_config[] = { { { .dev = TIMER0, .cmu = cmuClock_TIMER0 }, { .dev = TIMER1, .cmu = cmuClock_TIMER1 }, .irq = TIMER1_IRQn } }; #define TIMER_NUMOF ARRAY_SIZE(timer_config) #define TIMER_0_ISR isr_timer1 /** @} */ /** * @name UART configuration * @{ */ static const uart_conf_t uart_config[] = { { .dev = USART0, .rx_pin = GPIO_PIN(PB, 15), .tx_pin = GPIO_PIN(PB, 14), .loc = USART_ROUTELOC0_RXLOC_LOC9 | USART_ROUTELOC0_TXLOC_LOC9, #if EFM32_UART_MODES .mode = UART_MODE_8N1, #endif .cmu = cmuClock_USART0, .irq = USART0_RX_IRQn } }; #define UART_NUMOF ARRAY_SIZE(uart_config) #define UART_0_ISR_RX isr_usart0_rx /** @} */ #ifdef __cplusplus } #endif #endif /* PERIPH_CONF_H */ /** @} */