46#include <SparkFun_Toolkit.h>
58#define SFE_BMI330_SPI_CLOCK_DEFAULT 4000000
102 if (_theI2CBus.init(wirePort, address) != ksfTkErrOk)
107 if (_theI2CBus.ping() != ksfTkErrOk)
133 return _theI2CBus.address();
147 static bool findDevice(uint8_t &address, TwoWire &wirePort = Wire)
151 for (uint8_t i = 0; i < 2; i++)
155 if (candidate._theI2CBus.init(wirePort, kAddresses[i]) != ksfTkErrOk)
158 if (candidate._theI2CBus.ping() != ksfTkErrOk)
166 address = kAddresses[i];
175 sfTkArdI2C _theI2CBus;
225 digitalWrite(csPin, HIGH);
226 pinMode(csPin, OUTPUT);
227 digitalWrite(csPin, HIGH);
231 SPISettings settings(clockFrequency, MSBFIRST, SPI_MODE0);
233 if (_theSPIBus.init(spiPort, settings, csPin,
true) != ksfTkErrOk)
245 return _theSPIBus.cs();
250 sfTkArdSPI _theSPIBus;
#define SFE_BMI330_SPI_CLOCK_DEFAULT
Default SPI clock for SfeBMI330ArdSPI, in hertz.
Definition: SparkFun_BMI330.h:58
Arduino I2C implementation for the SparkFun Qwiic BMI330 breakout.
Definition: SparkFun_BMI330.h:77
bool begin(uint8_t address=SFE_BMI330_DEFAULT_ADDRESS, TwoWire &wirePort=Wire)
Initialize the board over I2C.
Definition: SparkFun_BMI330.h:100
bool begin(TwoWire &wirePort)
Initialize the board over I2C on an explicit Wire port at the default address.
Definition: SparkFun_BMI330.h:122
static bool findDevice(uint8_t &address, TwoWire &wirePort=Wire)
Check whether a BMI330 answers at either factory address on a given bus.
Definition: SparkFun_BMI330.h:147
SfeBMI330ArdI2C()
Definition: SparkFun_BMI330.h:79
uint8_t getAddress(void)
Get the 7-bit I2C address this object is using.
Definition: SparkFun_BMI330.h:131
Arduino SPI implementation for the SparkFun Qwiic BMI330 breakout.
Definition: SparkFun_BMI330.h:201
SfeBMI330ArdSPI()
Definition: SparkFun_BMI330.h:203
bool begin(uint8_t csPin, uint32_t clockFrequency=SFE_BMI330_SPI_CLOCK_DEFAULT, SPIClass &spiPort=SPI)
Initialize the board over SPI.
Definition: SparkFun_BMI330.h:222
uint8_t getCSPin(void)
Get the chip select pin this object is using.
Definition: SparkFun_BMI330.h:243
Platform-independent driver for the Bosch BMI330 6-DoF IMU.
Definition: sfDevBMI330.h:728
void setCommunicationBus(sfTkIBus *theBus)
Set the communication bus without initializing the device.
Definition: sfDevBMI330.cpp:72
bool isConnected(void)
Check that a BMI330 is responding.
Definition: sfDevBMI330.cpp:84
sfTkError_t begin(sfTkIBus *theBus=nullptr)
Adopt a bus, verify the device, and bring the feature engine up.
Definition: sfDevBMI330.cpp:37
Header file for the SparkFun Bosch BMI330 6-DoF IMU Driver.
#define SFE_BMI330_DEFAULT_ADDRESS
Factory-default 7-bit I2C address (SDO / ADR pin low).
Definition: sfDevBMI330.h:62
#define SFE_BMI330_ALT_ADDRESS
Alternate 7-bit I2C address, selected by the board's ADR jumper (SDO / ADR pin high).
Definition: sfDevBMI330.h:65