Fatal error: PluggableUSB.h: No such file or directory

Greetings,
I'm trying to install "JoystickTest" on a Seeedino Xiao, a 32U4 board. When it compiles I get the error message "fatal error: PluggableUSB.h: No such file or directory" See JoystickTest.ino below:

// Program used to test the USB Joystick object on the 
// Arduino Leonardo or Arduino Micro.
//
// Matthew Heironimus
// 2015-03-28 - Original Version
// 2015-11-18 - Updated to use the new Joystick library 
//              written for Arduino IDE Version 1.6.6 and
//              above.
// 2016-05-13   Updated to use new dynamic Joystick library
//              that can be customized.
// 2022-03-29   Updated to work with version 2.1.0 of the
//              Joystick library.
//------------------------------------------------------------

#include "Joystick.h"

// Create Joystick
Joystick_ Joystick;

// Set to true to test "Auto Send" mode or false to test "Manual Send" mode.
//const bool testAutoSendMode = true;
const bool testAutoSendMode = false;

const unsigned long gcCycleDelta = 1000;
const unsigned long gcAnalogDelta = 25;
const unsigned long gcButtonDelta = 500;
unsigned long gNextTime = 0;
unsigned int gCurrentStep = 0;

void testSingleButtonPush(unsigned int button)
{
  if (button > 0)
  {
    Joystick.releaseButton(button - 1);
  }
  if (button < 32)
  {
    Joystick.pressButton(button);
  }
}

void testMultiButtonPush(unsigned int currentStep) 
{
  for (int button = 0; button < 32; button++)
  {
    if ((currentStep == 0) || (currentStep == 2))
    {
      if ((button % 2) == 0)
      {
        Joystick.pressButton(button);
      } else if (currentStep != 2)
      {
        Joystick.releaseButton(button);
      }
    } // if ((currentStep == 0) || (currentStep == 2))
    if ((currentStep == 1) || (currentStep == 2))
    {
      if ((button % 2) != 0)
      {
        Joystick.pressButton(button);
      } else if (currentStep != 2)
      {
        Joystick.releaseButton(button);
      }
    } // if ((currentStep == 1) || (currentStep == 2))
    if (currentStep == 3)
    {
      Joystick.releaseButton(button);
    } // if (currentStep == 3)
  } // for (int button = 0; button < 32; button++)
}

void testXYAxis(unsigned int currentStep)
{
  int xAxis;
  int yAxis;
  
  if (currentStep < 256)
  {
    xAxis = currentStep - 127;
    yAxis = -127;
    Joystick.setXAxis(xAxis);
    Joystick.setYAxis(yAxis);
  } 
  else if (currentStep < 512)
  {
    yAxis = currentStep - 256 - 127;
    Joystick.setYAxis(yAxis);
  }
  else if (currentStep < 768)
  {
    xAxis = 128 - (currentStep - 512);
    Joystick.setXAxis(xAxis);
  }
  else if (currentStep < 1024)
  {
    yAxis = 128 - (currentStep - 768);
    Joystick.setYAxis(yAxis);
  }
  else if (currentStep < 1024 + 128)
  {
    xAxis = currentStep - 1024 - 127;
    Joystick.setXAxis(xAxis);
    Joystick.setYAxis(xAxis);
  }
}

void testZAxis(unsigned int currentStep)
{
  int z;

  if (currentStep < 128)
  {
    z = -currentStep;
  } 
  else if (currentStep < 256 + 128)
  {
    z = currentStep - 128 - 127;
  } 
  else if (currentStep < 256 + 128 + 127)
  {
    z = 127 - (currentStep - 383);
  } 
  
  Joystick.setZAxis(z);
}

