Почему в Arduino IDE с библиотекой Usb Host Shield 2.0 при компиляции получаю ошибки?
Для прочтения данных от сканера штрих кода хочу использовать контроллер ESP32 - kit WEMOS D1 R3 - в паре USB Host shield 2.0. В Arduino IDE 2.2.1 подключил библиотеку USB Host Shield 2.0. В файле UsbCore.h указал пины SS и INT для платы. для проверки брал примеры из папки example указанной библиотеки. Результатом трансляции является вывод сообщений о множественных ошибках в файлах Usbhost.h и нескольких других. также сообщается что неправильно указан файл Usb.Init(). Прошу помощи в осознании допущенных ошибок.
Приведите ссылку на используемую библиотеку.
Приведите пример, компиляция которого вызывает ошибки.
Приведите лог компиляции с этими ошибками.
Тогда возможно кто-то сможет ответить на Ваш вопрос.
Здравствуйте. Библиотека Usb_Host_Shield_Libraty_2.0. Файл примера USBHID_desc.
Результат трансляции.
In file included from C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/Usb.h:43,
from C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhid.h:20,
from C:\Users\user\AppData\Local\Temp\.arduinoIDE-unsaved2023113-4420-ww7gcl.9t1uh\USBHID_desc\USBHID_desc.ino:1:
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:103:25: error: 'PSCK' was not declared in this scope
#define APPEND_PIN(pin) P ## pin // Appends the pin to 'P', e.g. 1 becomes P1
^
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:100:23: note: in expansion of macro 'APPEND_PIN'
#define PASTE(x, ...) x ## __VA_ARGS__
^
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:101:34: note: in expansion of macro 'PASTE'
#define EVALUATING_PASTE(x, ...) PASTE(x, __VA_ARGS__)
^~~~~
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:104:21: note: in expansion of macro 'EVALUATING_PASTE'
#define MAKE_PIN(x) EVALUATING_PASTE(APPEND_, PIN(UNPAREN(x)))
^~~~~~~~~~~~~~~~
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:105:14: note: in expansion of macro 'MAKE_PIN'
typedef SPi< MAKE_PIN(PIN_SPI_SCK), MAKE_PIN(PIN_SPI_MOSI), MAKE_PIN(PIN_SPI_MISO), MAKE_PIN(PIN_SPI_SS) > spi;
^~~~~~~~
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:103:25: note: suggested alternative: 'SCK'
#define APPEND_PIN(pin) P ## pin // Appends the pin to 'P', e.g. 1 becomes P1
^
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:100:23: note: in expansion of macro 'APPEND_PIN'
#define PASTE(x, ...) x ## __VA_ARGS__
^
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:101:34: note: in expansion of macro 'PASTE'
#define EVALUATING_PASTE(x, ...) PASTE(x, __VA_ARGS__)
^~~~~
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:104:21: note: in expansion of macro 'EVALUATING_PASTE'
#define MAKE_PIN(x) EVALUATING_PASTE(APPEND_, PIN(UNPAREN(x)))
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:104:21: note: in expansion of macro 'EVALUATING_PASTE'
#define MAKE_PIN(x) EVALUATING_PASTE(APPEND_, PIN(UNPAREN(x)))
^~~~~~~~~~~~~~~~
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:105:37: note: in expansion of macro 'MAKE_PIN'
typedef SPi< MAKE_PIN(PIN_SPI_SCK), MAKE_PIN(PIN_SPI_MOSI), MAKE_PIN(PIN_SPI_MISO), MAKE_PIN(PIN_SPI_SS) > spi;
^~~~~~~~
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:103:25: error: 'PMISO' was not declared in this scope
#define APPEND_PIN(pin) P ## pin // Appends the pin to 'P', e.g. 1 becomes P1
^
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:100:23: note: in expansion of macro 'APPEND_PIN'
#define PASTE(x, ...) x ## __VA_ARGS__
^
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:101:34: note: in expansion of macro 'PASTE'
#define EVALUATING_PASTE(x, ...) PASTE(x, __VA_ARGS__)
^~~~~
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:104:21: note: in expansion of macro 'EVALUATING_PASTE'
#define MAKE_PIN(x) EVALUATING_PASTE(APPEND_, PIN(UNPAREN(x)))
^~~~~~~~~~~~~~~~
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:105:61: note: in expansion of macro 'MAKE_PIN'
typedef SPi< MAKE_PIN(PIN_SPI_SCK), MAKE_PIN(PIN_SPI_MOSI), MAKE_PIN(PIN_SPI_MISO), MAKE_PIN(PIN_SPI_SS) > spi;
^~~~~~~~
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:103:25: note: suggested alternative: 'MISO'
#define APPEND_PIN(pin) P ## pin // Appends the pin to 'P', e.g. 1 becomes P1
^
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:100:23: note: in expansion of macro 'APPEND_PIN'
#define PASTE(x, ...) x ## __VA_ARGS__
^
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:101:34: note: in expansion of macro 'PASTE'
#define EVALUATING_PASTE(x, ...) PASTE(x, __VA_ARGS__)
^~~~~
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:10
^~~~~~~~
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:105:106: error: template argument 1 is invalid
typedef SPi< MAKE_PIN(PIN_SPI_SCK), MAKE_PIN(PIN_SPI_MOSI), MAKE_PIN(PIN_SPI_MISO), MAKE_PIN(PIN_SPI_SS) > spi;
^
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:105:106: error: template argument 2 is invalid
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:105:106: error: template argument 3 is invalid
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:105:106: error: template argument 4 is invalid
In file included from C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/Usb.h:43,
from C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhid.h:20,
from C:\Users\user\AppData\Local\Temp\.arduinoIDE-unsaved2023113-4420-ww7gcl.9t1uh\USBHID_desc\USBHID_desc.ino:1:
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h: In member function 'int8_t MAX3421e::Init()':
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:432:18: error: qualified-id in declaration before '(' token
spi::init();
^
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h: In member function 'int8_t MAX3421e::Init(int)':
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:469:18: error: qualified-id in declaration before '(' token
spi::init();
^
In file included from C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/Usb.h:44,
from C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhid.h:20,
from C:\Users\user\AppData\Local\Temp\.arduinoIDE-unsaved2023113-4420-ww7gcl.9t1uh\USBHID_desc\USBHID_desc.ino:1:
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/UsbCore.h: At global scope:
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/UsbCore.h:52:22: error: 'P13' was not declared in this scope
typedef MAX3421e MAX3421E; // ESP32 boards
^~~
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/UsbCore.h:52:22: note: suggested alternative: 'P17'
typedef MAX3421e MAX3421E; // ESP32 boards
^~~
P17
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/UsbCore.h:52:25: error: template argument 2 is invalid
typedef MAX3421e MAX3421E; // ESP32 boards
^
In file included from C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/Usb.h:44,
from C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhid.h:20,
from C:\Users\user\AppData\Local\Temp\.arduinoIDE-unsaved2023113-4420-ww7gcl.9t1uh\USBHID_desc\USBHID_desc.ino:1:
C:\Users\user\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/UsbCore.h:212:29: error: expected class-name before '{' token
class USB : public MAX3421E {
^
C:\Users\user\AppData\Local\Temp\.arduinoIDE-unsaved2023113-4420-ww7gcl.9t1uh\USBHID_desc\USBHID_desc.ino: In function 'void setup()':
C:\Users\user\AppData\Local\Temp\.arduinoIDE-unsaved2023113-4420-ww7gcl.9t1uh\USBHID_desc\USBHID_desc.ino:64:11: error: 'class USB' has no member named 'Init'; did you mean 'init'?
if (Usb.Init() == -1)
^~~~
init
exit status 1
Compilation error: 'class USB' has no member named 'Init'; did you mean 'init'?