This repository was archived by the owner on Aug 12, 2025. It is now read-only.
extEEPROM::read() fix error and make it debuggable#9
Open
dwrobel wants to merge 1 commit intoPaoloP74:masterfrom
Open
extEEPROM::read() fix error and make it debuggable#9dwrobel wants to merge 1 commit intoPaoloP74:masterfrom
dwrobel wants to merge 1 commit intoPaoloP74:masterfrom
Conversation
Fixes the follwing compilation errors on the STM32 platform:
extEEPROM/extEEPROM.cpp: In member function 'byte extEEPROM::read(long unsigned int, byte*, unsigned int)':
extEEPROM/extEEPROM.cpp:185:51: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [-Werror]
communication->requestFrom(ctrlByte, nRead);
^
In file included from extEEPROM/extEEPROM.h:62,
from extEEPROM/extEEPROM.cpp:58:
STM32/hardware/stm32/1.6.0-dev/libraries/Wire/src/Wire.h:98:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
uint8_t requestFrom(int, int);
^~~~~~~~~~~
STM32/hardware/stm32/1.6.0-dev/libraries/Wire/src/Wire.h:95:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
uint8_t requestFrom(uint8_t, uint8_t);
^~~~~~~~~~~
cc1plus: all warnings being treated as errors
Using library extEEPROM at version 3.4.1 in folder: extEEPROM
Using library Wire at version 1.0 in folder: .arduino15/packages/STM32/hardware/stm32/1.6.0-dev/libraries/Wire
exit status 1
make: *** [makefile.stm32:67: build] Error 1
Tested using: https://github.com/stm32duino/Arduino_Core_STM32
Also:
- Modernize the read() method to use 'const' where the variable
is not modified after assignment.
- Remove C-like casts and use C++ static_cast<>.
- Make the code debuggable, by moving 'return' statements to a
separate line, as on STM32 platform debugger is widely available.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the follwing compilation errors on the STM32 platform:
extEEPROM/extEEPROM.cpp: In member function 'byte extEEPROM::read(long unsigned int, byte*, unsigned int)':
extEEPROM/extEEPROM.cpp:185:51: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [-Werror]
communication->requestFrom(ctrlByte, nRead);
^
In file included from extEEPROM/extEEPROM.h:62,
from extEEPROM/extEEPROM.cpp:58:
STM32/hardware/stm32/1.6.0-dev/libraries/Wire/src/Wire.h:98:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
uint8_t requestFrom(int, int);
^~~~~~~~~~~
STM32/hardware/stm32/1.6.0-dev/libraries/Wire/src/Wire.h:95:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
uint8_t requestFrom(uint8_t, uint8_t);
^~~~~~~~~~~
cc1plus: all warnings being treated as errors
Using library extEEPROM at version 3.4.1 in folder: extEEPROM
Using library Wire at version 1.0 in folder: .arduino15/packages/STM32/hardware/stm32/1.6.0-dev/libraries/Wire
exit status 1
make: *** [makefile.stm32:67: build] Error 1
Tested using: https://github.com/stm32duino/Arduino_Core_STM32
Also:
is not modified after assignment.
separate line, as on STM32 platform debugger is widely available.