@@ -45,7 +45,7 @@ Distributed as-is; no warranty is given.
45
45
// Default construction is I2C mode, address 0x6B.
46
46
//
47
47
// ****************************************************************************//
48
- LSM6DS3Core::LSM6DS3Core ( uint8_t busType, uint8_t inputArg) : commInterface(I2C_MODE), I2CAddress(0x6B ), chipSelectPin(10 )
48
+ LSM6DS3Core::LSM6DS3Core ( uint8_t busType, uint8_t inputArg ) : commInterface(I2C_MODE), I2CAddress(0x6B ), chipSelectPin(10 )
49
49
{
50
50
commInterface = busType;
51
51
if ( commInterface == I2C_MODE )
@@ -59,15 +59,18 @@ LSM6DS3Core::LSM6DS3Core( uint8_t busType, uint8_t inputArg) : commInterface(I2C
59
59
60
60
}
61
61
62
- status_t LSM6DS3Core::beginCore (void )
62
+ status_t LSM6DS3Core::beginCore ( int8_t inputSDA, int8_t inputSCL )
63
63
{
64
64
status_t returnError = IMU_SUCCESS;
65
- uint32_t spiPortSpeed = 5000000 ;
65
+ uint32_t spiPortSpeed = 5000000 ;
66
66
67
67
switch (commInterface) {
68
68
69
69
case I2C_MODE:
70
- Wire.begin ();
70
+ if ( inputSDA != -1 && inputSCL != -1 )
71
+ Wire.begin ( inputSDA, inputSCL );
72
+ else
73
+ Wire.begin ();
71
74
break ;
72
75
73
76
case SPI_MODE:
@@ -378,13 +381,13 @@ LSM6DS3::LSM6DS3( uint8_t busType, uint8_t inputArg ) : LSM6DS3Core( busType, in
378
381
// "myIMU.settings.accelEnabled = 1;" to configure before calling .begin();
379
382
//
380
383
// ****************************************************************************//
381
- status_t LSM6DS3::begin (SensorSettings* pSettingsYouWanted)
384
+ status_t LSM6DS3::begin (SensorSettings* pSettingsYouWanted, int8_t inputSDA, int8_t inputSCL )
382
385
{
383
386
// Check the settings structure values to determine how to setup the device
384
387
uint8_t dataToWrite = 0 ; // Temporary variable
385
388
386
389
// Begin the inherited core. This gets the physical wires connected
387
- status_t returnError = beginCore ();
390
+ status_t returnError = beginCore (inputSDA,inputSCL );
388
391
389
392
// Copy the values from the user's settings into the output 'pSettingsYouWanted'
390
393
// compare settings with 'pSettingsYouWanted' after 'begin' to see if anything changed
0 commit comments