Hello,
I am getting a compiler error when I include a particular library and would appreciate ay help you may be able to offer. I am creating a program that will use P.I. Engineering Xkeys (HID USB Device) to control various pieces of equipment over a network. To get started I was adding all the libraries and doing what I could to make everything compatible but I am getting one error I do not understand. The library that causes the error is the XKeys library I got from here: GitHub - tstrausb/XKeys-Library-for-Arduino: A library to allow use of an X-Keys device on an Arduino microcontroller (used in conjunction with Circuits at Home USB Host Shield 2.0). I am trying to use and Arduino M0 pro.
This is the error:
In file included from /Users/Dan/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.1.0/CMSIS/Device/ATMEL/samd21/include/samd21.h:69:0,
from /Users/Dan/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.1.0/CMSIS/Device/ATMEL/samd.h:105,
from /Users/Dan/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.1.0/CMSIS/Device/ATMEL/sam.h:470,
from /Users/Dan/Library/Arduino15/packages/arduino/hardware/samd/1.6.17/cores/arduino/Arduino.h:48,
from /var/folders/fg/sn_rc8791wz_bf661wmhj4pw0000gn/T/arduino_build_584621/sketch/Holy_Macros.ino.cpp:1:
/Users/Dan/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.1.0/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h:516:38: error: expected ')' before '*' token
#define USB ((Usb *)0x41005000UL) /**< \brief (USB) APB Base Address */
^
/Users/Dan/Documents/Arduino/libraries/XKeys-Library-for-Arduino-master/hidxkeysrptparser.h:103:2: note: in expansion of macro 'USB'
USB Usb;
^
/Users/Dan/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.1.0/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h:516:38: error: expected ')' before '*' token
#define USB ((Usb *)0x41005000UL) /**< \brief (USB) APB Base Address */
^
/Users/Dan/Documents/Arduino/libraries/XKeys-Library-for-Arduino-master/hidxkeysrptparser.h:103:2: note: in expansion of macro 'USB'
USB Usb;
^
Multiple libraries were found for "hid.h"
Used: /Users/Dan/Library/Arduino15/packages/arduino/hardware/samd/1.6.17/libraries/USBHost
Not used: /Users/Dan/Documents/Arduino/libraries/USBHost
This is my code (just includes):
#include <hidxkeysrptparser.h>
#include "Usb.h" //USB Library for X-Keys
#include <MenuBackend.h> //To create Menu
#include <Encoder.h> //To read 2-bit quadrature encoder for Menu Navigation *Use pins with interrupts
#include <ClientBMDVideohubTCP.h> //BlackMagic Videohub Router Library
#include <ClientBMDHyperdeckStudio.h> //BlackMagic Hyperdeck Library
#include <ATEM.h> //BlackMagic ATEM Video Switcher Library
#include <Adafruit_GFX.h> //Adafruit Graphic OLED Support
#include <Adafruit_SSD1306.h> //Adafruit Graphic OLED Support
#include <Wire.h> //Wire for OLED display
#include <SPI.h> //SPI for Ethernet Shield
#include <EthernetUdp2.h> //Ethernet W5500
#include <EthernetClient.h> //Ethernet W5500
#include <Dhcp.h> //Ethernet W5500
#include <EthernetServer.h> //Ethernet W5500
#include <Ethernet2.h> //Ethernet W5500
#include <util.h> //Ethernet W5500
#include <Dns.h> //Ethernet W5500
#include <Twitter.h> //Ethernet W5500
void setup() {
}
void loop() {
// put your main code here, to run repeatedly:
}
This is the header file of the library causing the error:
// (C) 2014 Thomas Strausbaugh
// See the README for additional credit where credit is due!
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// of the License.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#if !defined(__HIDXKEYSRPTPARSER_H__)
#define __HIDXKEYSPARSER_H__
#if defined(ARDUINO) && ARDUINO >=100
#include "Arduino.h"
#else
#include <WProgram.h>
#endif
#include "hid.h"
#include "hiduniversal.h"
#include "Usb.h"
/****************************
Supported models are XK 4/8/16
stick and XK 24/60/80/128.
****************************/
#define RPT_XKEYS_LEN 18
#define OUT_RPT_LEN 35
#define BL_BLUE 0
#define BL_RED 1
#define MODE_OFF 0
#define MODE_ON 1
#define MODE_FLASH 2
#define LED_GREEN 6
#define LED_RED 7
class XkeysReportParser : public HIDReportParser
{
public:
uint8_t STICK;
uint8_t PADSIZE;
/**********If the public methods are called from within the class
(i.e. from the OnKey methods), you do not need to denote them with
<class_instance>.method. See example.***************************/
XkeysReportParser();
void init();
virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
void runLoop();
/**********BL stepping methods are only supported on XK128 or on "Plus" or "Mobile" versions of other pads.************/
void setBLSteps(uint8_t color, uint8_t *steps);
// use an array of 10 steps
// color: 0 for blue, 1 for red, 255 to reset all to factory default
// stepX: 0-255 for each
void stepBLIntensity(uint8_t color, uint8_t incDec, uint8_t wrap);
// color: 0 for blue, 1 for red; incDec: 0 for lower, 1 for higher; wrap: 0 to wrap around, 1 to stop at limit
/*****************************************************************************/
void indexSetLEDs(uint8_t led, uint8_t state);
void setFlashFreq(uint8_t freq);
// 0 is fastest, 255 is slowest (approx. 4 seconds)
void indexSetBL(uint8_t keyId, uint8_t color, uint8_t mode);
// Xkeys sticks only have blue backlights--color is disregarded in this case but you must enter something
void setRowBL(uint8_t row, uint8_t color, uint8_t mode);
// Xkeys sticks only have blue backlights--what you pass as color MUST evaluate to 0 and row must evaluate to 1
// rows are 1 - 8 from top to bottom (entering row 0 will cause an error)
void toggleBLs();
// any BLs that are on will go off. the same ones will come back on. Does not "reverse" the BLs.
void setLEDs(boolean green, boolean red);
// true for on and false for off
// must use indexSetLEDs for flash mode
void setBLintensity(uint8_t color, uint8_t intensity);
// 0 is off and 255 is brightest
void setUnitID(uint8_t unitID);
// 0 - 255
void saveBLStateEEPROM(uint8_t save);
// anything other than 0 will save the current BL state as new startup default
// ********limited number of times this can be done! Use sparingly!**********
void enableTimeStamp(uint8_t endis);
// 0 to disable, 1 to enable
void reboot();
// supported on "Plus" or "Mobile" versions
protected:
// Subclass XkeysReportParser and define these methods to receive events
virtual void OnKeyUp(uint8_t keyId) {};
virtual void OnKeyDown(uint8_t keyId) {};
private:
USB Usb;
HIDUniversal Hid;
void sendCommand();
void wipeArray();
uint8_t _blueIntensity;
uint8_t _redIntensity;
uint8_t _rowsBlue;
uint8_t _rowsRed;
uint8_t oldRpt[RPT_XKEYS_LEN];
uint32_t oldButtons[4];
uint8_t rpt[OUT_RPT_LEN];
};
#endif // __HIDXKEYSRPTPARSER_H__
Thanks for taking a look.