Skip to content

add uint8_t casts #5

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 1 commit into from
Sep 24, 2021
Merged

add uint8_t casts #5

merged 1 commit into from
Sep 24, 2021

Conversation

bburdette
Copy link
Contributor

I was trying to use this lib with esp32, and got the following errors:

In file included from /home/bburdette/Arduino/libraries/SparkFun_SHTC3_Humidity_and_Temperature_Sensor_Library/src/SparkFun_SHTC3.h:11:0,
                 from /home/bburdette/Arduino/libraries/SparkFun_SHTC3_Humidity_and_Temperature_Sensor_Library/src/SparkFun_SHTC3.cpp:7:
/home/bburdette/.arduino15/packages/automato/hardware/esp32/0.0.1/libraries/Wire/src/Wire.h: In member function 'SHTC3_Status_TypeDef SHTC3::checkID()':
/home/bburdette/.arduino15/packages/automato/hardware/esp32/0.0.1/libraries/Wire/src/Wire.h:103:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
     uint8_t requestFrom(int address, int size);
             ^
/home/bburdette/.arduino15/packages/automato/hardware/esp32/0.0.1/libraries/Wire/src/Wire.h:101:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
     uint8_t requestFrom(uint8_t address, uint8_t size);
             ^
/home/bburdette/.arduino15/packages/automato/hardware/esp32/0.0.1/libraries/Wire/src/Wire.h:103:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
     uint8_t requestFrom(int address, int size);
             ^
/home/bburdette/.arduino15/packages/automato/hardware/esp32/0.0.1/libraries/Wire/src/Wire.h:99:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint16_t, uint8_t)
     uint8_t requestFrom(uint16_t address, uint8_t size);
             ^
/home/bburdette/.arduino15/packages/automato/hardware/esp32/0.0.1/libraries/Wire/src/Wire.h: In member function 'SHTC3_Status_TypeDef SHTC3::update()':
/home/bburdette/.arduino15/packages/automato/hardware/esp32/0.0.1/libraries/Wire/src/Wire.h:103:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
     uint8_t requestFrom(int address, int size);
             ^
/home/bburdette/.arduino15/packages/automato/hardware/esp32/0.0.1/libraries/Wire/src/Wire.h:101:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
     uint8_t requestFrom(uint8_t address, uint8_t size);
             ^
/home/bburdette/.arduino15/packages/automato/hardware/esp32/0.0.1/libraries/Wire/src/Wire.h:103:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
     uint8_t requestFrom(int address, int size);
             ^
/home/bburdette/.arduino15/packages/automato/hardware/esp32/0.0.1/libraries/Wire/src/Wire.h:99:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint16_t, uint8_t)
     uint8_t requestFrom(uint16_t address, uint8_t size);
             ^
Sketch uses 292998 bytes (22%) of program storage space. Maximum is 1310720 bytes.
Global variables use 14636 bytes (4%) of dynamic memory, leaving 313044 bytes for local variables. Maximum is 327680 bytes.

The problem is the compiler treats SHTC3_ADDR_7BIT as an int, but numBytesRequest is uint8_t. So it wants a version of requestFrom that takes (int, uint8_t) - but there isn't one of those in esp32. There isn't one in AVR either though I haven't tried compiling on that.

At any rate, seems the problem would be solved with a (uin8_t) cast, which I added. Works for me!

@nseidle
Copy link
Member

nseidle commented Sep 24, 2021

Thanks for the PR fellow Boulderite! Looks good. Merging.

@nseidle nseidle merged commit 8c6689f into sparkfun:master Sep 24, 2021
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

Successfully merging this pull request may close these issues.

2 participants