If this falls under a more fundamental topic regarding the way PlatformIO works, please feel free to just point me to some links, but I often struggle when trying to understand the way I should be including libraries in my projects. In the past I have tried to use the library manager, only to wrestle with compile errors. I often end up just copying files to the libs directory and editing include paths until I get it to work.
Today I decided it was time to see if someone would be kind enough to help me use the features of PlatformIO properly.
I have started a new project for a MoteinoM0 in an attempt to try out some TinyUSB examples. I use lib_deps to include the Adafruit Tiny USB Library, and when I try to build a bare bones project and I get a bunch of errors.
The first one for example:
C:\Users\email\.platformio\packages\framework-arduino-samd-moteino\libraries\USBHost\src/hidboot.h:576:89: error: 'USB_HOST_PTYPE_BULK' was not declared in this scope
This value is defined in the cores for the board:
C:\Users\[user]\.platformio\packages\framework-arduino-samd-moteino\cores\arduino\USB\samd21_host.h
What am I doing wrong? Does the compiler need me to point it to the core files somehow?
platformio.ini:
[env:moteino_zero]
platform = atmelsam
board = moteino_zero
framework = arduino
lib_archive = false
lib_deps =
adafruit/Adafruit TinyUSB Library@^2.2.7
build_flags =
-DUSE_TINYUSB
main.cpp
#include <Arduino.h>
#include <SPI.h>
#include "Adafruit_TinyUSB.h"
void setup() {
SPI.begin();
}
void loop() {
}
Build errors after a full clean:
Executing task: C:\Users\email\.platformio\penv\Scripts\platformio.exe run --environment moteino_zero
Processing moteino_zero (platform: atmelsam; board: moteino_zero; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Library Manager: Installing SdFat - Adafruit Fork
Unpacking [####################################] 100%
Library Manager: SdFat - Adafruit Fork@2.2.1 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelsam/moteino_zero.html
PLATFORM: Atmel SAM (8.2.0) > Moteino M0
HARDWARE: SAMD21G18A 48MHz, 32KB RAM, 256KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, cmsis-dap, jlink)
PACKAGES:
- framework-arduino-samd-moteino @ 1.6.3
- framework-cmsis @ 1.40500.0 (4.5.0)
- framework-cmsis-atmel @ 1.2.2
- toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 13 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Adafruit TinyUSB Library @ 2.2.7
|-- SPI @ 1.0
Building in release mode
Compiling .pio\build\moteino_zero\lib291\USBHost\KeyboardController.cpp.o
Compiling .pio\build\moteino_zero\lib291\USBHost\MouseController.cpp.o
Compiling .pio\build\moteino_zero\lib291\USBHost\Usb.cpp.o
Compiling .pio\build\moteino_zero\lib291\USBHost\adk.cpp.o
Compiling .pio\build\moteino_zero\lib291\USBHost\hid.cpp.o
Compiling .pio\build\moteino_zero\lib291\USBHost\hidboot.cpp.o
Compiling .pio\build\moteino_zero\lib291\USBHost\hidescriptorparser.cpp.o
Compiling .pio\build\moteino_zero\lib291\USBHost\hiduniversal.cpp.o
Compiling .pio\build\moteino_zero\lib291\USBHost\message.cpp.o
Compiling .pio\build\moteino_zero\lib291\USBHost\parsetools.cpp.o
Compiling .pio\build\moteino_zero\lib291\USBHost\usbhub.cpp.o
In file included from C:\Users\email\.platformio\packages\framework-arduino-samd-moteino\libraries\USBHost\src/KeyboardController.h:22:0,
from C:\Users\email\.platformio\packages\framework-arduino-samd-moteino\libraries\USBHost\src\KeyboardController.cpp:19:
C:\Users\email\.platformio\packages\framework-arduino-samd-moteino\libraries\USBHost\src/hidboot.h: In member function 'virtual uint32_t HIDBoot<BOOT_PROTOCOL>::Poll()':
C:\Users\email\.platformio\packages\framework-arduino-samd-moteino\libraries\USBHost\src/hidboot.h:576:89: error: 'USB_HOST_PTYPE_BULK' was not declared in this scope
UHD_Pipe_Alloc(bAddress, epInfo[epInterruptInIndex + i].epAddr, USB_HOST_PTYPE_BULK, USB_EP_DIR_IN, epInfo[epInterruptInIndex + i].maxPktSize, 0, USB_HOST_NB_BK_1);
^~~~~~~~~~~~~~~~~~~
C:\Users\email\.platformio\packages\framework-arduino-samd-moteino\libraries\USBHost\src/hidboot.h:576:89: note: suggested alternative: 'USB_HOST_PCFG_BK'
UHD_Pipe_Alloc(bAddress, epInfo[epInterruptInIndex + i].epAddr, USB_HOST_PTYPE_BULK, USB_EP_DIR_IN, epInfo[epInterruptInIndex + i].maxPktSize, 0, USB_HOST_NB_BK_1);
^~~~~~~~~~~~~~~~~~~
USB_HOST_PCFG_BK
C:\Users\email\.platformio\packages\framework-arduino-samd-moteino\libraries\USBHost\src/hidboot.h:576:110: error: 'USB_EP_DIR_IN' was not declared in this scope
UHD_Pipe_Alloc(bAddress, epInfo[epInterruptInIndex + i].epAddr, USB_HOST_PTYPE_BULK, USB_EP_DIR_IN, epInfo[epInterruptInIndex + i].maxPktSize, 0, USB_HOST_NB_BK_1);
I left the rest of the errors out because there were a lot… Thanks for reading.