Skip to content

Commit

Permalink
added priority on touch buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
gbr1 committed Mar 1, 2024
1 parent bdac052 commit afc8518
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 12 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Arduino_AlvikCarrier
version=0.3.0
version=0.3.4
author=Arduino, Giovanni di Dio Bruno, Lucio Rossi
maintainer=Arduino <[email protected]>
sentence=Library and firmware for Arduino Alvik Carrier board
Expand Down
54 changes: 46 additions & 8 deletions src/Arduino_AlvikCarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,55 @@ bool Arduino_AlvikCarrier::getTouchKey(const uint8_t key){
return false;
}

uint8_t Arduino_AlvikCarrier::getTouchKeys(){
uint8_t Arduino_AlvikCarrier::getTouchKeys(const bool single_touch){
touch_value=0;
if (getAnyTouchPressed()){
touch_value|=1;
touch_value|=getTouchOk()<<1;
touch_value|=getTouchDelete()<<2;
touch_value|=getTouchCenter()<<3;
touch_value|=getTouchUp()<<4;
touch_value|=getTouchLeft()<<5;
touch_value|=getTouchDown()<<6;
touch_value|=getTouchRight()<<7;
if (!single_touch){
touch_value|=getTouchOk()<<1;
touch_value|=getTouchDelete()<<2;
touch_value|=getTouchCenter()<<3;
touch_value|=getTouchUp()<<4;
touch_value|=getTouchLeft()<<5;
touch_value|=getTouchDown()<<6;
touch_value|=getTouchRight()<<7;
}
else{
if (getTouchOk()){
touch_value|=1<<1;
}else{
if (getTouchDelete()){
touch_value|=1<<2;
}
else{
if (getTouchCenter()){
touch_value|=1<<3;
}
else{
if (getTouchLeft()){
touch_value|=1<<5;
}
else{
if (getTouchDown()){
touch_value|=1<<6;
}
else{
if (getTouchRight()){
touch_value|=1<<7;
}
else{
if (getTouchUp()){
touch_value|=1<<4;
}
}
}

}
}
}
}
}

}
return touch_value;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Arduino_AlvikCarrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class Arduino_AlvikCarrier{
void updateTouch(); // update touch status
bool getAnyTouchPressed(); // get any touch pressed
bool getTouchKey(const uint8_t key); // return true if key touch is pressed
uint8_t getTouchKeys(); // return touched pads as byte
uint8_t getTouchKeys(const bool single_touch = true); // return touched pads as byte
bool getTouchUp(); // get nav pad up
bool getTouchRight(); // get nav pad right
bool getTouchDown(); // get nav pad down
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/robot_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ const float MOTION_FX_PERIOD = (1000U / MOTION_FX_FREQ);

// Library version
#define VERSION_BYTE_HIGH 0
#define VERSION_BYTE_MID 2
#define VERSION_BYTE_LOW 1
#define VERSION_BYTE_MID 3
#define VERSION_BYTE_LOW 4



Expand Down

0 comments on commit afc8518

Please sign in to comment.