Results 2 comments of sakugava

while (((eir = readReg(EIR)). Is it correct?

Try this: https://github.com/TMRh20/arduino_uip The same library with some improvements