periph_conf.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2020 iosabi
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
18 #include <stdint.h>
19 
20 #include "macros/units.h"
21 #include "cpu.h"
22 #include "periph_cpu.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
32 #ifndef CLOCK_CORECLOCK
33 /* Using 32MHz internal oscillator as default clock source */
34 #define CLOCK_CORECLOCK MHZ(32)
35 #endif
45 static const adc_conf_t adc_config[] = {
55  ADC_CHANNEL_TEMP, /* temperature */
57 };
58 #define ADC_NUMOF ARRAY_SIZE(adc_config)
65 static const i2c_conf_t i2c_config[] = {
66  {
67  .dev = I2C0, /* Flexcomm 1 */
68  .pin_scl = GPIO_PIN(PORT_A, 6),
69  .pin_sda = GPIO_PIN(PORT_A, 7),
70  .speed = I2C_SPEED_FAST,
71  },
72 };
73 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
80 static const spi_conf_t spi_config[] = {
81  {
82  .dev = SPI0, /* Flexcomm 2 */
83  .cipo_pin = GPIO_PIN(PORT_A, 5),
84  .copi_pin = GPIO_PIN(PORT_A, 4),
85  .clk_pin = GPIO_PIN(PORT_A, 30),
86  .cs_pin = {
87  GPIO_PIN(PORT_A, 3), /* MX25R2035F CS# connected here. */
88  GPIO_UNDEF,
89  GPIO_UNDEF,
91  },
92  },
93 };
94 
95 #define SPI_NUMOF ARRAY_SIZE(spi_config)
102 static const uart_conf_t uart_config[] = {
103  {
104  .dev = USART0, /* Flexcomm 0 */
105  .rx_pin = GPIO_PIN(PORT_A, 17),
106  .tx_pin = GPIO_PIN(PORT_A, 16),
107  },
108 };
109 
110 #define UART_NUMOF ARRAY_SIZE(uart_config)
117 #define TIMER_NUMOF 4
120 /* put here the board peripherals definitions:
121  - Available clocks
122  - PWMs
123  - SPIs
124  - ADC
125  - RTC
126  - RTT
127  etc
128  */
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
@ PORT_A
port A
Definition: periph_cpu.h:43
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:42
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
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
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
Definition: periph_cpu.h:275
#define ADC_VREF_GAIN_X15
ADC Vref x1.5 multiplier flag.
Definition: periph_cpu.h:266
@ ADC_VINN_AVSS
Use Vinn := Vss.
Definition: periph_cpu.h:292
@ ADC_CHANNEL_ADC4_VINN
Sample ADC4 / Vinn.
Definition: periph_cpu.h:235
@ ADC_CHANNEL_ADC5_VINN
Sample ADC5 / Vinn.
Definition: periph_cpu.h:236
@ ADC_CHANNEL_TEMP
Sample internal temperature.
Definition: periph_cpu.h:239
@ ADC_CHANNEL_ADC0_ADC1
Sample ADC0 / ADC1.
Definition: periph_cpu.h:227
@ ADC_CHANNEL_ADC1_VINN
Sample ADC1 / Vinn.
Definition: periph_cpu.h:232
@ ADC_CHANNEL_ADC6_VINN
Sample ADC6 / Vinn.
Definition: periph_cpu.h:237
@ ADC_CHANNEL_ADC0_VINN
Sample ADC0 / Vinn.
Definition: periph_cpu.h:231
@ ADC_CHANNEL_ADC4_ADC5
Sample ADC4 / ADC5.
Definition: periph_cpu.h:229
@ ADC_CHANNEL_ADC6_ADC7
Sample ADC6 / ADC7.
Definition: periph_cpu.h:230
@ ADC_CHANNEL_ADC7_VINN
Sample ADC7 / Vinn.
Definition: periph_cpu.h:238
@ ADC_CHANNEL_VCC4_VINN
Sample 1/4 Vcc / Vinn.
Definition: periph_cpu.h:240
ADC device configuration.
Definition: periph_cpu.h:374
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
Unit helper macros.