void testHatSwitch(unsigned int currentStep)
{
  if (currentStep < 8)
  {
    Joystick.setHatSwitch(0, currentStep * 45);
  }
  else if (currentStep == 8)
  {
    Joystick.setHatSwitch(0, -1);
  }
  else if (currentStep < 17)
  {
    Joystick.setHatSwitch(1, (currentStep - 9) * 45);
  }
  else if (currentStep == 17)
  {
    Joystick.setHatSwitch(1, -1);
  }
  else if (currentStep == 18)
  {
    Joystick.setHatSwitch(0, 0);
    Joystick.setHatSwitch(1, 0);
  }
  else if (currentStep < 27)
  {
    Joystick.setHatSwitch(0, (currentStep - 18) * 45);
    Joystick.setHatSwitch(1, (8 - (currentStep - 18)) * 45);
  }
  else if (currentStep == 27)
  {
    Joystick.setHatSwitch(0, -1);
    Joystick.setHatSwitch(1, -1);
  }
}

void testThrottleRudder(unsigned int value)
{
  Joystick.setThrottle(value);
  Joystick.setRudder(value);
}

void testXYZAxisRotation(unsigned int degree)
{
  Joystick.setRxAxis(degree);
  Joystick.setRyAxis(degree);
  Joystick.setRzAxis(degree * 2);
}

