Skip to content
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

Compilation Error in writeLongBytes Function #31

Open
agalliani opened this issue Feb 27, 2024 · 0 comments
Open

Compilation Error in writeLongBytes Function #31

agalliani opened this issue Feb 27, 2024 · 0 comments

Comments

@agalliani
Copy link

Hello,
I encountered a compilation error while using the SparkFun_Bio_Sensor_Hub_Library with an Arduino Nano 33 Sense and a Nicla Sense Me board. The error is related to an ambiguous call to the write function in the Wire library. The issue occurs in the writeLongBytes function at lines 1416, 1417, 1418, and 1419 in the SparkFun_Bio_Sensor_Hub_Library.cpp file.

Error Message:

C:\Users\andre\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp: In member function 'uint8_t SparkFun_Bio_Sensor_Hub::writeLongBytes(uint8_t, uint8_t, uint8_t, int32_t*, size_t)':
C:\Users\andre\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:1416:61: error: call of overloaded 'write(int32_t)' is ambiguous
     _i2cPort->write(static_cast<int32_t>(_writeVal[i] >> 24));
                                                             ^
In file included from C:\Users\andre\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.h:4:0,
                 from C:\Users\andre\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:21:
C:\Users\andre\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nicla\4.1.1\libraries\Wire/Wire.h:59:20: note: candidate: virtual size_t arduino::MbedI2C::write(uint8_t)
     virtual size_t write(uint8_t data);
                    ^~~~~
C:\Users\andre\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nicla\4.1.1\libraries\Wire/Wire.h:60:20: note: candidate: virtual size_t arduino::MbedI2C::write(int)
     virtual size_t write(int data) {
                    ^~~~~
C:\Users\andre\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:1417:61: error: call of overloaded 'write(int32_t)' is ambiguous
     _i2cPort->write(static_cast<int32_t>(_writeVal[i] >> 16));
                                                             ^
In file included from C:\Users\andre\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.h:4:0,
                 from C:\Users\andre\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:21:
C:\Users\andre\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nicla\4.1.1\libraries\Wire/Wire.h:59:20: note: candidate: virtual size_t arduino::MbedI2C::write(uint8_t)
     virtual size_t write(uint8_t data);
                    ^~~~~
C:\Users\andre\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nicla\4.1.1\libraries\Wire/Wire.h:60:20: note: candidate: virtual size_t arduino::MbedI2C::write(int)
     virtual size_t write(int data) {
                    ^~~~~
C:\Users\andre\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:1418:60: error: call of overloaded 'write(int32_t)' is ambiguous
     _i2cPort->write(static_cast<int32_t>(_writeVal[i] >> 8));
                                                            ^
In file included from C:\Users\andre\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.h:4:0,
                 from C:\Users\andre\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:21:
C:\Users\andre\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nicla\4.1.1\libraries\Wire/Wire.h:59:20: note: candidate: virtual size_t arduino::MbedI2C::write(uint8_t)
     virtual size_t write(uint8_t data);
                    ^~~~~
C:\Users\andre\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nicla\4.1.1\libraries\Wire/Wire.h:60:20: note: candidate: virtual size_t arduino::MbedI2C::write(int)
     virtual size_t write(int data) {
                    ^~~~~
C:\Users\andre\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:1419:55: error: call of overloaded 'write(int32_t)' is ambiguous
     _i2cPort->write(static_cast<int32_t>(_writeVal[i]));
                                                       ^
In file included from C:\Users\andre\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.h:4:0,
                 from C:\Users\andre\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:21:
C:\Users\andre\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nicla\4.1.1\libraries\Wire/Wire.h:59:20: note: candidate: virtual size_t arduino::MbedI2C::write(uint8_t)
     virtual size_t write(uint8_t data);
                    ^~~~~
C:\Users\andre\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nicla\4.1.1\libraries\Wire/Wire.h:60:20: note: candidate: virtual size_t arduino::MbedI2C::write(int)
     virtual size_t write(int data) {
                    ^~~~~

exit status 1

Compilation error: exit status 1

Steps to Reproduce:

  1. Use an Arduino Nano 33 Sense or a Nicla Sense Me board.
  2. Include the SparkFun_Bio_Sensor_Hub_Library in the Arduino sketch.
  3. Attempt to compile the sketch.

Environment:

  • Arduino IDE version: [e.g., 2.3.1]
  • SparkFun_Bio_Sensor_Hub_Library version: [e.g., 1.1]
  • Arduino Nano 33 Sense or Nicla Sense Me board.

Additional Information:
I have tried updating both the SparkFun_Bio_Sensor_Hub_Library and Wire library to the latest versions, but the issue persists. Additionally, I modified the writeLongBytes function by explicitly casting the values to uint8_t to address the ambiguity, but I get 255 error. Obviously this is not solving the problem.

Related Files:

  • SparkFun_Bio_Sensor_Hub_Library.cpp
  • SparkFun_Bio_Sensor_Hub_Library.h

Any help or guidance on resolving this issue would be greatly appreciated. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant