11/* *****************************************************************************
2- SparkFun_BMV080_Arduino_Library.h
3- SparkFun BMV080 Library header file
4-
5- by Pete Lewis @SparkFun Electronics
6- September 2025
7-
8- This file implements the BMV080 class, prototyped in SparkFun_BMV080_Arduino_Library.h
9-
10- Development environment specifics:
11- IDE: Arduino 2.3.3
12- Hardware Platform: SparkFun IoT Redboard ESP32
13- BMV080 Breakout HW Version: v01
14-
15- SPDX-License-Identifier: MIT
16-
17- Copyright (c) 2024 SparkFun Electronics
18-
19- Distributed as-is; no warranty is given.
20- ******************************************************************************/
2+ * @file SparkFun_BMV080_Arduino_Library.h
3+ * @brief SparkFun BMV080 Library header file
4+ *
5+ * This file implements the SparkFunBMV080I2C and SparkFunBMV080SPI classes,
6+ * for use with the SparkFun BMV080 sensor qwiic breakout board, HW version v01.
7+ *
8+ * @author Pete Lewis
9+ * @date Sprint 2025
10+ * @version 1.0
11+ * @copyright (c) 2024 SparkFun Electronics Inc. This project is released under the MIT License.
12+ *
13+ * SPDX-License-Identifier: MIT
14+ *
15+ ******************************************************************************/
2116
2217#pragma once
2318
24-
2519#include < SparkFun_Toolkit.h>
26- #include " sfeTk/sfeDevBMV080.h"
20+ #include " sfTk/sfDevBMV080.h"
21+
2722
2823// The BMV080 Bosch API requires a larger than usual stack size
2924// In particular, bmv080_serve_interrupt is the culprit.
3328SET_LOOP_TASK_STACK_SIZE (60 * 1024 ); // 60KB
3429#endif
3530
36- class SparkFunBMV080I2C : public sfeDevBMV080
31+ /* *
32+ * @brief Class for interfacing with the BMV080 sensor using I2C communication
33+ *
34+ * This class provides methods to initialize and communicate with the BMV080 sensor
35+ * over an I2C bus. It inherits from the sfDevBMV080 class and uses the SparkFun
36+ * Toolkit for I2C communication.
37+ *
38+ * @see sfDevBMV080
39+ */
40+ class SparkFunBMV080I2C : public sfDevBMV080
3741{
3842 public:
39- // / @brief Begins the Device
40- // / @param address I2C device address to use for the sensor
41- // / @param wirePort Wire port to use for I2C communication
42- // / @return True if successful, false otherwise
43- bool begin (const uint8_t address = SFE_BMV080_DEFAULT_ADDRESS, TwoWire &wirePort = Wire)
43+ /* *
44+ * @brief Begins the Device with I2C as the communication bus
45+ *
46+ * This method initializes the I2C bus and sets up communication with the BMV080 sensor.
47+ *
48+ * @param address I2C device address to use for the sensor
49+ * @param wirePort Wire port to use for I2C communication
50+ * @return True if successful, false otherwise
51+ */
52+ bool begin (const uint8_t address = SF_BMV080_DEFAULT_ADDRESS, TwoWire &wirePort = Wire)
4453 {
4554 // Setup Arduino I2C bus
4655 _theI2CBus.init (wirePort, address);
4756 _theI2CBus.setByteOrder (SFTK_MSBFIRST);
4857
4958 // Begin the sensor
50- sfeTkError_t rc = sfeDevBMV080 ::begin (&_theI2CBus);
59+ sfTkError_t rc = sfDevBMV080 ::begin (&_theI2CBus);
5160
52- return rc == kSTkErrOk ? isConnected () : false ;
61+ return rc == ksfTkErrOk ? isConnected () : false ;
5362 }
5463
5564 // / @brief Checks if the Device is connected
5665 // / @return True if the sensor is connected, false otherwise
5766 bool isConnected ()
5867 {
59- return _theI2CBus.ping () == kSTkErrOk ;
68+ return _theI2CBus.ping () == ksfTkErrOk ;
6069 }
6170
6271 private:
63- sfeTkArdI2C _theI2CBus;
72+ sfTkArdI2C _theI2CBus;
6473};
6574
66- class SparkFunBMV080SPI : public sfeDevBMV080
75+ /* *
76+ * @brief Class for interfacing with the BMV080 sensor using SPI communication
77+ *
78+ * This class provides methods to initialize and communicate with the BMV080 sensor
79+ * over an SPI bus. It inherits from the sfDevBMV080 class and uses the SparkFun
80+ * Toolkit for SPI communication.
81+ *
82+ * @see sfDevBMV080
83+ */
84+ class SparkFunBMV080SPI : public sfDevBMV080
6785{
6886 public:
69- // / @brief Begins the Device with SPI as the communication bus
70- // / @param csPin The chip select pin for the sensor
71- // / @param spiPort The SPI port to use for communication
72- // / @param spiSettings The SPI settings to use for communication
73- // / @return True if successful, false otherwise
74- bool begin (uint8_t csPin, SPIClass &spiPort = SPI, SPISettings spiSettings = SPISettings(100000 , MSBFIRST, SPI_MODE0))
87+ /* *
88+ * @brief Begins the Device with SPI as the communication bus
89+ *
90+ * This method initializes the SPI bus and sets up communication with the BMV080 sensor.
91+ *
92+ * @param csPin The chip select pin for the sensor
93+ * @param spiPort The SPI port to use for communication
94+ * @param spiSettings The SPI settings to use for communication
95+ * @return True if successful, false otherwise
96+ */
97+ bool begin (uint8_t csPin, SPIClass &spiPort = SPI,
98+ SPISettings spiSettings = SPISettings(100000 , MSBFIRST, SPI_MODE0))
7599 {
76100
77101 // Setup Arduino SPI bus
78102 _theSPIBus.init (spiPort, spiSettings, csPin, true );
79103
80104 // Begin the sensor
81- sfeTkError_t rc = sfeDevBMV080 ::begin (&_theSPIBus);
105+ sfTkError_t rc = sfDevBMV080 ::begin (&_theSPIBus);
82106
83- return rc == kSTkErrOk ? true : false ;
107+ return rc == ksfTkErrOk ? true : false ;
84108 }
85109
86110 private:
87- sfeTkArdSPI _theSPIBus;
111+ sfTkArdSPI _theSPIBus;
88112};
0 commit comments