Skip to content

Feature/sdk v11.0.0 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 52 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2fd7be8
refactor to make use of bus object - compiles - unclear if it works
gigapod Oct 3, 2024
fa565c8
added byteswap to read cb - seems to work
gigapod Oct 3, 2024
125cafb
cleanup/added comments; simpliefed the init() method a little
gigapod Oct 3, 2024
2ddb72b
updated examples 2,3,5 to work with sfetookit
lewispg228 Oct 14, 2024
7c3d14e
attempting SPI in tk - not working yet
lewispg228 Oct 28, 2024
d885f98
two classes `SparkFunBMV080I2C`and `SparkFunBMV080SPI`
lewispg228 Nov 4, 2024
d3caf74
I2C and SPI examples working with toolkit branch
lewispg228 Nov 8, 2024
166d59a
removed debug for spi vs i2c
lewispg228 Nov 8, 2024
4b6e55b
write callback (when I2C) now using writeRegister16Region16
lewispg228 Nov 11, 2024
1be0e3d
simplify bus type check if statement (write callback)
lewispg228 Nov 11, 2024
49fb9ec
read callback (when using I2C) now using readRegister16Region16
lewispg228 Nov 11, 2024
6fb6a97
switched to overloaded versions of the functions
lewispg228 Nov 11, 2024
39066a5
code cleanup
lewispg228 Nov 12, 2024
b04a6f9
ex6 two sensors over I2C working
lewispg228 Nov 14, 2024
f232cb5
ex7 demo with 7-seg display
lewispg228 Nov 25, 2024
c6aad08
ex1 and 5 working with sdk v10.0.0
lewispg228 Nov 25, 2024
c3f0544
m33 support
lewispg228 Dec 3, 2024
c49fd10
esp32s2 support
lewispg228 Dec 3, 2024
fd73d2c
more architectures WIP
lewispg228 Dec 4, 2024
a68b74f
replaced archives with the m33 versions from Bosch
gigapod Dec 6, 2024
dab78c0
Board check to set Wire vs Wire1
lewispg228 Dec 6, 2024
fa8820f
moved include of library above macro define of wire1
lewispg228 Dec 12, 2024
5ff7f7b
renaming example 7 to include "alphanumeric"
lewispg228 Dec 16, 2024
890529b
example 8 demo OLED
lewispg228 Dec 16, 2024
3da096c
added batt level indicator to example 8
lewispg228 Dec 17, 2024
9979377
obstruction no longer clears screen
lewispg228 Dec 17, 2024
4eb84cc
in progress changes from review; changed get<Prop>() name scheme to <…
gigapod Feb 6, 2025
d62988b
updated examples to use the new core changes -- not validated yet
gigapod Feb 6, 2025
77d4774
updated examples to use the new core changes -- not validated yet
gigapod Feb 7, 2025
f0e45bc
changed include order - helps with header file location when using ar…
gigapod Feb 7, 2025
5d3e83f
some refactor; cleanup any use of arduino; simplify the get data meth…
gigapod Feb 7, 2025
162affd
add toolkit depenancy to library props
gigapod Feb 7, 2025
af45c9f
moved to the newer pattern for core toolkit functions
gigapod Feb 10, 2025
2870779
moved core files to sfeTk/ sub-dir; changed core class name to match …
gigapod Feb 10, 2025
eb63924
move to use new toolkit function names
gigapod Feb 11, 2025
b6b4224
fix comment
gigapod Feb 12, 2025
bc8edc2
copilot-fu on the method doxygen comments
gigapod Feb 13, 2025
8c2215b
add IBus include file
gigapod Feb 13, 2025
d402e81
Merge pull request #2 from sparkfun/development/v10.0.0-review
gigapod Feb 14, 2025
1fb087b
typo fixo
gigapod Feb 14, 2025
c1c4301
doxy headers for file; formatter runs
gigapod Feb 14, 2025
090858f
mods made to support name pattern changes in toolkit; cleanup and com…
gigapod Feb 14, 2025
5bf7079
Merge pull request #3 from sparkfun/feature/tk-name-change
gigapod Feb 14, 2025
336a5c8
removed I2C from i2c classname - just make the default be i2c, which …
gigapod Feb 15, 2025
69adea6
add formatting blocks on header
gigapod Feb 15, 2025
2d4a465
add toolkit versioning; fix url
gigapod Feb 18, 2025
cfb5c49
updated to the latest libs from bosch - still an issue with m33 compi…
gigapod Feb 18, 2025
d96fc72
fix mistake on naming did during copy over
gigapod Feb 18, 2025
9316c17
changes for the library upgrades
gigapod Feb 18, 2025
75149a7
adds PM10
lewispg228 Feb 18, 2025
d51cb51
small corrections in examples
lewispg228 Mar 18, 2025
c3be028
example 9 open close
lewispg228 Mar 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 36 additions & 20 deletions examples/Example_01_BasicReadings/Example_01_BasicReadings.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
SparkFun Electronics
Date: September, 2024
SparkFun code, firmware, and software is released under the MIT License.
Please see LICENSE.md for further details.
Please see LICENSE.md for further details.

