Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2014-2015 Freie Universität Berlin
3 * SPDX-FileCopyrightText: 2017 Freie Universität Berlin
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
20
21#include "periph_cpu.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
31/* targeted system core clock */
32#define CLOCK_CORECLOCK (84000000UL)
33/* external oscillator clock */
34#define CLOCK_EXT_OSC (12000000UL)
35/* define PLL configuration
36 *
37 * The values must fulfill this equation:
38 * CORECLOCK = (EXT_OCS / PLL_DIV) * (PLL_MUL + 1)
39 */
40#define CLOCK_PLL_MUL (83)
41#define CLOCK_PLL_DIV (12)
42
43/* number of wait states before flash read and write operations */
44#define CLOCK_FWS (4) /* 4 is save for 84MHz */
46
53#ifndef CLOCK_SCLK_XTAL
54#define CLOCK_SCLK_XTAL (0)
55#endif
56
61static const timer_conf_t timer_config[] = {
62 { .dev = TC0, .id_ch0 = ID_TC0 },
63 { .dev = TC1, .id_ch0 = ID_TC3 }
64};
65
66#define TIMER_0_ISR isr_tc0
67#define TIMER_1_ISR isr_tc3
68
69#define TIMER_NUMOF ARRAY_SIZE(timer_config)
71
76#ifndef RTT_FREQUENCY
77#define RTT_FREQUENCY (1U) /* 1Hz */
78#endif
80
85static const uart_conf_t uart_config[] = {
86 {
87 .dev = (Uart *)UART,
88 .rx_pin = GPIO_PIN(PA, 8),
89 .tx_pin = GPIO_PIN(PA, 9),
90 .mux = GPIO_MUX_A,
91 .pmc_id = ID_UART,
92 .irqn = UART_IRQn
93 },
94 {
95 .dev = (Uart *)USART0,
96 .rx_pin = GPIO_PIN(PA, 10),
97 .tx_pin = GPIO_PIN(PA, 11),
98 .mux = GPIO_MUX_A,
99 .pmc_id = ID_USART0,
100 .irqn = USART0_IRQn
101 },
102 {
103 .dev = (Uart *)USART1,
104 .rx_pin = GPIO_PIN(PA, 12),
105 .tx_pin = GPIO_PIN(PA, 13),
106 .mux = GPIO_MUX_A,
107 .pmc_id = ID_USART1,
108 .irqn = USART1_IRQn
109 },
110 {
111 .dev = (Uart *)USART3,
112 .rx_pin = GPIO_PIN(PD, 5),
113 .tx_pin = GPIO_PIN(PD, 4),
114 .mux = GPIO_MUX_B,
115 .pmc_id = ID_USART3,
116 .irqn = USART3_IRQn
117 }
118};
119
120/* define interrupt vectors */
121#define UART_0_ISR isr_uart
122#define UART_1_ISR isr_usart0
123#define UART_2_ISR isr_usart1
124#define UART_3_ISR isr_usart3
125
126#define UART_NUMOF ARRAY_SIZE(uart_config)
128
133static const spi_conf_t spi_config[] = {
134 {
135 .dev = SPI0,
136 .id = ID_SPI0,
137 .clk = GPIO_PIN(PA, 27),
138 .mosi = GPIO_PIN(PA, 26),
139 .miso = GPIO_PIN(PA, 25),
140 .mux = GPIO_MUX_A
141 }
142};
143
144#define SPI_NUMOF ARRAY_SIZE(spi_config)
146
151static const pwm_chan_conf_t pwm_chan[] = {
152 { .pin = GPIO_PIN(PC, 21), .hwchan = 4 },
153 { .pin = GPIO_PIN(PC, 22), .hwchan = 5 },
154 { .pin = GPIO_PIN(PC, 23), .hwchan = 6 },
155 { .pin = GPIO_PIN(PC, 24), .hwchan = 7 }
156};
157
158#define PWM_NUMOF (1U)
159#define PWM_CHAN_NUMOF ARRAY_SIZE(pwm_chan)
161
162#ifdef __cplusplus
163}
164#endif
165
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:42
@ PC
port C
@ PA
port A
@ PD
port D
@ GPIO_MUX_A
select peripheral function A
@ GPIO_MUX_B
select peripheral function B
PWM channel configuration.
Definition periph_cpu.h:464
SPI device configuration.
Definition periph_cpu.h:333
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214