void setup() {

  // Set Range Values
  Joystick.setXAxisRange(-127, 127);
  Joystick.setYAxisRange(-127, 127);
  Joystick.setZAxisRange(-127, 127);
  Joystick.setRxAxisRange(0, 360);
  Joystick.setRyAxisRange(360, 0);
  Joystick.setRzAxisRange(0, 720);
  Joystick.setThrottleRange(0, 255);
  Joystick.setRudderRange(255, 0);
  
  if (testAutoSendMode)
  {
    Joystick.begin();
  }
  else
  {
    Joystick.begin(false);
  }
  
  pinMode(A0, INPUT_PULLUP);
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {

  // System Disabled
  if (digitalRead(A0) != 0)
  {
    // Turn indicator light off.
    digitalWrite(LED_BUILTIN, 0);
    return;
  }

  // Turn indicator light on.
  digitalWrite(LED_BUILTIN, 1);
  
  if (millis() >= gNextTime)
  {
   
    if (gCurrentStep < 33)
    {
      gNextTime = millis() + gcButtonDelta;
      testSingleButtonPush(gCurrentStep);
    } 
    else if (gCurrentStep < 37)
    {
      gNextTime = millis() + gcButtonDelta;
      testMultiButtonPush(gCurrentStep - 33);
    }
    else if (gCurrentStep < (37 + 256))
    {
      gNextTime = millis() + gcAnalogDelta;
      testThrottleRudder(gCurrentStep - 37);
    }
    else if (gCurrentStep < (37 + 256 + 1024 + 128))
    {
      gNextTime = millis() + gcAnalogDelta;
      testXYAxis(gCurrentStep - (37 + 256));
    }
    else if (gCurrentStep < (37 + 256 + 1024 + 128 + 510))
    {
      gNextTime = millis() + gcAnalogDelta;
      testZAxis(gCurrentStep - (37 + 256 + 1024 + 128));
    }
    else if (gCurrentStep < (37 + 256 + 1024 + 128 + 510 + 28))
    {
      gNextTime = millis() + gcButtonDelta;
      testHatSwitch(gCurrentStep - (37 + 256 + 1024 + 128 + 510));
    }
    else if (gCurrentStep < (37 + 256 + 1024 + 128 + 510 + 28 + 360))
    {
      gNextTime = millis() + gcAnalogDelta;
      testXYZAxisRotation(gCurrentStep - (37 + 256 + 1024 + 128 + 510 + 28));
    }
    
    if (testAutoSendMode == false)
    {
      Joystick.sendState();
    }
    
    gCurrentStep++;
    if (gCurrentStep == (37 + 256 + 1024 + 128 + 510 + 28 + 360))
    {
      gNextTime = millis() + gcCycleDelta;
      gCurrentStep = 0;
    }
  }
}

When I install on an Adafruit FONA Feather, also a 32U4 board, it complies and upload with no issues.

I'm doing this on Kunubtu 22.10 with the latest updates as of this writing. Arduino IDE is version 2.1.0 Appimage.

"PlugableUSB" is part of the Arduino core as I understand it. Searched for "PluggableUSB.h" Found it located in the following locations:

~/.arduino15/packages/Seeeduino/hardware/samd/1.8.4/cores/arduino/USB/PluggableUSB.h
~/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/PluggableUSB.h
~/.arduino15/packages/adafruit/hardware/samd/1.7.11/cores/arduino/USB/PluggableUSB.h
~/.arduino15/packages/arduino/hardware/samd/1.8.13/cores/arduino/api/PluggableUSB.h
~/.arduino15/packages/arduino/hardware/mbed_rp2040/4.0.2/cores/arduino/api/PluggableUSB.h

It should be using the first entry.

The full compile results for the Xiao:

FQBN: Seeeduino:samd:seeed_XIAO_m0
Using board 'seeed_XIAO_m0' from platform in folder: ~/.arduino15/packages/Seeeduino/hardware/samd/1.8.4
Using core 'arduino' from platform in folder: ~/.arduino15/packages/Seeeduino/hardware/samd/1.8.4

loading library from ~/.arduino15/packages/Seeeduino/hardware/samd/1.8.4/libraries/Adafruit_TinyUSB_Arduino: invalid library: no header files found
loading library from ~/.arduino15/packages/Seeeduino/hardware/samd/1.8.4/libraries/Seeed_Arduino_FreeRTOS: invalid library: no header files found
loading library from ~/.arduino15/packages/Seeeduino/hardware/samd/1.8.4/libraries/Seeed_Arduino_LCD: invalid library: no header files found
Detecting libraries used...
~/.arduino15/packages/Seeeduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++14 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions "-D__SKETCH_NAME__=\"\"\"JoystickTest.ino\"\"\"" -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SEEED_XIAO_M0 -DARDUINO_ARCH_SAMD -DARDUINO_SAMD_ZERO -D__SAMD21__ -D__SAMD21G18A__ -DARM_MATH_CM0PLUS -DSEEED_XIAO_M0 -DUSB_VID=0x2886 -DUSB_PID=0x802F -DUSBCON -DUSB_CONFIG_POWER=100 "-DUSB_MANUFACTURER=\"Seeed\"" "-DUSB_PRODUCT=\"Seeed XIAO M0\"" -I~/.arduino15/packages/Seeeduino/hardware/samd/1.8.4/libraries/Adafruit_TinyUSB_Arduino/src/arduino -DARDUINO_SAMD_ZERO -D__SAMD21__ -D__SAMD21G18A__ -DARM_MATH_CM0PLUS -DSEEED_XIAO_M0 -DUSB_VID=0x2886 -DUSB_PID=0x802F -DUSBCON -DUSB_CONFIG_POWER=100 "-DUSB_MANUFACTURER=\"Seeed\"" "-DUSB_PRODUCT=\"Seeed XIAO M0\"" -I~/.arduino15/packages/Seeeduino/hardware/samd/1.8.4/libraries/Adafruit_TinyUSB_Arduino/src/arduino -I~/.arduino15/packages/Seeeduino/tools/CMSIS/5.7.0/CMSIS/Core/Include/ -I~/.arduino15/packages/Seeeduino/tools/CMSIS/5.7.0/CMSIS/DSP/Include/ -I~/.arduino15/packages/Seeeduino/tools/CMSIS-Atmel/1.2.1/CMSIS-Atmel/CMSIS/Device/ATMEL/ -I~/.arduino15/packages/Seeeduino/hardware/samd/1.8.4/cores/arduino -I~/.arduino15/packages/Seeeduino/hardware/samd/1.8.4/variants/XIAO_m0 /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/sketch/JoystickTest.ino.cpp -o /dev/null
Alternatives for Joystick.h: [Joystick@2.1.1]
ResolveLibrary(Joystick.h)
  -> candidates: [Joystick@2.1.1]
~/.arduino15/packages/Seeeduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++14 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions "-D__SKETCH_NAME__=\"\"\"JoystickTest.ino\"\"\"" -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SEEED_XIAO_M0 -DARDUINO_ARCH_SAMD -DARDUINO_SAMD_ZERO -D__SAMD21__ -D__SAMD21G18A__ -DARM_MATH_CM0PLUS -DSEEED_XIAO_M0 -DUSB_VID=0x2886 -DUSB_PID=0x802F -DUSBCON -DUSB_CONFIG_POWER=100 "-DUSB_MANUFACTURER=\"Seeed\"" "-DUSB_PRODUCT=\"Seeed XIAO M0\"" -I~/.arduino15/packages/Seeeduino/hardware/samd/1.8.4/libraries/Adafruit_TinyUSB_Arduino/src/arduino -DARDUINO_SAMD_ZERO -D__SAMD21__ -D__SAMD21G18A__ -DARM_MATH_CM0PLUS -DSEEED_XIAO_M0 -DUSB_VID=0x2886 -DUSB_PID=0x802F -DUSBCON -DUSB_CONFIG_POWER=100 "-DUSB_MANUFACTURER=\"Seeed\"" "-DUSB_PRODUCT=\"Seeed XIAO M0\"" -I~/.arduino15/packages/Seeeduino/hardware/samd/1.8.4/libraries/Adafruit_TinyUSB_Arduino/src/arduino -I~/.arduino15/packages/Seeeduino/tools/CMSIS/5.7.0/CMSIS/Core/Include/ -I~/.arduino15/packages/Seeeduino/tools/CMSIS/5.7.0/CMSIS/DSP/Include/ -I~/.arduino15/packages/Seeeduino/tools/CMSIS-Atmel/1.2.1/CMSIS-Atmel/CMSIS/Device/ATMEL/ -I~/.arduino15/packages/Seeeduino/hardware/samd/1.8.4/cores/arduino -I~/.arduino15/packages/Seeeduino/hardware/samd/1.8.4/variants/XIAO_m0 -I~/Arduino/libraries/Joystick2/src /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/sketch/JoystickTest.ino.cpp -o /dev/null
In file included from ~/Arduino/libraries/Joystick2/src/Joystick.h:24:0,
                 from /tmp/.arduinoIDE-unsaved2023428-24193-4fnhrp.hqowt/JoystickTest/JoystickTest.ino:15:
~/Arduino/libraries/Joystick2/src/DynamicHID/DynamicHID.h:37:12: fatal error: PluggableUSB.h: No such file or directory
   #include "PluggableUSB.h"
            ^~~~~~~~~~~~~~~~
compilation terminated.

Alternatives for PluggableUSB.h: []
ResolveLibrary(PluggableUSB.h)
  -> candidates: []
Using library Joystick at version 2.1.1 in folder: ~/Arduino/libraries/Joystick2 
exit status 1

Compilation error: exit status 1

The full compile results for the Feather:

FQBN: adafruit:avr:feather32u4
Using board 'feather32u4' from platform in folder: ~/.arduino15/packages/adafruit/hardware/avr/1.4.15
Using core 'arduino' from platform in folder: ~/.arduino15/packages/arduino/hardware/avr/1.8.6

Detecting libraries used...
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_AVR_FEATHER32U4 -DARDUINO_ARCH_AVR -DUSB_VID=0x239A -DUSB_PID=0x800C "-DUSB_MANUFACTURER=\"Adafruit\"" "-DUSB_PRODUCT=\"Feather 32u4\"" -I~/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I~/.arduino15/packages/adafruit/hardware/avr/1.4.15/variants/feather32u4 /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/sketch/JoystickTest.ino.cpp -o /dev/null
Alternatives for Joystick.h: [Joystick@2.1.1]
ResolveLibrary(Joystick.h)
  -> candidates: [Joystick@2.1.1]
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_AVR_FEATHER32U4 -DARDUINO_ARCH_AVR -DUSB_VID=0x239A -DUSB_PID=0x800C "-DUSB_MANUFACTURER=\"Adafruit\"" "-DUSB_PRODUCT=\"Feather 32u4\"" -I~/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I~/.arduino15/packages/adafruit/hardware/avr/1.4.15/variants/feather32u4 -I~/Arduino/libraries/Joystick2/src /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/sketch/JoystickTest.ino.cpp -o /dev/null
Using cached library dependencies for file: ~/Arduino/libraries/Joystick2/src/DynamicHID/DynamicHID.cpp
Using cached library dependencies for file: ~/Arduino/libraries/Joystick2/src/Joystick.cpp
Generating function prototypes...
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_AVR_FEATHER32U4 -DARDUINO_ARCH_AVR -DUSB_VID=0x239A -DUSB_PID=0x800C "-DUSB_MANUFACTURER=\"Adafruit\"" "-DUSB_PRODUCT=\"Feather 32u4\"" -I~/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I~/.arduino15/packages/adafruit/hardware/avr/1.4.15/variants/feather32u4 -I~/Arduino/libraries/Joystick2/src /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/sketch/JoystickTest.ino.cpp -o /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/preproc/ctags_target_for_gcc_minus_e.cpp
~/.arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/preproc/ctags_target_for_gcc_minus_e.cpp
Compiling sketch...
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega32u4 -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_AVR_FEATHER32U4 -DARDUINO_ARCH_AVR -DUSB_VID=0x239A -DUSB_PID=0x800C "-DUSB_MANUFACTURER=\"Adafruit\"" "-DUSB_PRODUCT=\"Feather 32u4\"" -I~/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I~/.arduino15/packages/adafruit/hardware/avr/1.4.15/variants/feather32u4 -I~/Arduino/libraries/Joystick2/src /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/sketch/JoystickTest.ino.cpp -o /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/sketch/JoystickTest.ino.cpp.o
Compiling libraries...
Compiling library "Joystick"
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega32u4 -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_AVR_FEATHER32U4 -DARDUINO_ARCH_AVR -DUSB_VID=0x239A -DUSB_PID=0x800C "-DUSB_MANUFACTURER=\"Adafruit\"" "-DUSB_PRODUCT=\"Feather 32u4\"" -I~/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I~/.arduino15/packages/adafruit/hardware/avr/1.4.15/variants/feather32u4 -I~/Arduino/libraries/Joystick2/src ~/Arduino/libraries/Joystick2/src/Joystick.cpp -o /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/libraries/Joystick2/Joystick.cpp.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega32u4 -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_AVR_FEATHER32U4 -DARDUINO_ARCH_AVR -DUSB_VID=0x239A -DUSB_PID=0x800C "-DUSB_MANUFACTURER=\"Adafruit\"" "-DUSB_PRODUCT=\"Feather 32u4\"" -I~/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I~/.arduino15/packages/adafruit/hardware/avr/1.4.15/variants/feather32u4 -I~/Arduino/libraries/Joystick2/src ~/Arduino/libraries/Joystick2/src/DynamicHID/DynamicHID.cpp -o /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/libraries/Joystick2/DynamicHID/DynamicHID.cpp.o
Compiling core...
Using precompiled core: /tmp/arduino/cores/adafruit_avr_feather32u4_8eeaa37527416ee2d1a9c4d41640ce27/core.a
Linking everything together...
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega32u4 -o /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/JoystickTest.ino.elf /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/sketch/JoystickTest.ino.cpp.o /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/libraries/Joystick2/DynamicHID/DynamicHID.cpp.o /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/libraries/Joystick2/Joystick.cpp.o /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/../../cores/adafruit_avr_feather32u4_8eeaa37527416ee2d1a9c4d41640ce27/core.a -L/tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF -lm
~/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/USBCore.cpp: In function 'USB_Recv.constprop':
~/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/USBCore.cpp:255:9: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized]
  return c;
         ^
