Loading...
Searching...
No Matches
cfg_i2c_default.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023 Gunar Schorcht <gunar@schorcht.net>
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18#include "periph_cpu.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
30
40#ifndef I2C_DEV_1_USED
41#define I2C_DEV_1_USED 0
42#endif
43
55static const i2c_conf_t i2c_config[] = {
56 {
57 .dev = I2C0,
58 .speed = I2C_SPEED_NORMAL,
59 .scl_pin = GPIO_PIN(PORT_B, 6),
60 .sda_pin = GPIO_PIN(PORT_B, 7),
61 .rcu_mask = RCU_APB1EN_I2C0EN_Msk,
62 .irqn = I2C0_EV_IRQn,
63 },
64#if I2C_DEV_1_USED
65 {
66 .dev = I2C1,
67 .speed = I2C_SPEED_NORMAL,
68 .scl_pin = GPIO_PIN(PORT_B, 10),
69 .sda_pin = GPIO_PIN(PORT_B, 11),
70 .rcu_mask = RCU_APB1EN_I2C1EN_Msk,
71 .irqn = I2C1_EV_IRQn,
72 }
73#endif
74};
75
76#define I2C_NUMOF ARRAY_SIZE(i2c_config)
78
79#ifdef __cplusplus
80}
81#endif
82
@ PORT_B
port B
Definition periph_cpu.h:47
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:45
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:277
I2C configuration structure.
Definition periph_cpu.h:298