Hi, I have a project which uses sparkfun usb host shield
I'm using the only available library for it, this one
I've tested my project on Arduino Uno R3 and it works fine, however if I try to recompile my project for arduino nano every I get this:
Arduino: 1.8.13 (Windows 10), Board: "Arduino Nano Every, ATMEGA328"
In file included from C:\Users\Izzy\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/Usb.h:34:0,
from C:\Users\Izzy\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhid.h:20,
from C:\Users\Izzy\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/hidboot.h:20,
from C:\Users\Izzy\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0\examples\HID\USBHIDBootKbd\USBHIDBootKbd.ino:1:
C:\Users\Izzy\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/avrpins.h:827:2: error: #error "Please define board in avrpins.h"
#error "Please define board in avrpins.h"
^~~~~
exit status 1
Error compiling for board Arduino Nano Every.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Now, I went to avrpins.h and tried to tweak it a liitle bit, adding this piece (after definition of classic arduino pins):
#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
// "Classic" Arduino pin numbers
#define P0 Pd0
#define P1 Pd1
#define P2 Pd2
#define P3 Pd3
#define P4 Pd4
#define P5 Pd5
#define P6 Pd6
#define P7 Pd7
#define P8 Pb0
#define P9 Pb1
#define P10 Pb2
#define P11 Pb3
#define P12 Pb4
#define P13 Pb5
#define P14 Pc0
#define P15 Pc1
#define P16 Pc2
#define P17 Pc3
#define P18 Pc4
#define P19 Pc5
#elif defined(__AVR_ATmega4809__)
// arduino nano every
#define P0 Pd0
#define P1 Pd1
#define P2 Pd2
#define P3 Pd3
#define P4 Pd4
#define P5 Pd5
#define P6 Pd6
#define P7 Pd7
#define P8 Pd8
#define P9 Pb0
#define P10 Pb1
#define P11 Pb2
#define P12 Pb3
#define P13 Pb4
#define P14 Pc0
#define P15 Pc1
#define P16 Pc2
#define P17 Pc3
#define P18 Pc4
#define P19 Pc5
#define P20 Pc6
#define P21 Pc7
Which is basically a copy of classic arduino pins with a little adjustments considering that ANE has one less pwm out and two more analog in's.
With this I get new error, which is:
C:\Users\Izzy\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/avrpins.h:94:49: error: no match for 'operator=' (operand types are 'PORT_t {aka PORT_struct}' and 'Porta::DataT {aka unsigned char}')
static void Write(DataT value){portName = value;}\
^
C:\Users\Izzy\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/avrpins.h:127:1: note: in expansion of macro 'MAKE_PORT'
MAKE_PORT(PORTA, DDRA, PINA, Porta, 'A')
^~~~~~~~~
I think it should be easy to solve since ANE is very similar with Arduino UNO, all standard libraries work no problem. Can someone help me with this? I already opened an issue on the github page of the library but the latest commit was more than a year ago, so I'm not hoping to get some help there.