~/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/USBCore.cpp:252:5: note: 'c' was declared here
  u8 c;
     ^
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/JoystickTest.ino.elf /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/JoystickTest.ino.eep
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -R .eeprom /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/JoystickTest.ino.elf /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/JoystickTest.ino.hex

Using library Joystick at version 2.1.1 in folder: ~/Arduino/libraries/Joystick2 
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-size -A /tmp/arduino/sketches/B276041422C7C70A81C7378E16FFBFCF/JoystickTest.ino.elf
Sketch uses 10054 bytes (35%) of program storage space. Maximum is 28672 bytes.
Global variables use 348 bytes of dynamic memory.

I believe it is a matter of telling the compiler where to find "PluggableUSB.h" for the Xiao. How do I do this? If it is something else please let me know.

Thanks!
Randy

I can't help you but a Xiao is not a 32U4 based board.

You sir are correct. It is a SAMD21 board.

Does the Seeduino have native USB?
Note that it say for Arduino Leonardo or micro.
Try installing the library.

Hi Randy, I did edit your post to make it more readible. I hope I did not bugger it up. Please don't use indentations if not necessary, due to the indentations your text was placed in code tags.

The problem is in the library. It does not support the M0 (SAMD21) core.

#ifdef _VARIANT_ARDUINO_DUE_X_
  // The following values are the same as AVR's USBAPI.h
  // Reproduced here because SAM doesn't have these in
  // its own USBAPI.H
  #define USB_EP_SIZE 64
  #define TRANSFER_PGM 0x80

  #include "USB/PluggableUSB.h"
