@@ -77,24 +77,26 @@ void NineAxesMotion::initSensor(unsigned int address, int int_pin, int reset_pin
77
77
RESET_PIN = reset_pin;
78
78
79
79
// Initialize the GPIO peripheral
80
- pinMode (INT_PIN , INPUT_PULLUP); // Configure Interrupt pin
81
- pinMode (RESET_PIN , OUTPUT); // Configure Reset pin
80
+ pinMode (int_pin , INPUT_PULLUP); // Configure Interrupt pin
81
+ pinMode (reset_pin , OUTPUT); // Configure Reset pin
82
82
83
83
// Power on the BNO055
84
- resetSensor (address);
84
+ resetSensor (address, reset_pin );
85
85
}
86
86
87
87
/* ******************************************************************************************
88
88
*Description: This function is used to reset the BNO055
89
- *Input Parameters: None
89
+ *Input Parameters:
90
+ unsigned int address: I2C address of the BNO055. Default 0x28
91
+ int reset_pin: GPIO to reset the BNO055 (RESET pin has to be HIGH for the BNO055 to operate)
90
92
*Return Parameter: None
91
93
*******************************************************************************************/
92
- void NineAxesMotion::resetSensor (unsigned int address)
94
+ void NineAxesMotion::resetSensor (unsigned int address, int reset_pin )
93
95
{
94
96
// Reset sequence
95
- digitalWrite (RESET_PIN , LOW); // Set the Reset pin LOW
97
+ digitalWrite (reset_pin , LOW); // Set the Reset pin LOW
96
98
delay (RESET_PERIOD); // Hold it for a while
97
- digitalWrite (RESET_PIN , HIGH); // Set the Reset pin HIGH
99
+ digitalWrite (reset_pin , HIGH); // Set the Reset pin HIGH
98
100
delay (INIT_PERIOD); // Pause for a while to let the sensor initialize completely (Anything >500ms should be fine)
99
101
// Initialization sequence
100
102
// Link the function pointers for communication (late-binding)
@@ -985,7 +987,7 @@ signed char BNO055_I2C_bus_read(unsigned char dev_addr,unsigned char reg_addr, u
985
987
}
986
988
987
989
988
- signed char BNO055_I2C_bus_write (unsigned char dev_addr,unsigned char reg_addr, unsigned char *reg_data, unsigned char cnt)
990
+ signed char BNO055_I2C_bus_write (unsigned char dev_addr, unsigned char reg_addr, unsigned char *reg_data, unsigned char cnt)
989
991
{
990
992
BNO055_RETURN_FUNCTION_TYPE comres = BNO055_ZERO_U8X;
991
993
I2C.beginTransmission (dev_addr); // Start of transmission
@@ -1006,7 +1008,7 @@ void _delay(u_32 period)
1006
1008
}
1007
1009
1008
1010
1009
- void NineAxesMotion::begin (unsigned int address = 0x28 )
1011
+ void NineAxesMotion::begin (unsigned int address)
1010
1012
{
1011
1013
initSensor (address);
1012
1014
}
0 commit comments