periph_conf.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2014 Freie Universität Berlin
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
18 #include "periph_cpu.h"
19 #include "kernel_defines.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
29 #define XTAL_HZ (16000000U) /* the board provides a 16 MHz XTAL */
30 
31 #define CLOCK_CORECLOCK (72000000U) /* the msba2 runs with 72MHz */
32 
33 #define CLOCK_PCLK (CLOCK_CORECLOCK)
40 #define TIMER_NUMOF (1U)
50 #define PWM_NUMOF (1U)
51 
52 /* PWM_0 device configuration */
53 #define PWM_CHANNELS (3)
54 #define PWM_CH0 (3)
55 #define PWM_CH0_MR PWM1MR3
56 #define PWM_CH1 (4)
57 #define PWM_CH1_MR PWM1MR4
58 #define PWM_CH2 (5)
59 #define PWM_CH2_MR PWM1MR5
60 /* PWM_0 pin configuration */
61 #define PWM_PORT PINSEL4
62 #define PWM_CH0_PIN (2)
63 #define PWM_CH1_PIN (3)
64 #define PWM_CH2_PIN (4)
65 #define PWM_FUNC (1)
72 static const uart_conf_t uart_config[] = {
73  {
74  .dev = UART0,
75  .irq_prio_rx = 6,
76  .pinsel_rx = 0,
77  .pinsel_tx = 0,
78  .pinsel_msk_rx = BIT4,
79  .pinsel_msk_tx = BIT6,
80  },
81  {
82  .dev = UART1,
83  .irq_prio_rx = 6,
84  .pinsel_rx = 4,
85  .pinsel_tx = 4,
86  .pinsel_msk_rx = BIT3,
87  .pinsel_msk_tx = BIT1,
88  },
89  {
90  .dev = UART2,
91  .irq_prio_rx = 6,
92  .pinsel_rx = 0,
93  .pinsel_tx = 0,
94  .pinsel_msk_rx = BIT22,
95  .pinsel_msk_tx = BIT20,
96  },
97  {
98  .dev = UART3,
99  .irq_prio_rx = 6,
100  .pinsel_rx = 9,
101  .pinsel_tx = 9,
102  .pinsel_msk_rx = BIT26 | BIT27,
103  .pinsel_msk_tx = BIT24 | BIT25,
104  },
105 };
106 
107 #define UART_NUMOF (4)
114 static const spi_conf_t spi_config[] = {
115  {
116  .dev = SPI0,
117  .pinsel_mosi = 3,
118  .pinsel_miso = 3,
119  .pinsel_clk = 3,
120  .pinsel_msk_mosi = (BIT16 | BIT17),
121  .pinsel_msk_miso = (BIT14 | BIT15),
122  .pinsel_msk_clk = (BIT8 | BIT9),
123  },
124 };
125 
126 #define SPI_NUMOF (1)
133 static const adc_conf_t adc_config[] = {
134  { /* P0.23 */
135  .chan = 0,
136  .pinsel = 1,
137  .pinsel_msk = BIT14,
138  },
139  { /* P0.24 */
140  .chan = 1,
141  .pinsel = 1,
142  .pinsel_msk = BIT16,
143  },
144  { /* P0.25 */
145  .chan = 2,
146  .pinsel = 1,
147  .pinsel_msk = BIT18,
148  },
149 };
150 
151 #define ADC_NUMOF ARRAY_SIZE(adc_config)
158 static const i2c_conf_t i2c_config[] = {
159  { /* JP3 */
160  .dev = I2C2,
161  .speed = I2C_SPEED_NORMAL,
162  .irq_prio = 5,
163  .pinsel_sda = 0,
164  .pinsel_scl = 0,
165  .pinsel_msk_sda = BIT21, /* P0.10 */
166  .pinsel_msk_scl = BIT23, /* P0.11 */
167  },
168 };
169 
170 /* used in arithmetic preprocessor expression, so no ARRAY_SIZE() */
171 #define I2C_NUMOF (1)
174 #ifdef __cplusplus
175 }
176 #endif
177 
#define BIT8
Bit 8 set define.
Definition: bitarithm.h:66
#define BIT21
Bit 21 set define.
Definition: bitarithm.h:83
#define BIT17
Bit 17 set define.
Definition: bitarithm.h:79
#define BIT25
Bit 25 set define.
Definition: bitarithm.h:87
#define BIT9
Bit 9 set define.
Definition: bitarithm.h:67
#define BIT14
Bit 14 set define.
Definition: bitarithm.h:74
#define BIT26
Bit 26 set define.
Definition: bitarithm.h:88
#define BIT18
Bit 18 set define.
Definition: bitarithm.h:80
#define BIT1
Bit 1 set define.
Definition: bitarithm.h:59
#define BIT16
Bit 16 set define.
Definition: bitarithm.h:78
#define BIT20
Bit 20 set define.
Definition: bitarithm.h:82
#define BIT3
Bit 3 set define.
Definition: bitarithm.h:61
#define BIT24
Bit 24 set define.
Definition: bitarithm.h:86
#define BIT4
Bit 4 set define.
Definition: bitarithm.h:62
#define BIT6
Bit 6 set define.
Definition: bitarithm.h:64
#define BIT23
Bit 23 set define.
Definition: bitarithm.h:85
#define BIT15
Bit 15 set define.
Definition: bitarithm.h:75
#define BIT22
Bit 22 set define.
Definition: bitarithm.h:84
#define BIT27
Bit 27 set define.
Definition: bitarithm.h:89
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:35
static const spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:93
static const i2c_conf_t i2c_config[]
I2C configuration.
Definition: periph_conf.h:65
static const adc_conf_t adc_config[]
ADC configuration.
Definition: periph_conf.h:247
#define UART0
UART0 register bank.
#define UART1
UART1 register bank.
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition: periph_cpu.h:274
Common macros and compiler attributes/pragmas configuration.
ADC device configuration.
Definition: periph_cpu.h:374
uint8_t chan
CPU ADC channel connected to the pin.
Definition: periph_cpu.h:289
I2C configuration structure.
Definition: periph_cpu.h:295
TWI_t * dev
Pointer to hardware module registers.
Definition: periph_cpu.h:296
SPI device configuration.
Definition: periph_cpu.h:333
SPI_t * dev
pointer to the used SPI device
Definition: periph_cpu.h:334
UART device configuration.
Definition: periph_cpu.h:214
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:215