1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/*
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2024-01-20 wirano first version
*/
#ifndef __I2C_CONFIG_H__
#define __I2C_CONFIG_H__
#include <rtthread.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined(BSP_I2C0_CLK_100)
#define I2C0_CLK 100000
#elif defined(BSP_I2C0_CLK_400)
#define I2C0_CLK 400000
#endif
#if defined(BSP_I2C1_CLK_100)
#define I2C1_CLK 100000
#elif defined(BSP_I2C1_CLK_400)
#define I2C1_CLK 400000
#endif
#if defined(BSP_I2C2_CLK_100)
#define I2C2_CLK 100000
#elif defined(BSP_I2C2_CLK_400)
#define I2C2_CLK 400000
#endif
#if defined(BSP_I2C3_CLK_100)
#define I2C3_CLK 100000
#elif defined(BSP_I2C3_CLK_400)
#define I2C3_CLK 400000
#endif
#ifdef BSP_USING_I2C0
#ifndef I2C0_BUS_CONFIG
#define I2C0_BUS_CONFIG \
{ \
.base = I2C0_BASE, \
.bus_name = "i2c0", \
.clk_freq = I2C0_CLK, \
}
#endif /* I2C0_BUS_CONFIG */
#endif /* BSP_USING_I2C0 */
#ifdef BSP_USING_I2C1
#ifndef I2C1_BUS_CONFIG
#define I2C1_BUS_CONFIG \
{ \
.base = I2C1_BASE, \
.bus_name = "i2c1", \
.clk_freq = I2C1_CLK, \
}
#endif /* I2C1_BUS_CONFIG */
#endif /* BSP_USING_I2C1 */
#ifdef BSP_USING_I2C2
#ifndef I2C2_BUS_CONFIG
#define I2C2_BUS_CONFIG \
{ \
.base = I2C2_BASE, \
.bus_name = "i2c2", \
.clk_freq = I2C2_CLK, \
}
#endif /* I2C2_BUS_CONFIG */
#endif /* BSP_USING_I2C2 */
#ifdef BSP_USING_I2C3
#ifndef I2C3_BUS_CONFIG
#define I2C3_BUS_CONFIG \
{ \
.base = I2C3_BASE, \
.bus_name = "i2c3", \
.clk_freq = I2C3_CLK, \
}
#endif /* I2C3_BUS_CONFIG */
#endif /* BSP_USING_I2C3 */
#ifdef __cplusplus
}
#endif
#endif //__I2C_CONFIG_H__
|