Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 iosabi
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
19#ifndef PERIPH_CONF_H
20#define PERIPH_CONF_H
21
22#include <stdint.h>
23
24#include "macros/units.h"
25#include "cpu.h"
26#include "periph_cpu.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
36#ifndef CLOCK_CORECLOCK
37/* Using 32MHz internal oscillator as default clock source */
38#define CLOCK_CORECLOCK MHZ(32)
39#endif
49static const adc_conf_t adc_config[] = {
59 ADC_CHANNEL_TEMP, /* temperature */
61};
62#define ADC_NUMOF ARRAY_SIZE(adc_config)
69static const i2c_conf_t i2c_config[] = {
70 {
71 .dev = I2C0, /* Flexcomm 1 */
72 .pin_scl = GPIO_PIN(PORT_A, 6),
73 .pin_sda = GPIO_PIN(PORT_A, 7),
74 .speed = I2C_SPEED_FAST,
75 },
76};
77#define I2C_NUMOF ARRAY_SIZE(i2c_config)
84static const spi_conf_t spi_config[] = {
85 {
86 .dev = SPI0, /* Flexcomm 2 */
87 .cipo_pin = GPIO_PIN(PORT_A, 5),
88 .copi_pin = GPIO_PIN(PORT_A, 4),
89 .clk_pin = GPIO_PIN(PORT_A, 30),
90 .cs_pin = {
91 GPIO_PIN(PORT_A, 3), /* MX25R2035F CS# connected here. */
95 },
96 },
97};
98
99#define SPI_NUMOF ARRAY_SIZE(spi_config)
106static const uart_conf_t uart_config[] = {
107 {
108 .dev = USART0, /* Flexcomm 0 */
109 .rx_pin = GPIO_PIN(PORT_A, 17),
110 .tx_pin = GPIO_PIN(PORT_A, 16),
111 },
112};
113
114#define UART_NUMOF ARRAY_SIZE(uart_config)
121#define TIMER_NUMOF 4
124/* put here the board peripherals definitions:
125 - Available clocks
126 - PWMs
127 - SPIs
128 - ADC
129 - RTC
130 - RTT
131 etc
132 */
133
134#ifdef __cplusplus
135}
136#endif
137
138#endif /* PERIPH_CONF_H */
@ PORT_A
port A
Definition periph_cpu.h:47
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:46
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
Definition periph_cpu.h:279
#define ADC_VREF_GAIN_X15
ADC Vref x1.5 multiplier flag.
Definition periph_cpu.h:267
@ ADC_VINN_AVSS
Use Vinn := Vss.
Definition periph_cpu.h:293
@ ADC_CHANNEL_ADC4_VINN
Sample ADC4 / Vinn.
Definition periph_cpu.h:236
@ ADC_CHANNEL_ADC5_VINN
Sample ADC5 / Vinn.
Definition periph_cpu.h:237
@ ADC_CHANNEL_TEMP
Sample internal temperature.
Definition periph_cpu.h:240
@ ADC_CHANNEL_ADC0_ADC1
Sample ADC0 / ADC1.
Definition periph_cpu.h:228
@ ADC_CHANNEL_ADC1_VINN
Sample ADC1 / Vinn.
Definition periph_cpu.h:233
@ ADC_CHANNEL_ADC6_VINN
Sample ADC6 / Vinn.
Definition periph_cpu.h:238
@ ADC_CHANNEL_ADC0_VINN
Sample ADC0 / Vinn.
Definition periph_cpu.h:232
@ ADC_CHANNEL_ADC4_ADC5
Sample ADC4 / ADC5.
Definition periph_cpu.h:230
@ ADC_CHANNEL_ADC6_ADC7
Sample ADC6 / ADC7.
Definition periph_cpu.h:231
@ ADC_CHANNEL_ADC7_VINN
Sample ADC7 / Vinn.
Definition periph_cpu.h:239
@ ADC_CHANNEL_VCC4_VINN
Sample 1/4 Vcc / Vinn.
Definition periph_cpu.h:241
ADC device configuration.
Definition periph_cpu.h:379
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
Unit helper macros.