Class Bertl added
Dependents: BertlDrive_V2 BertlDrive_V2
Diff: ur_Bertl.cpp
- Revision:
- 5:6b667e2cb800
- Parent:
- 4:76acfddc26fb
- Child:
- 6:df6830254e8b
diff -r 76acfddc26fb -r 6b667e2cb800 ur_Bertl.cpp --- a/ur_Bertl.cpp Tue Apr 07 12:30:39 2015 +0000 +++ b/ur_Bertl.cpp Fri Apr 10 07:12:07 2015 +0000 @@ -260,6 +260,28 @@ wait_ms(250); } +bool ur_Bertl::IsButtonPressed(const int btn) +{ + char cmd[3]; // array for I2C + int16_t btns; + bool wert; + + cmd[0] = 0x06; + cmd[1] = 0x00; + i2c.write(addr, cmd, 2); + + cmd[0]=0x01; + i2c.write(addr, cmd, 1); + i2c.read(addr|1, cmd, 1); + btns = cmd[0]; + if( btns & btn) + wert = true; + else + wert = false; + DEBUG_PRINT("WERT: %d", wert); + return wert; +} + // Protected methodes int ur_Bertl::bottomIsBlack() @@ -314,6 +336,8 @@ return wert; } + + //-----------------INTERNAL USE ONLY ---------------------------- void ur_Bertl::error() {