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