periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
9 #pragma once
10 
21 #include "periph_cpu.h"
22 #include "kernel_defines.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
32 #define XTAL_HZ (16000000U) /* the board provides a 16 MHz XTAL */
33 
34 #define CLOCK_CORECLOCK (72000000U) /* the msba2 runs with 72MHz */
35 
36 #define CLOCK_PCLK (CLOCK_CORECLOCK)
43 #define TIMER_NUMOF (1U)
53 #define PWM_NUMOF (1U)
54 
55 /* PWM_0 device configuration */
56 #define PWM_CHANNELS (3)
57 #define PWM_CH0 (3)
58 #define PWM_CH0_MR PWM1MR3
59 #define PWM_CH1 (4)
60 #define PWM_CH1_MR PWM1MR4
61 #define PWM_CH2 (5)
62 #define PWM_CH2_MR PWM1MR5
63 /* PWM_0 pin configuration */
64 #define PWM_PORT PINSEL4
65 #define PWM_CH0_PIN (2)
66 #define PWM_CH1_PIN (3)
67 #define PWM_CH2_PIN (4)
68 #define PWM_FUNC (1)
75 static const uart_conf_t uart_config[] = {
76  {
77  .dev = UART0,
78  .irq_prio_rx = 6,
79  .pinsel_rx = 0,
80  .pinsel_tx = 0,
81  .pinsel_msk_rx = BIT4,
82  .pinsel_msk_tx = BIT6,
83  },
84  {
85  .dev = UART1,
86  .irq_prio_rx = 6,
87  .pinsel_rx = 4,
88  .pinsel_tx = 4,
89  .pinsel_msk_rx = BIT3,
90  .pinsel_msk_tx = BIT1,
91  },
92  {
93  .dev = UART2,
94  .irq_prio_rx = 6,
95  .pinsel_rx = 0,
96  .pinsel_tx = 0,
97  .pinsel_msk_rx = BIT22,
98  .pinsel_msk_tx = BIT20,
99  },
100  {
101  .dev = UART3,
102  .irq_prio_rx = 6,
103  .pinsel_rx = 9,
104  .pinsel_tx = 9,
105  .pinsel_msk_rx = BIT26 | BIT27,
106  .pinsel_msk_tx = BIT24 | BIT25,
107  },
108 };
109 
110 #define UART_NUMOF (4)
117 static const spi_conf_t spi_config[] = {
118  {
119  .dev = SPI0,
120  .pinsel_mosi = 3,
121  .pinsel_miso = 3,
122  .pinsel_clk = 3,
123  .pinsel_msk_mosi = (BIT16 | BIT17),
124  .pinsel_msk_miso = (BIT14 | BIT15),
125  .pinsel_msk_clk = (BIT8 | BIT9),
126  },
127 };
128 
129 #define SPI_NUMOF (1)
136 static const adc_conf_t adc_config[] = {
137  { /* P0.23 */
138  .chan = 0,
139  .pinsel = 1,
140  .pinsel_msk = BIT14,
141  },
142  { /* P0.24 */
143  .chan = 1,
144  .pinsel = 1,
145  .pinsel_msk = BIT16,
146  },
147  { /* P0.25 */
148  .chan = 2,
149  .pinsel = 1,
150  .pinsel_msk = BIT18,
151  },
152 };
153 
154 #define ADC_NUMOF ARRAY_SIZE(adc_config)
161 static const i2c_conf_t i2c_config[] = {
162  { /* JP3 */
163  .dev = I2C2,
164  .speed = I2C_SPEED_NORMAL,
165  .irq_prio = 5,
166  .pinsel_sda = 0,
167  .pinsel_scl = 0,
168  .pinsel_msk_sda = BIT21, /* P0.10 */
169  .pinsel_msk_scl = BIT23, /* P0.11 */
170  },
171 };
172 
173 /* used in arithmetic preprocessor expression, so no ARRAY_SIZE() */
174 #define I2C_NUMOF (1)
177 #ifdef __cplusplus
178 }
179 #endif
180 
#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:38
static const spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:96
static const i2c_conf_t i2c_config[]
I2C configuration.
Definition: periph_conf.h:68
static const adc_conf_t adc_config[]
ADC configuration.
Definition: periph_conf.h:250
#define UART0
UART0 register bank.
#define UART1
UART1 register bank.
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition: periph_cpu.h:277
Common macros and compiler attributes/pragmas configuration.
ADC device configuration.
Definition: periph_cpu.h:377
uint8_t chan
CPU ADC channel connected to the pin.
Definition: periph_cpu.h:289
I2C configuration structure.
Definition: periph_cpu.h:298
TWI_t * dev
Pointer to hardware module registers.
Definition: periph_cpu.h:299
SPI device configuration.
Definition: periph_cpu.h:336
SPI_t * dev
pointer to the used SPI device
Definition: periph_cpu.h:337
UART device configuration.
Definition: periph_cpu.h:217
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:218