I'm trying to run a sample script written by Infineon to request pressure readings from their DPS368 pressure sensor over I2C.
Git Hub: https://github.com/Infineon/DPS368-Library-Arduino
The script will compile just fine for any Arduino AVR boards (Due, Uno, Mega), however when attempting to compile the sample script for a Teensy board using Arduino 1.8.19 and Teensy Duino 1.57, it throws errors for unused variables and call for overflow. Any thoughts from the community on how to best troubleshoot this? Thanks.
Example Script:
Errors:
Git Hub: https://github.com/Infineon/DPS368-Library-Arduino
The script will compile just fine for any Arduino AVR boards (Due, Uno, Mega), however when attempting to compile the sample script for a Teensy board using Arduino 1.8.19 and Teensy Duino 1.57, it throws errors for unused variables and call for overflow. Any thoughts from the community on how to best troubleshoot this? Thanks.
Example Script:
Code:
#include <Dps368.h>
// Dps368 Opject
Dps368 Dps368PressureSensor = Dps368();
void setup()
{
Serial.begin(9600);
while (!Serial);
//Call begin to initialize Dps368PressureSensor
//The parameter 0x76 is the bus address. The default address is 0x77 and does not need to be given.
//Dps368PressureSensor.begin(Wire, 0x76);
//Use the commented line below instead of the one above to use the default I2C address.
//if you are using the Pressure 3 click Board, you need 0x76
Dps368PressureSensor.begin(Wire);
Serial.println("Init complete!");
}
void loop()
{
float temperature;
float pressure;
uint8_t oversampling = 7;
int16_t ret;
Serial.println();
//lets the Dps368 perform a Single temperature measurement with the last (or standard) configuration
//The result will be written to the paramerter temperature
//ret = Dps368PressureSensor.measureTempOnce(temperature);
//the commented line below does exactly the same as the one above, but you can also config the precision
//oversampling can be a value from 0 to 7
//the Dps 368 will perform 2^oversampling internal temperature measurements and combine them to one result with higher precision
//measurements with higher precision take more time, consult datasheet for more information
ret = Dps368PressureSensor.measureTempOnce(temperature, oversampling);
if (ret != 0)
{
//Something went wrong.
//Look at the library code for more information about return codes
Serial.print("FAIL! ret = ");
Serial.println(ret);
}
else
{
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" degrees of Celsius");
}
//Pressure measurement behaves like temperature measurement
//ret = Dps368PressureSensor.measurePressureOnce(pressure);
ret = Dps368PressureSensor.measurePressureOnce(pressure, oversampling);
if (ret != 0)
{
//Something went wrong.
//Look at the library code for more information about return codes
Serial.print("FAIL! ret = ");
Serial.println(ret);
}
else
{
Serial.print("Pressure: ");
Serial.print(pressure);
Serial.println(" Pascal");
}
//Wait some time
delay(500);
}
Errors:
PHP:
C:\Users\testuser\Documents\Arduino\libraries\DPS368-Library-Arduino-dps368\src\DpsClass.cpp: In member function 'int16_t DpsClass::readByte(uint8_t)':
C:\Users\testuser\Documents\Arduino\libraries\DPS368-Library-Arduino-dps368\src\DpsClass.cpp:567:50: error: call of overloaded 'requestFrom(uint8_t&, unsigned int, unsigned int)' is ambiguous
if (m_i2cbus->requestFrom(m_slaveAddress, 1U, 1U) > 0)
^
In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire/Wire.h:26:0,
from C:\Users\testuser\Documents\Arduino\libraries\DPS368-Library-Arduino-dps368\src\DpsClass.h:20,
from C:\Users\testuser\Documents\Arduino\libraries\DPS368-Library-Arduino-dps368\src\DpsClass.cpp:1:
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire/WireIMXRT.h:91:10: note: candidate: uint8_t TwoWire::requestFrom(uint8_t, uint8_t, uint8_t)
uint8_t requestFrom(uint8_t address, uint8_t quantity, uint8_t sendStop);
^
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire/WireIMXRT.h:92:10: note: candidate: uint8_t TwoWire::requestFrom(uint8_t, uint8_t, bool)
uint8_t requestFrom(uint8_t address, uint8_t quantity, bool sendStop) {
^
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire/WireIMXRT.h:98:10: note: candidate: uint8_t TwoWire::requestFrom(int, int, int)
uint8_t requestFrom(int address, int quantity, int sendStop) {
^
C:\Users\testuser\Documents\Arduino\libraries\DPS368-Library-Arduino-dps368\src\DpsClass.cpp: In member function 'int16_t DpsClass::readBlock(RegBlock_t, uint8_t*)':
C:\Users\testuser\Documents\Arduino\libraries\DPS368-Library-Arduino-dps368\src\DpsClass.cpp:777:73: error: call of overloaded 'requestFrom(uint8_t&, uint8_t&, unsigned int)' is ambiguous
int16_t ret = m_i2cbus->requestFrom(m_slaveAddress, regBlock.length, 1U);
^
In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire/Wire.h:26:0,
from C:\Users\testuser\Documents\Arduino\libraries\DPS368-Library-Arduino-dps368\src\DpsClass.h:20,
from C:\Users\testuser\Documents\Arduino\libraries\DPS368-Library-Arduino-dps368\src\DpsClass.cpp:1:
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire/WireIMXRT.h:91:10: note: candidate: uint8_t TwoWire::requestFrom(uint8_t, uint8_t, uint8_t)
uint8_t requestFrom(uint8_t address, uint8_t quantity, uint8_t sendStop);
^
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire/WireIMXRT.h:92:10: note: candidate: uint8_t TwoWire::requestFrom(uint8_t, uint8_t, bool)
uint8_t requestFrom(uint8_t address, uint8_t quantity, bool sendStop) {
^
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire/WireIMXRT.h:98:10: note: candidate: uint8_t TwoWire::requestFrom(int, int, int)
uint8_t requestFrom(int address, int quantity, int sendStop) {
^
C:\Users\testuser\Documents\Arduino\libraries\DPS368-Library-Arduino-dps368\src\DpsClass.cpp: In member function 'virtual int16_t DpsClass::configTemp(uint8_t, uint8_t)':
C:\Users\testuser\Documents\Arduino\libraries\DPS368-Library-Arduino-dps368\src\DpsClass.cpp:505:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
C:\Users\testuser\Documents\Arduino\libraries\DPS368-Library-Arduino-dps368\src\DpsClass.cpp: In member function 'virtual int16_t DpsClass::configPressure(uint8_t, uint8_t)':
C:\Users\testuser\Documents\Arduino\libraries\DPS368-Library-Arduino-dps368\src\DpsClass.cpp:521:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
C:\Users\testuser\Documents\Arduino\libraries\DPS368-Library-Arduino-dps368\src\DpsClass.cpp: In member function 'int16_t DpsClass::readByte(uint8_t)':
C:\Users\testuser\Documents\Arduino\libraries\DPS368-Library-Arduino-dps368\src\DpsClass.cpp:575:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
Error compiling for board Teensy 4.1.