How to use Arduino library while using Arduino as ESP-IDF component.

shio2004
Posts: 4
Joined: Thu Dec 19, 2019 9:55 am

How to use Arduino library while using Arduino as ESP-IDF component.

Postby shio2004 » Thu Dec 19, 2019 2:00 pm

Hello.
This is my first post and I am not good at speaking English.
Please excuse.

Well, I want to use Arduino library while using Arduino as ESP-IDF component.
I want to use Adafruit-Fingerprint-Sensor-Library(https://github.com/adafruit/Adafruit-Fi ... or-Library)

I added the file(Adafruit-Fingerprint-Sensor-Library) to C:\msys32\home\user-name\esp\hello_world\components\arduino\libraries
and I edited CMakeLists.txt(C:\msys32\home\user-name\esp\hello_world\components\arduino)

Code: Select all

set(LIBRARY_SRCS
  libraries/ArduinoOTA/src/ArduinoOTA.cpp

Code: Select all

set(LIBRARY_SRCS
  libraries/Adafruit-Fingerprint-Sensor-Library/Adafruit_Fingerprint.cpp
  libraries/ArduinoOTA/src/ArduinoOTA.cpp

Code: Select all

set(COMPONENT_ADD_INCLUDEDIRS
  variants/esp32/
  cores/esp32/
  libraries/ArduinoOTA/src

Code: Select all

set(COMPONENT_ADD_INCLUDEDIRS
  variants/esp32/
  cores/esp32/
  libraries/Adafruit-Fingerprint-Sensor-Library
  libraries/ArduinoOTA/src
Then I did "make flash" but it did not succeed.

Log :

Code: Select all

CXX build/arduino/libraries/Adafruit-Fingerprint-Sensor-Library//Adafruit_Fingerprint.o
C:/msys32/home/user-name/esp/hello_world/components/arduino/libraries/Adafruit-Fingerprint-Sensor-Library/Adafruit_Fingerprint.cpp: In member function 'uint8_t Adafruit_Fingerprint::setPassword(uint32_t)':
C:/msys32/home/user-name/esp/hello_world/components/arduino/libraries/Adafruit-Fingerprint-Sensor-Library/Adafruit_Fingerprint.cpp:265:54: error: narrowing conversion of '(password >> 24)' from 'uint32_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Werror=narrowing]
   SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password);
                                                      ^
C:/msys32/home/user-name/esp/hello_world/components/arduino/libraries/Adafruit-Fingerprint-Sensor-Library/Adafruit_Fingerprint.cpp:30:21: note: in definition of macro 'GET_CMD_PACKET'
   uint8_t data[] = {__VA_ARGS__}; \
                     ^
C:/msys32/home/user-name/esp/hello_world/components/arduino/libraries/Adafruit-Fingerprint-Sensor-Library/Adafruit_Fingerprint.cpp:265:3: note: in expansion of macro 'SEND_CMD_PACKET'
   SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password);
   ^
C:/msys32/home/user-name/esp/hello_world/components/arduino/libraries/Adafruit-Fingerprint-Sensor-Library/Adafruit_Fingerprint.cpp:265:72: error: narrowing conversion of '(password >> 16)' from 'uint32_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Werror=narrowing]
   SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password);
                                                                        ^
C:/msys32/home/user-name/esp/hello_world/components/arduino/libraries/Adafruit-Fingerprint-Sensor-Library/Adafruit_Fingerprint.cpp:30:21: note: in definition of macro 'GET_CMD_PACKET'
   uint8_t data[] = {__VA_ARGS__}; \
                     ^
C:/msys32/home/user-name/esp/hello_world/components/arduino/libraries/Adafruit-Fingerprint-Sensor-Library/Adafruit_Fingerprint.cpp:265:3: note: in expansion of macro 'SEND_CMD_PACKET'
   SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password);
   ^
C:/msys32/home/user-name/esp/hello_world/components/arduino/libraries/Adafruit-Fingerprint-Sensor-Library/Adafruit_Fingerprint.cpp:265:90: error: narrowing conversion of '(password >> 8)' from 'uint32_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Werror=narrowing]
   SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password);
                                                                                          ^
