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