microsoft / pxt-chibitronics

Chibitronics Love To Code board editor with Microsoft MakeCode
https://makecode.chibitronics.com
Other
23 stars 15 forks source link

libs: core: input: invert pin-mapping logic #167

Closed xobs closed 6 years ago

xobs commented 6 years ago

Digital pins have several names. There's the silk-screened name (i.e. 0, 1, 2, ...), the Arduino Digital name (i.e. D0, D1, D2, ...), and the Arduino Analog name (i.e. A0, A1, A2, ...).

Inside input.cpp, we canonicalize the input pin to ensure it is accurate. However, the logic was inverted, and instead of masking off everything but the pin number, we were masking off the pin number and leaving everything else.

This caused the pin number to always be set to pin 0.

Invert this logic to leave only the lower three bits.

This closes issue #163.

Signed-off-by: Sean Cross sean@xobs.io

abchatra commented 6 years ago

Please merge the change so as to verify you have rights

samelhusseini commented 6 years ago

Woops. I merged it already..