diff --git a/nanoFramework.M5Core/M5Core.cs b/nanoFramework.M5Core/M5Core.cs
index 78f0934a..ea4a32bf 100644
--- a/nanoFramework.M5Core/M5Core.cs
+++ b/nanoFramework.M5Core/M5Core.cs
@@ -124,6 +124,8 @@ static M5Core()
// Setup first the I2C bus
Configuration.SetPinFunction(22, DeviceFunction.I2C1_CLOCK);
Configuration.SetPinFunction(21, DeviceFunction.I2C1_DATA);
+ // Same for PortA than for the internal one
+ _portANumber = 1;
// Create the energy management device
I2cDevice i2c = new(new I2cConnectionSettings(1, Ip5306.SecondaryI2cAddress));
diff --git a/nanoFramework.M5Core2/M5Core2.cs b/nanoFramework.M5Core2/M5Core2.cs
index a2481556..77cff7cd 100644
--- a/nanoFramework.M5Core2/M5Core2.cs
+++ b/nanoFramework.M5Core2/M5Core2.cs
@@ -133,7 +133,7 @@ private static void TouchCallback(object sender, PinValueChangedEventArgs pinVal
{
_startThread = new();
_cancelThread.Cancel();
- var point = _touchController.GetPoint(true);
+ var point = _touchController.GetPoint(true);
if ((_lastPoint.X != point.X) && (_lastPoint.Y != point.Y))
{
_lastPoint = point;
@@ -287,6 +287,12 @@ static M5Core2()
Configuration.SetPinFunction(13, DeviceFunction.COM2_RX);
Configuration.SetPinFunction(14, DeviceFunction.COM2_TX);
+ // Setup second I2C bus (port A)
+ Configuration.SetPinFunction(33, DeviceFunction.I2C2_CLOCK);
+ Configuration.SetPinFunction(32, DeviceFunction.I2C2_DATA);
+ // The portA is the second I2C
+ _portANumber = 2;
+
// Setup the time if any
_rtc = new Pcf8563(I2cDevice.Create(new I2cConnectionSettings(1, Pcf8563.DefaultI2cAddress)));
diff --git a/nanoFramework.M5StackCore/M5CoreBase.cs b/nanoFramework.M5StackCore/M5CoreBase.cs
index 7447060e..a800abdd 100644
--- a/nanoFramework.M5StackCore/M5CoreBase.cs
+++ b/nanoFramework.M5StackCore/M5CoreBase.cs
@@ -32,6 +32,7 @@ public static partial class M5Core
private static Screen _screen;
private static SerialPort _serialPort;
private static AdcController _adc;
+ private static int _portANumber;
///
/// Gets the Magnetometer.
@@ -113,14 +114,14 @@ public static DacChannel Dac2
///
/// The I2C device address on the bus.
/// The I2cDevice.
- public static I2cDevice GetI2cDevice(int i2cDeviceAddress) => new(new I2cConnectionSettings(1, i2cDeviceAddress));
+ public static I2cDevice GetI2cDevice(int i2cDeviceAddress) => new(new I2cConnectionSettings(_portANumber, i2cDeviceAddress));
///
/// Gets an I2C device.
///
/// The I2C device address on the bus.
/// The I2cDevice.
- public static I2cDevice GetGrove(int i2cDeviceAddress) => new(new I2cConnectionSettings(1, i2cDeviceAddress));
+ public static I2cDevice GetGrove(int i2cDeviceAddress) => new(new I2cConnectionSettings(_portANumber, i2cDeviceAddress));
///
/// Gets an SPI Device.