diff --git a/library.properties b/library.properties index 190223d..95ffe2b 100644 --- a/library.properties +++ b/library.properties @@ -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 sentence=Library and firmware for Arduino Alvik Carrier board diff --git a/src/Arduino_AlvikCarrier.cpp b/src/Arduino_AlvikCarrier.cpp index dd14872..a29c924 100644 --- a/src/Arduino_AlvikCarrier.cpp +++ b/src/Arduino_AlvikCarrier.cpp @@ -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; } diff --git a/src/Arduino_AlvikCarrier.h b/src/Arduino_AlvikCarrier.h index a37b0ff..3da1dbf 100644 --- a/src/Arduino_AlvikCarrier.h +++ b/src/Arduino_AlvikCarrier.h @@ -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 diff --git a/src/definitions/robot_definitions.h b/src/definitions/robot_definitions.h index 291706a..129ba41 100644 --- a/src/definitions/robot_definitions.h +++ b/src/definitions/robot_definitions.h @@ -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