Lahksman Active Member Licensed User Longtime User Jun 1, 2016 #1 I'm trying to write my first wrapper but i'm not sure how to wrap the next part. It's an lcd shield with 4 buttons. B4X: /** * Read the state of the 4 buttons. * @return Bitmask with the 4 values: LSB - BUT1, MSB - BUT4 */ uint8_t LCD16x2::readButtons(){ uint8_t buttons; Wire.beginTransmission(ADDRESS); Wire.write(GET_BUT); Wire.endTransmission(); Wire.requestFrom((int)ADDRESS, 1); while(Wire.available() > 0) buttons = Wire.read(); return buttons; }
I'm trying to write my first wrapper but i'm not sure how to wrap the next part. It's an lcd shield with 4 buttons. B4X: /** * Read the state of the 4 buttons. * @return Bitmask with the 4 values: LSB - BUT1, MSB - BUT4 */ uint8_t LCD16x2::readButtons(){ uint8_t buttons; Wire.beginTransmission(ADDRESS); Wire.write(GET_BUT); Wire.endTransmission(); Wire.requestFrom((int)ADDRESS, 1); while(Wire.available() > 0) buttons = Wire.read(); return buttons; }
Erel B4X founder Staff member Licensed User Longtime User Jun 2, 2016 #2 It will be simpler to implement in B4R directly with the rWire library.
Lahksman Active Member Licensed User Longtime User Jun 2, 2016 #3 Thnx Erel, I'll have a look into that.