11/* *****************************************************************************
2- sfeQwiicBuzzer.h
3- SparkFun Qwiic Buzzer Library header file
2+ sfeBmv080.cpp
3+ SparkFun BMV080 Library CPP file
44
55 by Pete Lewis @SparkFun Electronics
6- January 2024
7-
8- Based on original source code written by
9- Fischer Moseley @ SparkFun Electronics
10- Original Creation Date: July 24, 2019
6+ September 2024
117
128 Development environment specifics:
13- IDE: Arduino 2.2.1
14- Hardware Platform: Arduino Uno/ SparkFun Redboard
15- Qwiic Buzzer Version: v10
9+ IDE: Arduino 2.3.3
10+ Hardware Platform: SparkFun IoT Redboard ESP32
11+ BMV080 Breakout HW Version: v01
1612
1713 SPDX-License-Identifier: MIT
1814
19- Copyright (c) 2023 SparkFun Electronics
15+ Copyright (c) 2024 SparkFun Electronics
2016
2117 Distributed as-is; no warranty is given.
2218******************************************************************************/
@@ -67,8 +63,8 @@ extern "C"
6763 // Get our sparkfun toolkit bus object/interface
6864 sfeTkIBus *theBus = (sfeTkIBus *)handle;
6965
70- if (theBus->type () == kBusTypeI2C )
71- header = header << 1 ; // I2C specific shift
66+ if (theBus->type () == kBusTypeI2C ) // I2C specific shift
67+ header = header << 1 ;
7268
7369 sfeTkError_t rc = theBus->readRegister (header, payload, payload_length, nRead);
7470
@@ -113,21 +109,7 @@ extern "C"
113109 /* Custom function for consuming sensor readings */
114110 static void use_sensor_output (bmv080_output_t bmv080_output, void *callback_parameters)
115111 {
116- // data_ready_callback_count += 1;
117- // print_function_t print = (print_function_t)callback_parameters;
118-
119112 ((sfeBmv080 *)callback_parameters)->setSensorValue (bmv080_output);
120-
121- // Serial.println(bmv080_output.pm2_5);
122-
123- // Serial.println("u");
124-
125- // sfeBmv080::_sensorValue.pm2_5 = bmv080_output.pm2_5; // update the class variable with the new PM2.5 value
126- // setSensorValue(bmv080_output.pm2_5);
127- // sensorValue.pm2_5 = bmv080_output.pm2_5;
128- // print("Runtime: %.2f s, PM2.5: %.0f ug/m^3, obstructed: %s, outside detection limits: %s\r\n",
129- // bmv080_output.runtime_in_sec, bmv080_output.pm2_5, (bmv080_output.is_obstructed ? "yes" : "no"),
130- // (bmv080_output.is_outside_detection_limits ? "yes" : "no"));
131113 }
132114
133115 static void bmv080_service_routine (const bmv080_handle_t handle, void *callback_parameters)
@@ -237,11 +219,6 @@ bool sfeBmv080::open()
237219 // Open the device - pass in the data read, data write and delay functions callbacks. Note - the "secrom_handle_t"
238220 // is just a pointer to our Tookkit communication bus objects
239221
240- // When sending a sercom handle of SPI to bmv_open, the pointer must be a struct that includes both the SPI port (instance) and the Settings
241- // This is because the Bosch API needs to know the SPI port and the settings for the SPI port
242-
243-
244-
245222 bmv080_status_code_t status =
246223 bmv080_open (&bmv080_handle_class, (bmv080_sercom_handle_t )_theBus, (bmv080_callback_read_t )device_read_16bit_CB,
247224 (bmv080_callback_write_t )device_write_16bit_CB, (bmv080_callback_delay_t )device_delay_CB);
@@ -499,4 +476,4 @@ bool sfeBmv080::setDoVibrationFiltering(bool do_vibration_filtering)
499476 {
500477 return true ;
501478 }
502- }
479+ }
0 commit comments