Hardware Connections:
IoT RedBoard --> BMV080
Expand All @@ -21,48 +21,55 @@
Serial.print it out at 115200 baud to serial monitor.

Feel like supporting our work? Buy a board from SparkFun!
https://www.sparkfun.com/products/?????
https://www.sparkfun.com/products/26554
*/

#include <Wire.h>
#include "SparkFun_BMV080_Arduino_Library.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_BMV080
#include <Wire.h>

Bmv080 bmv080; // Create an instance of the BMV080 class
SparkFunBMV080 bmv080; // Create an instance of the BMV080 class
#define BMV080_ADDR 0x57 // SparkFun BMV080 Breakout defaults to 0x57

i2c_device_t i2c_device = {}; // I2C device struct instance for Bosch API
// Some Dev boards have their QWIIC connector on Wire or Wire1
// This #ifdef will help this sketch work across more products

#ifdef ARDUINO_SPARKFUN_THINGPLUS_RP2040
#define wirePort Wire1
#else
#define wirePort Wire
#endif

void setup()
{
Serial.begin(115200);

while(!Serial) delay(10); // Wait for Serial to become available.
while (!Serial)
delay(10); // Wait for Serial to become available.
// Necessary for boards with native USB (like the SAMD51 Thing+).
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
// Comment out this while loop, or it will prevent the remaining code from running.

Serial.println();
Serial.println("BMV080 Example 1 - Basic Readings");

Wire.begin();
wirePort.begin();

if (bmv080.begin(BMV080_ADDR, Wire) == false) {
Serial.println("BMV080 not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
if (bmv080.begin(BMV080_ADDR, wirePort) == false)
{
Serial.println(
"BMV080 not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
while (1)
;
;
}
Serial.println("BMV080 found!");

// Wire.setClock(400000); //Increase I2C data rate to 400kHz

/* Communication interface initialization */
i2c_init(&i2c_device);
// wirePort.setClock(400000); //Increase I2C data rate to 400kHz

/* Initialize the Sensor (read driver, open, reset, id etc.)*/
bmv080.init(&i2c_device);
bmv080.init();

/* Set the sensor mode to continuous mode */
if(bmv080.setMode(SFE_BMV080_MODE_CONTINUOUS) == true)
if (bmv080.setMode(SF_BMV080_MODE_CONTINUOUS) == true)
{
Serial.println("BMV080 set to continuous mode");
}
Expand All @@ -74,13 +81,22 @@ void setup()

void loop()
{
if(bmv080.dataAvailable())
if (bmv080.readSensor())
{
float pm25 = bmv080.getPM25();

float pm10 = bmv080.PM10();
float pm25 = bmv080.PM25();
float pm1 = bmv080.PM1();

Serial.print("PM10: ");
Serial.print(pm10);
Serial.print("\t");
Serial.print("PM2.5: ");
Serial.print(pm25);
Serial.print("\t");
Serial.print("PM1: ");
Serial.print(pm1);

if(bmv080.getIsObstructed() == true)
if (bmv080.isObstructed() == true)
{
Serial.print("\tObstructed");
}
Expand Down
32 changes: 18 additions & 14 deletions examples/Example_02_DutyCycle/Example_02_DutyCycle.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,23 @@
Serial.print it out at 115200 baud to serial monitor.

Feel like supporting our work? Buy a board from SparkFun!
https://www.sparkfun.com/products/?????
https://www.sparkfun.com/products/26554
*/

#include <Wire.h>
#include "SparkFun_BMV080_Arduino_Library.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_BMV080

Bmv080 bmv080; // Create an instance of the BMV080 class
SparkFunBMV080 bmv080; // Create an instance of the BMV080 class
#define BMV080_ADDR 0x57 // SparkFun BMV080 Breakout defaults to 0x57

i2c_device_t i2c_device = {}; // I2C device struct instance for Bosch API
// Some Dev boards have their QWIIC connector on Wire or Wire1
// This #ifdef will help this sketch work across more products

#ifdef ARDUINO_SPARKFUN_THINGPLUS_RP2040
#define wirePort Wire1
#else
#define wirePort Wire
#endif

void setup()
{
Expand All @@ -44,22 +51,19 @@ void setup()
Serial.println();
Serial.println("BMV080 Example 2 - Duty Cycle");

Wire.begin();
wirePort.begin();

if (bmv080.begin(BMV080_ADDR, Wire) == false) {
if (bmv080.begin(BMV080_ADDR, wirePort) == false) {
Serial.println("BMV080 not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
while (1)
;
}
Serial.println("BMV080 found!");

// Wire.setClock(400000); //Increase I2C data rate to 400kHz

/* Communication interface initialization */
i2c_init(&i2c_device);
// wirePort.setClock(400000); //Increase I2C data rate to 400kHz

/* Initialize the Sensor (read driver, open, reset, id etc.)*/
bmv080.init(&i2c_device);
bmv080.init();

/* Set the sensor Duty Cycling Period (seconds)*/
uint16_t duty_cycling_period = 20;
Expand All @@ -73,7 +77,7 @@ void setup()
}

/* Set the sensor mode to Duty Cycle mode */
if(bmv080.setMode(SFE_BMV080_MODE_DUTY_CYCLE) == true)
if(bmv080.setMode(SF_BMV080_MODE_DUTY_CYCLE) == true)
{
Serial.println("BMV080 set to Duty Cycle mode");
}
Expand All @@ -85,13 +89,13 @@ void setup()

void loop()
{
if(bmv080.dataAvailable())
if(bmv080.readSensor())
{
float pm25 = bmv080.getPM25();
float pm25 = bmv080.PM25();

Serial.print(pm25);

if(bmv080.getIsObstructed() == true)
if(bmv080.isObstructed() == true)
{
Serial.print("\tObstructed");
}
Expand Down
34 changes: 19 additions & 15 deletions examples/Example_03_Interrupt/Example_03_Interrupt.ino
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,27 @@
Serial.print it out at 115200 baud to serial monitor.

Feel like supporting our work? Buy a board from SparkFun!
https://www.sparkfun.com/products/?????
https://www.sparkfun.com/products/26554
*/

#include <Wire.h>
#include "SparkFun_BMV080_Arduino_Library.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_BMV080

Bmv080 bmv080; // Create an instance of the BMV080 class
SparkFunBMV080 bmv080; // Create an instance of the BMV080 class
#define BMV080_ADDR 0x57 // SparkFun BMV080 Breakout defaults to 0x57
#define IRQ_Pin 14

i2c_device_t i2c_device = {}; // I2C device struct instance for Bosch API

bool int_flag = false;

// Some Dev boards have their QWIIC connector on Wire or Wire1
// This #ifdef will help this sketch work across more products

#ifdef ARDUINO_SPARKFUN_THINGPLUS_RP2040
#define wirePort Wire1
#else
#define wirePort Wire
#endif

void setup()
{
Serial.begin(115200);
Expand All @@ -51,27 +58,24 @@ void setup()
Serial.println();
Serial.println("BMV080 Example 3 - Interrupt");

Wire.begin();
wirePort.begin();

if (bmv080.begin(BMV080_ADDR, Wire) == false) {
if (bmv080.begin(BMV080_ADDR, wirePort) == false) {
Serial.println("BMV080 not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
while (1)
;
}
Serial.println("BMV080 found!");

// Wire.setClock(400000); //Increase I2C data rate to 400kHz

/* Communication interface initialization */
i2c_init(&i2c_device);
// wirePort.setClock(400000); //Increase I2C data rate to 400kHz

/* Initialize the Sensor (read driver, open, reset, id etc.)*/
bmv080.init(&i2c_device);
bmv080.init();

/* Set the sensor mode to continuous mode */
// The hardware interrupt of the BMV080 sensor unit cannot be used as trigger
// in duty cycling mode.
if(bmv080.setMode(SFE_BMV080_MODE_CONTINUOUS) == true)
if(bmv080.setMode(SF_BMV080_MODE_CONTINUOUS) == true)
{
Serial.println("BMV080 set to continuous mode");
}
Expand All @@ -91,11 +95,11 @@ void loop()
int_flag = false; // Reset the flag
do{
Serial.println("Reading BMV080");
if(bmv080.dataAvailable())
if(bmv080.readSensor())
{
float pm25 = bmv080.getPM25();
float pm25 = bmv080.PM25();
Serial.print(pm25);
if(bmv080.getIsObstructed() == true)
if(bmv080.isObstructed() == true)
{
Serial.print("\tObstructed");
}
Expand Down
30 changes: 18 additions & 12 deletions examples/Example_04_SPI/Example_04_SPI.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@
Serial.print it out at 115200 baud to serial monitor.

Feel like supporting our work? Buy a board from SparkFun!
https://www.sparkfun.com/products/?????
https://www.sparkfun.com/products/26554
*/

#include <Wire.h>
#include "SparkFun_BMV080_Arduino_Library.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_BMV080

Bmv080 bmv080; // Create an instance of the BMV080 class

spi_device_t spi_device = {}; // SPI device struct instance for Bosch API
SparkFunBMV080SPI bmv080; // Create an instance of the BMV080 class
#define CS_PIN 5 // Define the chip select pin

void setup()
{
Expand All @@ -48,21 +47,28 @@ void setup()
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
// Comment out this while loop, or it will prevent the remaining code from running.

pinMode(CS_PIN, OUTPUT);
pinMode(MOSI, OUTPUT);
pinMode(SCK, OUTPUT);
pinMode(MISO, INPUT);
digitalWrite(CS_PIN, HIGH);

Serial.println();
Serial.println("BMV080 Example 4 - SPI");

/* Communication interface initialization */
spi_init(&spi_device);

if (bmv080.initSPI(&spi_device) == false) {
if (bmv080.begin(CS_PIN, SPI) == false) {
Serial.println("SPI init failure. Check your jumpers and the hookup guide. Freezing...");
while (1)
;
}
Serial.println("BMV080 SPI init successful");


/* Initialize the Sensor (read driver, open, reset, id etc.)*/
bmv080.init();

/* Set the sensor mode to continuous mode */
if(bmv080.setMode(SFE_BMV080_MODE_CONTINUOUS) == true)
if(bmv080.setMode(SF_BMV080_MODE_CONTINUOUS) == true)
{
Serial.println("BMV080 set to continuous mode");
}
Expand All @@ -74,13 +80,13 @@ void setup()

void loop()
{
if(bmv080.dataAvailable())
if(bmv080.readSensor())
{
float pm25 = bmv080.getPM25();
float pm25 = bmv080.PM25();

Serial.print(pm25);

if(bmv080.getIsObstructed() == true)
if(bmv080.isObstructed() == true)
{
Serial.print("\tObstructed");
}
Expand Down
Loading