cfg_i2c_default.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Eistec AB
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * 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
25 extern "C"
26 {
27 #endif
28 
29 
34 static const i2c_conf_t i2c_config[] = {
35  {
36  .i2c = I2C1,
37  .scl_pin = GPIO_PIN(PORT_C, 2),
38  .sda_pin = GPIO_PIN(PORT_C, 3),
39  .freq = CLOCK_CORECLOCK,
40  .speed = I2C_SPEED_FAST,
41  .irqn = I2C1_IRQn,
42  .scl_pcr = (PORT_PCR_MUX(3)),
43  .sda_pcr = (PORT_PCR_MUX(3)),
44  },
45 };
46 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
47 #define I2C_0_ISR (isr_i2c1)
48 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif /* CFG_I2C_DEFAULT_H */
55 
PORT_C
@ PORT_C
port C
Definition: periph_cpu.h:38
i2c_conf_t::i2c
I2C_Type * i2c
Pointer to hardware module registers.
Definition: periph_cpu.h:451
CLOCK_CORECLOCK
#define CLOCK_CORECLOCK
CPU Frequency Define.
Definition: periph_cpu.h:101
GPIO_PIN
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:35
i2c_conf_t
I2C configuration options.
Definition: periph_cpu.h:128
I2C_SPEED_FAST
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
Definition: i2c.h:178