#else
  #include "PluggableUSB.h"
#endif

Because it's not a Due that you use, the "else" is used, it uses "PluggableUSB.h" instead of "USB/PluggableYSB.h". I've compiled your code for your board and for the ArduinoZero and experience the problem in both.

I do not have M0 boards to test but maybe the above puts you on the right track. You might have to repeat for other errors.

Thanks for the feedback.
According to Seeed it needs Adafruit's TinyUSB library. I know enough programming to get by, but not enough to merge a new library into the supporting library.

Will keep trying.
Randy

Greetings all,
Found a solution. The original library I was using was ArduinoJoystickLibrary by MHeironimus. Last updated on July 9, 2022. See link below:

Arduino Joystick Library

Digging around in the issues and pull request I found request for support the Seeeduino XIAO. It was flagged as "Enhancement". My lack of understanding how Github works I incorrectly assumed that meant it was incorporated into the latest release.

In the pull requests I found a link to "gdsports/ArduinoJoystickLibrary" from 2018. He had fixed the issue for other SAMD21 boards. See link below:

gdsports/ArduinoJoystickLibrary

I could not add gdsports library to the Arduino library by adding as a .zip file. Received "Error: 13 INTERNAL: Library install failed: moving extracted archive to destination dir: library not valid".

Extracted the the zip contents and copied the "src" directory to MHeironimus' already installed library replacing the existing "src" directory. Files update by doing this were "joystick.h", "joystick.cpp", "DynamicHID.h" and "DynamicHID.cpp".

Everything compiles and uploads to the XIAO with no issues. Appears to be running correctly. Need to reassign some pins though.

Hope this helps anyone else with a similar problem.
Randy

1 Like

Great :+1:

You can mark the topic as solved by clucking the "solution" button under the most useful reply; yours in this case.

That will let others lnow that a solution was provided.

1 Like

Sterretje,
Thanks for the guidance!

Greatly appreciated.
Randy

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.