107-systems / 107-Arduino-TCS3472

Arduino library for the ams TCS34725 and TCS34727 Color Sensor
https://107-systems.org
MIT License
5 stars 0 forks source link

Arduino Wifi REV2 #12

Closed samuelkl closed 1 year ago

samuelkl commented 1 year ago

Would it be possible to make your library also work for the Arduino Wifi REV2?

aentinger commented 1 year ago

It should already work with Uno R4, even if architecture support is not explicitly listed. Can you try and report back?

samuelkl commented 1 year ago

I am actually not sure if the R4 and UNO WiFi REV2 have the same microcontroller which I think might be an issue. Anyways when, I try to compile the code for UNO WiFi REV2 I get this error:

In file included from c:\Users\Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/107-Arduino-TCS3472.h:15:0, from C:\Users\AppData\Local\Temp.arduinoIDE-unsaved2023427-35816-8iu080.enygj\TCS3472-Basic\TCS3472-Basic.ino:11: c:\Users\Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/TCS3472/TCS3472_Io.h:17:10: fatal error: functional: No such file or directory

include functional

      ^~~~~~~~~~~~

compilation terminated.

exit status 1

Compilation error: exit status 1

aentinger commented 1 year ago

WiFi Rev. 2 is a ATMEGA4809 ... which means avr-gcc. You need to add a Arduino_STL library if you want to use this library. R4 is a Renesas Cortex-M based board, STL comes with the platform support package.

samuelkl commented 1 year ago

With a Arduino_STL Library, then there are actually a series of other issues:

WARNING: library 107-Arduino-TCS3472 claims to run on samd, mbed, mbed_nano, mbed_portenta, mbed_edge, esp8266 architecture(s) and may be incompatible with your current board which runs on megaavr architecture(s). In file included from c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/TCS3472/TCS3472_Io.h:19:0, from c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/107-Arduino-TCS3472.h:15, from C:\Users \AppData\Local\Temp.arduinoIDE-unsaved2023430-32952-210ix2.aye5b\TCS3472-Basic\TCS3472-Basic.ino:11: c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/TCS3472/TCS3472_Const.h:74:69: error: 'underlying_type' in namespace 'std' does not name a template type constexpr auto to_integer(Enumeration const value) -> typename std::underlying_type::type ^~~~~~~ c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/TCS3472/TCS3472_Const.h:74:84: error: expected initializer before '<' token constexpr auto to_integer(Enumeration const value) -> typename std::underlying_type::type ^ c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/TCS3472/TCS3472_Const.h:80:61: error: 'underlying_type' in namespace 'std' does not name a template type constexpr auto bp(Enumeration const value) -> typename std::underlying_type::type ^~~~~~~ c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/TCS3472/TCS3472_Const.h:80:76: error: expected initializer before '<' token constexpr auto bp(Enumeration const value) -> typename std::underlying_type::type ^ c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/TCS3472/TCS3472_Const.h:86:61: error: 'underlying_type' in namespace 'std' does not name a template type constexpr auto bm(Enumeration const value) -> typename std::underlying_type::type ^~~~~~~ c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/TCS3472/TCS3472_Const.h:86:76: error: expected initializer before '<' token constexpr auto bm(Enumeration const value) -> typename std::underlying_type::type ^ In file included from c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/107-Arduino-TCS3472.h:15:0, from C:\Users \AppData\Local\Temp.arduinoIDE-unsaved2023430-32952-210ix2.aye5b\TCS3472-Basic\TCS3472-Basic.ino:11: c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/TCS3472/TCS3472_Io.h:32:14: error: 'function' in namespace 'std' does not name a template type typedef std::function<void(uint8_t const, uint8_t const, uint8_t const , uint8_t const)> I2cWriteFunc; ^~~~ c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/TCS3472/TCS3472_Io.h:33:14: error: 'function' in namespace 'std' does not name a template type typedef std::function<void(uint8_t const, uint8_t const, uint8_t , uint8_t const)> I2cReadFunc; ^~~~ c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/TCS3472/TCS3472_Io.h:43:27: error: expected ')' before 'write' TCS3472_Io(I2cWriteFunc write, I2cReadFunc read, uint8_t const i2c_slave_addr); ^~~~~ c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/TCS3472/TCS3472_Io.h:56:3: error: 'I2cWriteFunc' does not name a type I2cWriteFunc _write; ^~~~ c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/TCS3472/TCS3472_Io.h:57:3: error: 'I2cReadFunc' does not name a type I2cReadFunc _read; ^~~ In file included from C:\Users \AppData\Local\Temp.arduinoIDE-unsaved2023430-32952-210ix2.aye5b\TCS3472-Basic\TCS3472-Basic.ino:11:0: c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/107-Arduino-TCS3472.h:34:40: error: expected ')' before 'write' ArduinoTCS3472(TCS3472::I2cWriteFunc write, ^~~~~ C:\Users \AppData\Local\Temp.arduinoIDE-unsaved2023430-32952-210ix2.aye5b\TCS3472-Basic\TCS3472-Basic.ino:26:49: error: no matching function for call to 'ArduinoTCS3472::ArduinoTCS3472(void (&)(uint8_t, uint8_t, const uint8_t, uint8_t), void (&)(uint8_t, uint8_t, uint8_t, uint8_t), const uint8_t&)' TCS3472::DEFAULT_I2C_ADDR); ^ In file included from C:\Users \AppData\Local\Temp.arduinoIDE-unsaved2023430-32952-210ix2.aye5b\TCS3472-Basic\TCS3472-Basic.ino:11:0: c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/107-Arduino-TCS3472.h:21:7: note: candidate: constexpr ArduinoTCS3472::ArduinoTCS3472(const ArduinoTCS3472&) class ArduinoTCS3472 ^~~~~~ c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/107-Arduino-TCS3472.h:21:7: note: candidate expects 1 argument, 3 provided c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/107-Arduino-TCS3472.h:21:7: note: candidate: constexpr ArduinoTCS3472::ArduinoTCS3472(ArduinoTCS3472&&) c:\Users \Documents\Arduino\libraries\107-Arduino-TCS3472-main\src/107-Arduino-TCS3472.h:21:7: note: candidate expects 1 argument, 3 provided In file included from C:\Users \AppData\Local\Temp.arduinoIDE-unsaved2023430-32952-210ix2.aye5b\TCS3472-Basic\TCS3472-Basic.ino:9:0: C:\Users \AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\libraries\Wire\src/Wire.h: In function 'void i2c_generic_read(uint8_t, uint8_t, uint8_t*, uint8_t)': C:\Users \AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\libraries\Wire\src/Wire.h:63:12: note: candidate 1: size_t TwoWire::requestFrom(int, int) size_t requestFrom(int, int); ^~~ C:\Users \AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\libraries\Wire\src/Wire.h:61:12: note: candidate 2: virtual size_t TwoWire::requestFrom(uint8_t, size_t) size_t requestFrom(uint8_t, size_t); ^~~

exit status 1

Compilation error: no matching function for call to 'ArduinoTCS3472::ArduinoTCS3472(void (&)(uint8_t, uint8_t, const uint8_t, uint8_t), void (&)(uint8_t, uint8_t, uint8_t, uint8_t), const uint8_t&)'

aentinger commented 1 year ago

Well, you max fix at your convenience. I'm not going to add support for the Uno WiFi Rev 2, you should probably ask on the Arduino forum for further help. This is not an issue, as the software works for the advertised platforms :shrug: .

samuelkl commented 1 year ago

Alright, thanks for trying to help.