adafruit / Adafruit_CircuitPython_HID

USB Human Interface Device drivers.
MIT License
365 stars 106 forks source link

Convert signed mouse values to 8-bit unsigned values for report #38

Closed dhalbert closed 5 years ago

dhalbert commented 5 years ago

Fixes #37. Now that we're doing bounds checking on stores in bytearrays, the values stored must be unsigned, so mask negative values to 8 bits unsigned.

caternuson commented 5 years ago

Tested and works.

Adafruit CircuitPython 4.0.1 on 2019-05-22; Adafruit ItsyBitsy M4 Express with samd51g19
>>> from adafruit_hid.mouse import Mouse
>>> mouse = Mouse()
>>> mouse.move(y=-10)
>>> mouse.move(y=-20)
>>> mouse.move(x=-100, y=-20)
>>>