C:/msys32/home/user-name/esp/hello_world/components/arduino/libraries/Adafruit-Fingerprint-Sensor-Library/Adafruit_Fingerprint.cpp:30:21: note: in definition of macro 'GET_CMD_PACKET'
   uint8_t data[] = {__VA_ARGS__}; \
                     ^
C:/msys32/home/user-name/esp/hello_world/components/arduino/libraries/Adafruit-Fingerprint-Sensor-Library/Adafruit_Fingerprint.cpp:265:3: note: in expansion of macro 'SEND_CMD_PACKET'
   SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password);
   ^
C:/msys32/home/user-name/esp/hello_world/components/arduino/libraries/Adafruit-Fingerprint-Sensor-Library/Adafruit_Fingerprint.cpp:30:32: error: narrowing conversion of 'password' from 'uint32_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Werror=narrowing]
   uint8_t data[] = {__VA_ARGS__}; \
                                ^
C:/msys32/home/user-name/esp/hello_world/components/arduino/libraries/Adafruit-Fingerprint-Sensor-Library/Adafruit_Fingerprint.cpp:36:30: note: in expansion of macro 'GET_CMD_PACKET'
 #define SEND_CMD_PACKET(...) GET_CMD_PACKET(__VA_ARGS__); return packet.data[0];
                              ^
C:/msys32/home/user-name/esp/hello_world/components/arduino/libraries/Adafruit-Fingerprint-Sensor-Library/Adafruit_Fingerprint.cpp:265:3: note: in expansion of macro 'SEND_CMD_PACKET'
   SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password);
   ^
cc1plus.exe: some warnings being treated as errors
make[1]: *** [/home/user-name/esp/esp-idf/make/component_wrapper.mk:290: libraries/Adafruit-Fingerprint-Sensor-Library//Adafruit_Fingerprint.o] error 1
make: *** [C:/msys32/home/user-name/esp/esp-idf/make/project.mk:552: component-arduino-build] error 2
Thank you for taking the time to read my post.
Please help me.

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: How to use Arduino library while using Arduino as ESP-IDF component.

Postby chegewara » Fri Dec 20, 2019 1:01 pm

Hi,
did you read this post about using arduino as component?
https://github.com/espressif/arduino-es ... mponent.md

Also my suggestion is to use GNU make in this case, since arduino is still based on esp-idf v3.x.

shio2004
Posts: 4
Joined: Thu Dec 19, 2019 9:55 am

Re: How to use Arduino library while using Arduino as ESP-IDF component.

Postby shio2004 » Sat Dec 21, 2019 3:05 pm

Thank you for the reply, chegewara.

I read the post and downgraded esp-idf.
However it didn't go well.

I don't know about build system.
I don't know even whether GNU make or C make, too.

If you have time, please tell me more.

shio2004
Posts: 4
Joined: Thu Dec 19, 2019 9:55 am

Re: How to use Arduino library while using Arduino as ESP-IDF component.

Postby shio2004 » Wed Dec 25, 2019 1:55 pm

This problem was solved by using another library.

jimas13
Posts: 6
Joined: Tue Jan 19, 2021 8:36 am

Re: How to use Arduino library while using Arduino as ESP-IDF component.

Postby jimas13 » Sat Apr 10, 2021 11:05 pm

shio2004 wrote:
Wed Dec 25, 2019 1:55 pm
This problem was solved by using another library.
Which library did you use?
I am having the same problem and do not seem to find a workaround

ThymoNL
Posts: 1
Joined: Sun Apr 11, 2021 9:37 am

Re: How to use Arduino library while using Arduino as ESP-IDF component.

Postby ThymoNL » Sun Apr 11, 2021 9:47 am

Hi Jimas,

We've had good results by using this fork of Espressif's Arduino core: https://github.com/summivox/arduino-esp32
The instructions for using it as a component can be found here: https://github.com/summivox/arduino-esp ... mponent.md

Who is online

Users browsing this forum: No registered users and 97 guests