periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Beuth Hochschule für Technik 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 (12000000U) /* the board provides a 12 MHz XTAL */
34 
35 #define CLOCK_CORECLOCK (72000000U) /* the lpc2388 runs with 72MHz */
36 
37 #define CLOCK_PCLK (CLOCK_CORECLOCK)
44 #define TIMER_NUMOF (4U)
51 static const uart_conf_t uart_config[] = {
52  {
53  .dev = UART0,
54  .irq_prio_rx = 6,
55  .pinsel_rx = 0,
56  .pinsel_tx = 0,
57  .pinsel_msk_rx = BIT4,
58  .pinsel_msk_tx = BIT6,
59  },
60  {
61  .dev = UART1,
62  .irq_prio_rx = 6,
63  .pinsel_rx = 1,
64  .pinsel_tx = 0,
65  .pinsel_msk_rx = BIT0,
66  .pinsel_msk_tx = BIT30,
67  }
68 };
69 
70 #define UART_NUMOF (2)
77 static const spi_conf_t spi_config[] = {
78  {
79  .dev = SPI0,
80  .pinsel_mosi = 3,
81  .pinsel_miso = 3,
82  .pinsel_clk = 3,
83  .pinsel_msk_mosi = (BIT16 | BIT17), /* P1.24 */
84  .pinsel_msk_miso = (BIT14 | BIT15), /* P1.23 */
85  .pinsel_msk_clk = (BIT8 | BIT9), /* P1.20 */
86  },
87  {
88  .dev = SPI1,
89  .pinsel_mosi = 0,
90  .pinsel_miso = 0,
91  .pinsel_clk = 0,
92  .pinsel_msk_mosi = (BIT19), /* P0.9 */
93  .pinsel_msk_miso = (BIT17), /* P0.8 */
94  .pinsel_msk_clk = (BIT15), /* P0.7 */
95  },
96 };
97 
98 #define SPI_NUMOF ARRAY_SIZE(spi_config)
105 static const adc_conf_t adc_config[] = {
106  {
107  .chan = 0,
108  .pinsel = 1,
109  .pinsel_msk = BIT14,
110  },
111 };
112 
113 #define ADC_NUMOF (1)
120 static const i2c_conf_t i2c_config[] = {
121  {
122  .dev = I2C0,
123  .speed = I2C_SPEED_NORMAL,
124  .irq_prio = 5,
125  .pinsel_sda = 1,
126  .pinsel_scl = 1,
127  .pinsel_msk_sda = BIT22, /* P0.27 */
128  .pinsel_msk_scl = BIT24, /* P0.28 */
129  },
130  {
131  .dev = I2C1,
132  .speed = I2C_SPEED_NORMAL,
133  .irq_prio = 5,
134  .pinsel_sda = 1,
135  .pinsel_scl = 1,
136  .pinsel_msk_sda = BIT6 | BIT7, /* P0.19 */
137  .pinsel_msk_scl = BIT8 | BIT9, /* P0.20 */
138  },
139 };
140 
141 #define I2C_NUMOF (2)
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #endif /* PERIPH_CONF_H */
#define BIT8
Bit 8 set define.
Definition: bitarithm.h:67
#define BIT17
Bit 17 set define.
Definition: bitarithm.h:80
#define BIT9
Bit 9 set define.
Definition: bitarithm.h:68
#define BIT14
Bit 14 set define.
Definition: bitarithm.h:75
#define BIT30
Bit 30 set define.
Definition: bitarithm.h:93
#define BIT16
Bit 16 set define.
Definition: bitarithm.h:79
#define BIT24
Bit 24 set define.
Definition: bitarithm.h:87
#define BIT19
Bit 19 set define.
Definition: bitarithm.h:82
#define BIT7
Bit 7 set define.
Definition: bitarithm.h:66
#define BIT4
Bit 4 set define.
Definition: bitarithm.h:63
#define BIT6
Bit 6 set define.
Definition: bitarithm.h:65
#define BIT0
Bit 0 set define.
Definition: bitarithm.h:59
#define BIT15
Bit 15 set define.
Definition: bitarithm.h:76
#define BIT22
Bit 22 set define.
Definition: bitarithm.h:85
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