File tree 6 files changed +54
-8
lines changed
6 files changed +54
-8
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,27 @@ i2c_dev i2c_dev2 = {
80
80
};
81
81
#endif
82
82
83
+ #if BOARD_NR_I2C > 2
84
+ /** I2C2 device */
85
+ i2c_dev i2c_dev3 = {
86
+ .regs = I2C3_BASE ,
87
+ #ifdef BOARD_I2C3_SDA_PIN
88
+ .sda_pin = BOARD_I2C3_SDA_PIN ,
89
+ #else
90
+ .sda_pin = PC9 ,
91
+ #endif
92
+ #ifdef BOARD_I2C3_SCL_PIN
93
+ .scl_pin = BOARD_I2C3_SCL_PIN ,
94
+ #else
95
+ .scl_pin = PA8 ,
96
+ #endif
97
+ .clk_id = RCC_I2C3 ,
98
+ .ev_nvic_line = NVIC_I2C3_EV ,
99
+ .er_nvic_line = NVIC_I2C3_ER ,
100
+ .state = I2C_STATE_DISABLED
101
+ };
102
+ #endif
103
+
83
104
static inline int32 wait_for_state_change (i2c_dev * dev ,
84
105
i2c_state state ,
85
106
uint32 timeout );
@@ -535,6 +556,11 @@ void __irq_i2c2_ev(void) {
535
556
i2c_irq_handler (& i2c_dev2 );
536
557
}
537
558
#endif
559
+ #if BOARD_NR_I2C > 2
560
+ void __irq_i2c3_ev (void ) {
561
+ i2c_irq_handler (& i2c_dev3 );
562
+ }
563
+ #endif
538
564
/**
539
565
* @brief Interrupt handler for I2C error conditions
540
566
* @param dev I2C device
@@ -564,6 +590,11 @@ void __irq_i2c2_er(void) {
564
590
i2c_irq_error_handler (& i2c_dev2 );
565
591
}
566
592
#endif
593
+ #if BOARD_NR_I2C > 2
594
+ void __irq_i2c3_er (void ) {
595
+ i2c_irq_error_handler (& i2c_dev3 );
596
+ }
597
+ #endif
567
598
/*
568
599
* CCR/TRISE configuration helper
569
600
*/
Original file line number Diff line number Diff line change @@ -100,6 +100,10 @@ extern i2c_dev i2c_dev1;
100
100
extern i2c_dev i2c_dev2 ;
101
101
#define I2C2 (&i2c_dev2)
102
102
#endif
103
+ #if BOARD_NR_I2C > 2
104
+ extern i2c_dev i2c_dev3 ;
105
+ #define I2C3 (&i2c_dev3)
106
+ #endif
103
107
104
108
/*
105
109
* Register map base pointers
@@ -109,6 +113,8 @@ extern i2c_dev i2c_dev2;
109
113
#define I2C1_BASE ((struct i2c_reg_map*)0x40005400)
110
114
/** I2C2 register map base pointer */
111
115
#define I2C2_BASE ((struct i2c_reg_map*)0x40005800)
116
+ /** I2C3 register map base pointer */
117
+ #define I2C3_BASE ((struct i2c_reg_map*)0x40005C00)
112
118
113
119
/*
114
120
* Register bit definitions
Original file line number Diff line number Diff line change @@ -67,6 +67,11 @@ TwoWire::TwoWire(uint8 dev_sel, uint8 flags) {
67
67
else if (dev_sel == 2 ) {
68
68
sel_hard = I2C2;
69
69
}
70
+ #endif
71
+ #if BOARD_NR_I2C>2
72
+ else if (dev_sel == 3 ) {
73
+ sel_hard = I2C3;
74
+ }
70
75
#endif
71
76
else {
72
77
ASSERT (1 );
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ tools.stlink_upload.cmd=stlink_upload
121
121
tools.stlink_upload.cmd.windows=stlink_upload.bat
122
122
tools.stlink_upload.path.windows={runtime.hardware.path}/tools/win
123
123
tools.stlink_upload.path.macosx={runtime.hardware.path}/tools/macosx
124
- tools.stlink_upload.path.linux={runtime.hardware.path}/tools/linux64
124
+ tools.stlink_upload.path.linux={runtime.hardware.path}/tools/linux
125
125
tools.stlink_upload.path.linux64={runtime.hardware.path}/tools/linux64
126
126
tools.stlink_upload.upload.params.verbose=-d
127
127
tools.stlink_upload.upload.params.quiet=
@@ -132,7 +132,7 @@ tools.hid_upload.cmd=hid_upload
132
132
tools.hid_upload.cmd.windows=hid_upload.bat
133
133
tools.hid_upload.path.windows={runtime.hardware.path}/tools/win
134
134
tools.hid_upload.path.macosx={runtime.hardware.path}/tools/macosx
135
- tools.hid_upload.path.linux={runtime.hardware.path}/tools/linux64
135
+ tools.hid_upload.path.linux={runtime.hardware.path}/tools/linux
136
136
tools.hid_upload.path.linux64={runtime.hardware.path}/tools/linux64
137
137
tools.hid_upload.upload.params.verbose=-d
138
138
tools.hid_upload.upload.params.quiet=n
Original file line number Diff line number Diff line change 52
52
//#define BOARD_USART6_TX_PIN PA11 // USB_DM
53
53
//#define BOARD_USART6_RX_PIN PA12 // USB_DP
54
54
55
- #define BOARD_NR_I2C 2
55
+ #define BOARD_NR_I2C 3
56
56
#define BOARD_I2C1_SCL_PIN PB6
57
57
#define BOARD_I2C1_SDA_PIN PB7
58
58
#define BOARD_I2C1A_SCL_PIN PB8
59
59
#define BOARD_I2C1A_SDA_PIN PB9
60
- #define BOARD_I2C2_SCL_PIN PB10
61
- #define BOARD_I2C2_SDA_PIN PB3
60
+ #define BOARD_I2C2_SCL_PIN PB10
61
+ #define BOARD_I2C2_SDA_PIN PB3
62
+ #define BOARD_I2C3_SCL_PIN PA8
63
+ #define BOARD_I2C3_SDA_PIN PB4
62
64
63
65
#define BOARD_NR_SPI 3
64
66
#define BOARD_SPI1_NSS_PIN PA4
Original file line number Diff line number Diff line change 53
53
//#define BOARD_USART6_TX_PIN PA11 // USB_DM
54
54
//#define BOARD_USART6_RX_PIN PA12 // USB_DP
55
55
56
- #define BOARD_NR_I2C 2
56
+ #define BOARD_NR_I2C 3
57
57
#define BOARD_I2C1_SCL_PIN PB6
58
58
#define BOARD_I2C1_SDA_PIN PB7
59
59
#define BOARD_I2C1A_SCL_PIN PB8
60
60
#define BOARD_I2C1A_SDA_PIN PB9
61
- #define BOARD_I2C2_SCL_PIN PB10
62
- #define BOARD_I2C2_SDA_PIN PB3
61
+ #define BOARD_I2C2_SCL_PIN PB10
62
+ #define BOARD_I2C2_SDA_PIN PB3
63
+ #define BOARD_I2C3_SCL_PIN PA8
64
+ #define BOARD_I2C3_SDA_PIN PB4
63
65
64
66
#define BOARD_NR_SPI 3
65
67
#define BOARD_SPI1_NSS_PIN PA4
You can’t perform that action at this time.
0 commit comments