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
19#ifndef CFG_I2C_DEFAULT_H
20#define CFG_I2C_DEFAULT_H
21
22#include "periph_cpu.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
44#ifndef I2C_DEV_1_USED
45#define I2C_DEV_1_USED 0
46#endif
47
59static const i2c_conf_t i2c_config[] = {
60 {
61 .dev = I2C0,
62 .speed = I2C_SPEED_NORMAL,
63 .scl_pin = GPIO_PIN(PORT_B, 6),
64 .sda_pin = GPIO_PIN(PORT_B, 7),
65 .rcu_mask = RCU_APB1EN_I2C0EN_Msk,
66 .irqn = I2C0_EV_IRQn,
67 },
68#if I2C_DEV_1_USED
69 {
70 .dev = I2C1,
71 .speed = I2C_SPEED_NORMAL,
72 .scl_pin = GPIO_PIN(PORT_B, 10),
73 .sda_pin = GPIO_PIN(PORT_B, 11),
74 .rcu_mask = RCU_APB1EN_I2C1EN_Msk,
75 .irqn = I2C1_EV_IRQn,
76 }
77#endif
78};
79
80#define I2C_NUMOF ARRAY_SIZE(i2c_config)
83#ifdef __cplusplus
84}
85#endif
86
87#endif /* CFG_I2C_DEFAULT_H */
@ PORT_B
port B
Definition periph_cpu.h:48
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:46
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:278
static const i2c_conf_t i2c_config[]
Default I2C device configuration.
I2C configuration structure.
Definition periph_cpu.h:299
TWI_t * dev
Pointer to hardware module registers.
Definition periph_cpu.h:300