Skip to content

Commit afc8518

Browse files
committed
added priority on touch buttons
1 parent bdac052 commit afc8518

File tree

4 files changed

+50
-12
lines changed

4 files changed

+50
-12
lines changed

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Arduino_AlvikCarrier
2-
version=0.3.0
2+
version=0.3.4
33
author=Arduino, Giovanni di Dio Bruno, Lucio Rossi
44
maintainer=Arduino <[email protected]>
55
sentence=Library and firmware for Arduino Alvik Carrier board

src/Arduino_AlvikCarrier.cpp

+46-8
Original file line numberDiff line numberDiff line change
@@ -434,17 +434,55 @@ bool Arduino_AlvikCarrier::getTouchKey(const uint8_t key){
434434
return false;
435435
}
436436

437-
uint8_t Arduino_AlvikCarrier::getTouchKeys(){
437+
uint8_t Arduino_AlvikCarrier::getTouchKeys(const bool single_touch){
438438
touch_value=0;
439439
if (getAnyTouchPressed()){
440440
touch_value|=1;
441-
touch_value|=getTouchOk()<<1;
442-
touch_value|=getTouchDelete()<<2;
443-
touch_value|=getTouchCenter()<<3;
444-
touch_value|=getTouchUp()<<4;
445-
touch_value|=getTouchLeft()<<5;
446-
touch_value|=getTouchDown()<<6;
447-
touch_value|=getTouchRight()<<7;
441+
if (!single_touch){
442+
touch_value|=getTouchOk()<<1;
443+
touch_value|=getTouchDelete()<<2;
444+
touch_value|=getTouchCenter()<<3;
445+
touch_value|=getTouchUp()<<4;
446+
touch_value|=getTouchLeft()<<5;
447+
touch_value|=getTouchDown()<<6;
448+
touch_value|=getTouchRight()<<7;
449+
}
450+
else{
451+
if (getTouchOk()){
452+
touch_value|=1<<1;
453+
}else{
454+
if (getTouchDelete()){
455+
touch_value|=1<<2;
456+
}
457+
else{
458+
if (getTouchCenter()){
459+
touch_value|=1<<3;
460+
}
461+
else{
462+
if (getTouchLeft()){
463+
touch_value|=1<<5;
464+
}
465+
else{
466+
if (getTouchDown()){
467+
touch_value|=1<<6;
468+
}
469+
else{
470+
if (getTouchRight()){
471+
touch_value|=1<<7;
472+
}
473+
else{
474+
if (getTouchUp()){
475+
touch_value|=1<<4;
476+
}
477+
}
478+
}
479+
480+
}
481+
}
482+
}
483+
}
484+
}
485+
448486
}
449487
return touch_value;
450488
}

src/Arduino_AlvikCarrier.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class Arduino_AlvikCarrier{
179179
void updateTouch(); // update touch status
180180
bool getAnyTouchPressed(); // get any touch pressed
181181
bool getTouchKey(const uint8_t key); // return true if key touch is pressed
182-
uint8_t getTouchKeys(); // return touched pads as byte
182+
uint8_t getTouchKeys(const bool single_touch = true); // return touched pads as byte
183183
bool getTouchUp(); // get nav pad up
184184
bool getTouchRight(); // get nav pad right
185185
bool getTouchDown(); // get nav pad down

src/definitions/robot_definitions.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ const float MOTION_FX_PERIOD = (1000U / MOTION_FX_FREQ);
8787

8888
// Library version
8989
#define VERSION_BYTE_HIGH 0
90-
#define VERSION_BYTE_MID 2
91-
#define VERSION_BYTE_LOW 1
90+
#define VERSION_BYTE_MID 3
91+
#define VERSION_BYTE_LOW 4
9292

9393

9494

0 commit comments

Comments
 (0)