Loading...
Searching...
No Matches
cfg_i2c1_pb6_pb7.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019 Inria
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_I2C1_PB6_PB7_H
20#define CFG_I2C1_PB6_PB7_H
21
22#include "periph_cpu.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
32static const i2c_conf_t i2c_config[] = {
33 {
34 .dev = I2C1,
35 .speed = I2C_SPEED_NORMAL,
36 .scl_pin = GPIO_PIN(PORT_B, 6),
37 .sda_pin = GPIO_PIN(PORT_B, 7),
38#if CPU_FAM_STM32L4
39 .scl_af = GPIO_AF4,
40 .sda_af = GPIO_AF4,
41#else /* CPU_FAM_STM32L0 */
42 .scl_af = GPIO_AF1,
43 .sda_af = GPIO_AF1,
44#endif
45 .bus = APB1,
46#if CPU_FAM_STM32L4
47 .rcc_mask = RCC_APB1ENR1_I2C1EN,
48 .rcc_sw_mask = RCC_CCIPR_I2C1SEL_1, /* HSI (16 MHz) */
49 .irqn = I2C1_ER_IRQn,
50#else /* CPU_FAM_STM32L0 */
51 .rcc_mask = RCC_APB1ENR_I2C1EN,
52 .irqn = I2C1_IRQn
53#endif
54 }
55};
56
57#if CPU_FAM_STM32L4
58#define I2C_0_ISR isr_i2c1_er
59#else /* CPU_FAM_STM32L0 */
60#define I2C_0_ISR isr_i2c1
61#endif
62
63#define I2C_NUMOF ARRAY_SIZE(i2c_config)
65#ifdef __cplusplus
66}
67#endif
68
69#endif /* CFG_I2C1_PB6_PB7_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
@ GPIO_AF1
use alternate function 1
Definition cpu_gpio.h:103
@ GPIO_AF4
use alternate function 4
Definition cpu_gpio.h:106
@ APB1
Advanced Peripheral Bus 1
Definition periph_cpu.h:79
I2C configuration structure.
Definition periph_cpu.h:299
TWI_t * dev
Pointer to hardware module registers.
Definition periph_cpu.h:300