dmadison / ArduinoXInput

XInput library for USB capable Arduino boards
http://www.partsnotincluded.com/arduino-xinput-library/
MIT License
361 stars 61 forks source link

Flush receive buffer on construction #50

Closed dmadison closed 3 years ago

dmadison commented 3 years ago

On certain platforms this was causing a problem where the library was always one or two packets behind because USB packets were received and buffered by the hardware controller before the library object was constructed and could set its callback. Flushing the receive buffer when the object is constructed appears to solve this issue.