Skip to content

Commit 5bf7079

Browse files
authored
Merge pull request #3 from sparkfun/feature/tk-name-change
mods made to support name pattern changes in toolkit; cleanup and com…
2 parents c1c4301 + 090858f commit 5bf7079

File tree

13 files changed

+165
-132
lines changed

13 files changed

+165
-132
lines changed

examples/Example_01_BasicReadings/Example_01_BasicReadings.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void setup()
6969
bmv080.init();
7070

7171
/* Set the sensor mode to continuous mode */
72-
if (bmv080.setMode(SFE_BMV080_MODE_CONTINUOUS) == true)
72+
if (bmv080.setMode(SF_BMV080_MODE_CONTINUOUS) == true)
7373
{
7474
Serial.println("BMV080 set to continuous mode");
7575
}

examples/Example_02_DutyCycle/Example_02_DutyCycle.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void setup()
7777
}
7878

7979
/* Set the sensor mode to Duty Cycle mode */
80-
if(bmv080.setMode(SFE_BMV080_MODE_DUTY_CYCLE) == true)
80+
if(bmv080.setMode(SF_BMV080_MODE_DUTY_CYCLE) == true)
8181
{
8282
Serial.println("BMV080 set to Duty Cycle mode");
8383
}

examples/Example_03_Interrupt/Example_03_Interrupt.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void setup()
7575
/* Set the sensor mode to continuous mode */
7676
// The hardware interrupt of the BMV080 sensor unit cannot be used as trigger
7777
// in duty cycling mode.
78-
if(bmv080.setMode(SFE_BMV080_MODE_CONTINUOUS) == true)
78+
if(bmv080.setMode(SF_BMV080_MODE_CONTINUOUS) == true)
7979
{
8080
Serial.println("BMV080 set to continuous mode");
8181
}

examples/Example_04_SPI/Example_04_SPI.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void setup()
6868
bmv080.init();
6969

7070
/* Set the sensor mode to continuous mode */
71-
if(bmv080.setMode(SFE_BMV080_MODE_CONTINUOUS) == true)
71+
if(bmv080.setMode(SF_BMV080_MODE_CONTINUOUS) == true)
7272
{
7373
Serial.println("BMV080 set to continuous mode");
7474
}

examples/Example_05_Parameters/Example_05_Parameters.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void setup()
7979
getSetParameters(); // Get and set parameters
8080

8181
/* Set the sensor mode to continuous mode */
82-
if(bmv080.setMode(SFE_BMV080_MODE_CONTINUOUS) == true)
82+
if(bmv080.setMode(SF_BMV080_MODE_CONTINUOUS) == true)
8383
{
8484
Serial.println("BMV080 set to continuous mode");
8585
}

examples/Example_06_TwoSensors/Example_06_TwoSensors.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void setup()
9696
bmv080.init();
9797

9898
/* Set the sensor mode to continuous mode */
99-
if (bmv080.setMode(SFE_BMV080_MODE_CONTINUOUS) == true)
99+
if (bmv080.setMode(SF_BMV080_MODE_CONTINUOUS) == true)
100100
{
101101
Serial.println("BMV080 set to continuous mode");
102102
}
@@ -109,7 +109,7 @@ void setup()
109109

110110
bmv080_2.init();
111111

112-
if (bmv080_2.setMode(SFE_BMV080_MODE_CONTINUOUS) == true)
112+
if (bmv080_2.setMode(SF_BMV080_MODE_CONTINUOUS) == true)
113113
{
114114
Serial.println("BMV080_2 set to continuous mode");
115115
}

examples/Example_07_Demo_Alphanumeric/Example_07_Demo_Alphanumeric.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void setup()
7676
bmv080.init();
7777

7878
/* Set the sensor mode to continuous mode */
79-
if (bmv080.setMode(SFE_BMV080_MODE_CONTINUOUS) == true)
79+
if (bmv080.setMode(SF_BMV080_MODE_CONTINUOUS) == true)
8080
{
8181
Serial.println("BMV080 set to continuous mode");
8282
}

examples/Example_08_Demo_Oled/Example_08_Demo_Oled.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void setup()
154154
bmv080.init();
155155

156156
/* Set the sensor mode to continuous mode */
157-
if (bmv080.setMode(SFE_BMV080_MODE_CONTINUOUS) == true)
157+
if (bmv080.setMode(SF_BMV080_MODE_CONTINUOUS) == true)
158158
{
159159
Serial.println("BMV080 set to continuous mode");
160160
writeCenteredStringToDisplay("Continuous Mode Set", true);

src/SparkFun_BMV080_Arduino_Library.h

Lines changed: 65 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
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.
@@ -33,56 +28,85 @@
3328
SET_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
};
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)