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 
19 #ifndef PERIPH_CONF_H
20 #define PERIPH_CONF_H
21 
22 #include "periph_cpu.h"
23 #include "kernel_defines.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
33 #define XTAL_HZ (16000000U) /* the board provides a 16 MHz XTAL */
34 
35 #define CLOCK_CORECLOCK (72000000U) /* the msba2 runs with 72MHz */
36 
37 #define CLOCK_PCLK (CLOCK_CORECLOCK)
44 #define TIMER_NUMOF (1U)
54 #define PWM_NUMOF (1U)
55 
56 /* PWM_0 device configuration */
57 #define PWM_CHANNELS (3)
58 #define PWM_CH0 (3)
59 #define PWM_CH0_MR PWM1MR3
60 #define PWM_CH1 (4)
61 #define PWM_CH1_MR PWM1MR4
62 #define PWM_CH2 (5)
63 #define PWM_CH2_MR PWM1MR5
64 /* PWM_0 pin configuration */
65 #define PWM_PORT PINSEL4
66 #define PWM_CH0_PIN (2)
67 #define PWM_CH1_PIN (3)
68 #define PWM_CH2_PIN (4)
69 #define PWM_FUNC (1)
76 static const uart_conf_t uart_config[] = {
77  {
78  .dev = UART0,
79  .irq_prio_rx = 6,
80  .pinsel_rx = 0,
81  .pinsel_tx = 0,
82  .pinsel_msk_rx = BIT4,
83  .pinsel_msk_tx = BIT6,
84  },
85  {
86  .dev = UART1,
87  .irq_prio_rx = 6,
88  .pinsel_rx = 4,
89  .pinsel_tx = 4,
90  .pinsel_msk_rx = BIT3,
91  .pinsel_msk_tx = BIT1,
92  },
93  {
94  .dev = UART2,
95  .irq_prio_rx = 6,
96  .pinsel_rx = 0,
97  .pinsel_tx = 0,
98  .pinsel_msk_rx = BIT22,
99  .pinsel_msk_tx = BIT20,
100  },
101  {
102  .dev = UART3,
103  .irq_prio_rx = 6,
104  .pinsel_rx = 9,
105  .pinsel_tx = 9,
106  .pinsel_msk_rx = BIT26 | BIT27,
107  .pinsel_msk_tx = BIT24 | BIT25,
108  },
109 };
110 
111 #define UART_NUMOF (4)
118 static const spi_conf_t spi_config[] = {
119  {
120  .dev = SPI0,
121  .pinsel_mosi = 3,
122  .pinsel_miso = 3,
123  .pinsel_clk = 3,
124  .pinsel_msk_mosi = (BIT16 | BIT17),
125  .pinsel_msk_miso = (BIT14 | BIT15),
126  .pinsel_msk_clk = (BIT8 | BIT9),
127  },
128 };
129 
130 #define SPI_NUMOF (1)
137 static const adc_conf_t adc_config[] = {
138  { /* P0.23 */
139  .chan = 0,
140  .pinsel = 1,
141  .pinsel_msk = BIT14,
142  },
143  { /* P0.24 */
144  .chan = 1,
145  .pinsel = 1,
146  .pinsel_msk = BIT16,
147  },
148  { /* P0.25 */
149  .chan = 2,
150  .pinsel = 1,
151  .pinsel_msk = BIT18,
152  },
153 };
154 
155 #define ADC_NUMOF ARRAY_SIZE(adc_config)
162 static const i2c_conf_t i2c_config[] = {
163  { /* JP3 */
164  .dev = I2C2,
165  .speed = I2C_SPEED_NORMAL,
166  .irq_prio = 5,
167  .pinsel_sda = 0,
168  .pinsel_scl = 0,
169  .pinsel_msk_sda = BIT21, /* P0.10 */
170  .pinsel_msk_scl = BIT23, /* P0.11 */
171  },
172 };
173 
174 /* used in arithmetic preprocessor expression, so no ARRAY_SIZE() */
175 #define I2C_NUMOF (1)
178 #ifdef __cplusplus
179 }
180 #endif
181 
182 #endif /* PERIPH_CONF_H */
#define BIT8
Bit 8 set define.
Definition: bitarithm.h:67
#define BIT21
Bit 21 set define.
Definition: bitarithm.h:84
#define BIT17
Bit 17 set define.
Definition: bitarithm.h:80
#define BIT25
Bit 25 set define.
Definition: bitarithm.h:88
#define BIT9
Bit 9 set define.
Definition: bitarithm.h:68
#define BIT14
Bit 14 set define.
Definition: bitarithm.h:75
#define BIT26
Bit 26 set define.
Definition: bitarithm.h:89
#define BIT18
Bit 18 set define.
Definition: bitarithm.h:81
#define BIT1
Bit 1 set define.
Definition: bitarithm.h:60
#define BIT16
Bit 16 set define.
Definition: bitarithm.h:79
#define BIT20
Bit 20 set define.
Definition: bitarithm.h:83
#define BIT3
Bit 3 set define.
Definition: bitarithm.h:62
#define BIT24
Bit 24 set define.
Definition: bitarithm.h:87
#define BIT4
Bit 4 set define.
Definition: bitarithm.h:63
#define BIT6
Bit 6 set define.
Definition: bitarithm.h:65
#define BIT23
Bit 23 set define.
Definition: bitarithm.h:86
#define BIT15
Bit 15 set define.
Definition: bitarithm.h:76
#define BIT22
Bit 22 set define.
Definition: bitarithm.h:85
#define BIT27
Bit 27 set define.
Definition: bitarithm.h:90
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:39
static const spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:97
static const i2c_conf_t i2c_config[]
I2C configuration.
Definition: periph_conf.h:69
static const adc_conf_t adc_config[]
ADC configuration.
Definition: periph_conf.h:251
#define UART0
UART0 register bank.
#define UART1
UART1 register bank.
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition: periph_cpu.h:278
Common macros and compiler attributes/pragmas configuration.
ADC device configuration.
Definition: periph_cpu.h:379
uint8_t chan
CPU ADC channel connected to the pin.
Definition: periph_cpu.h:290
I2C configuration structure.
Definition: periph_cpu.h:299
TWI_t * dev
Pointer to hardware module registers.
Definition: periph_cpu.h:300
SPI device configuration.
Definition: periph_cpu.h:337
SPI_t * dev
pointer to the used SPI device
Definition: periph_cpu.h:338
UART device configuration.
Definition: periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:219