Skip to content

Commit c1fab9c

Browse files
authored
Merge pull request #413 from cHemingway/fix_portenta_i2c_count
Add 3rd I2C bus for Arduino Portenta H7, Fixes #332
2 parents 8e7d954 + 29b8c3a commit c1fab9c

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

libraries/Wire/Wire.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,7 @@ arduino::MbedI2C Wire(I2C_SDA, I2C_SCL);
188188
#endif
189189
#if WIRE_HOWMANY > 1
190190
arduino::MbedI2C Wire1(I2C_SDA1, I2C_SCL1);
191+
#endif
192+
#if WIRE_HOWMANY > 2
193+
arduino::MbedI2C Wire2(I2C_SDA2, I2C_SCL2);
191194
#endif

libraries/Wire/Wire.h

+3
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,8 @@ extern arduino::MbedI2C Wire;
9595
#if WIRE_HOWMANY > 1
9696
extern arduino::MbedI2C Wire1;
9797
#endif
98+
#if WIRE_HOWMANY > 2
99+
extern arduino::MbedI2C Wire2;
100+
#endif
98101

99102
typedef arduino::MbedI2C TwoWire;

variants/PORTENTA_H7_M4/pins_arduino.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
115115
uint8_t getUniqueSerialNumber(uint8_t* name);
116116
void _ontouch1200bps_();
117117

118-
#define WIRE_HOWMANY 2
118+
#define WIRE_HOWMANY 3
119119

120120
#define I2C_SDA (digitalPinToPinName(PIN_WIRE_SDA))
121121
#define I2C_SCL (digitalPinToPinName(PIN_WIRE_SCL))
@@ -124,6 +124,8 @@ void _ontouch1200bps_();
124124
#define I2C_SCL_INTERNAL (PB_6)
125125
#define I2C_SDA1 I2C_SDA_INTERNAL
126126
#define I2C_SCL1 I2C_SCL_INTERNAL
127+
#define I2C_SDA2 (PH_12)
128+
#define I2C_SCL2 (PH_11)
127129

128130
#define SPI_HOWMANY 1
129131

variants/PORTENTA_H7_M7/pins_arduino.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
122122
uint8_t getUniqueSerialNumber(uint8_t* name);
123123
void _ontouch1200bps_();
124124

125-
#define WIRE_HOWMANY 2
125+
#define WIRE_HOWMANY 3
126126

127127
#define I2C_SDA (digitalPinToPinName(PIN_WIRE_SDA))
128128
#define I2C_SCL (digitalPinToPinName(PIN_WIRE_SCL))
@@ -131,6 +131,8 @@ void _ontouch1200bps_();
131131
#define I2C_SCL_INTERNAL (PB_6)
132132
#define I2C_SDA1 I2C_SDA_INTERNAL
133133
#define I2C_SCL1 I2C_SCL_INTERNAL
134+
#define I2C_SDA2 (PH_12)
135+
#define I2C_SCL2 (PH_11)
134136

135137
#define SPI_HOWMANY 1
136138

0 commit comments

Comments
 (0)