eclipse / upm

UPM is a high level repository that provides software drivers for a wide variety of commonly used sensors and actuators. These software drivers interact with the underlying hardware platform through calls to MRAA APIs.
MIT License
661 stars 410 forks source link

problem in button_context - gpio_pin defined as uint8_t in button.h #664

Closed BinduRao2018 closed 6 years ago

BinduRao2018 commented 6 years ago

I am using Grove PI board connected to UP-Squared board. To test Grove button, I used button APIs from button.h available on UPM (v1.6.0). The Grove button doesn't work. I see that in 'button_context', gpio_pin is declared as '_uint8t', which results in a problem when an offset of 512 is added along with the digital pin number to initialize gpio in button_init().

ie. For a Grove button connected to digital pin 7, mraa_gpio_init() call is made with the value set to 7 instead of 519 due to overflow.

Shouldn't this be declared as 'int'?

Propanu commented 6 years ago

Good catch, this was supposed to go in b367a63010ec4030e577213cc0a31396c419390f but it was missed.

Propanu commented 6 years ago

Fixed with 07a9af07fe3da98017456324b708f88af2f3c879. Thanks!