Loading...
Searching...
No Matches
cfg_i2c_default.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 Gunar Schorcht <gunar@schorcht.net>
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
9#pragma once
10
20
21#include "periph_cpu.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
33
43#ifndef I2C_DEV_1_USED
44#define I2C_DEV_1_USED 0
45#endif
46
58static const i2c_conf_t i2c_config[] = {
59 {
60 .dev = I2C0,
61 .speed = I2C_SPEED_NORMAL,
62 .scl_pin = GPIO_PIN(PORT_B, 6),
63 .sda_pin = GPIO_PIN(PORT_B, 7),
64 .rcu_mask = RCU_APB1EN_I2C0EN_Msk,
65 .irqn = I2C0_EV_IRQn,
66 },
67#if I2C_DEV_1_USED
68 {
69 .dev = I2C1,
70 .speed = I2C_SPEED_NORMAL,
71 .scl_pin = GPIO_PIN(PORT_B, 10),
72 .sda_pin = GPIO_PIN(PORT_B, 11),
73 .rcu_mask = RCU_APB1EN_I2C1EN_Msk,
74 .irqn = I2C1_EV_IRQn,
75 }
76#endif
77};
78
79#define I2C_NUMOF ARRAY_SIZE(i2c_config)
81
82#ifdef __cplusplus
83}
84#endif
85
@ 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