1
1
/* *****************************************************************************
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
+ ******************************************************************************/
21
16
22
17
#pragma once
23
18
24
-
25
19
#include < SparkFun_Toolkit.h>
26
- #include " sfeTk/sfeDevBMV080.h"
20
+ #include " sfTk/sfDevBMV080.h"
21
+
27
22
28
23
// The BMV080 Bosch API requires a larger than usual stack size
29
24
// In particular, bmv080_serve_interrupt is the culprit.
33
28
SET_LOOP_TASK_STACK_SIZE (60 * 1024 ); // 60KB
34
29
#endif
35
30
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
37
41
{
38
42
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)
44
53
{
45
54
// Setup Arduino I2C bus
46
55
_theI2CBus.init (wirePort, address);
47
56
_theI2CBus.setByteOrder (SFTK_MSBFIRST);
48
57
49
58
// Begin the sensor
50
- sfeTkError_t rc = sfeDevBMV080 ::begin (&_theI2CBus);
59
+ sfTkError_t rc = sfDevBMV080 ::begin (&_theI2CBus);
51
60
52
- return rc == kSTkErrOk ? isConnected () : false ;
61
+ return rc == ksfTkErrOk ? isConnected () : false ;
53
62
}
54
63
55
64
// / @brief Checks if the Device is connected
56
65
// / @return True if the sensor is connected, false otherwise
57
66
bool isConnected ()
58
67
{
59
- return _theI2CBus.ping () == kSTkErrOk ;
68
+ return _theI2CBus.ping () == ksfTkErrOk ;
60
69
}
61
70
62
71
private:
63
- sfeTkArdI2C _theI2CBus;
72
+ sfTkArdI2C _theI2CBus;
64
73
};
65
74
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
67
85
{
68
86
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))
75
99
{
76
100
77
101
// Setup Arduino SPI bus
78
102
_theSPIBus.init (spiPort, spiSettings, csPin, true );
79
103
80
104
// Begin the sensor
81
- sfeTkError_t rc = sfeDevBMV080 ::begin (&_theSPIBus);
105
+ sfTkError_t rc = sfDevBMV080 ::begin (&_theSPIBus);
82
106
83
- return rc == kSTkErrOk ? true : false ;
107
+ return rc == ksfTkErrOk ? true : false ;
84
108
}
85
109
86
110
private:
87
- sfeTkArdSPI _theSPIBus;
111
+ sfTkArdSPI _theSPIBus;
88
112
};
0 commit comments