From 158e0bd7771b6eb5460c7d5fb88579f29e3f9dd9 Mon Sep 17 00:00:00 2001 From: OmegaRogue Date: Sun, 17 Mar 2019 20:27:33 +0100 Subject: [PATCH 01/11] Implemented optional on screen usage of Surface Dial, reworked some other stuff --- src/HID-APIs/SurfaceDialAPI.h | 18 ++++++-- src/HID-APIs/SurfaceDialAPI.hpp | 77 +++++++++++++++++++++++++++++---- src/MultiReport/SurfaceDial.cpp | 38 ++++++++-------- 3 files changed, 102 insertions(+), 31 deletions(-) diff --git a/src/HID-APIs/SurfaceDialAPI.h b/src/HID-APIs/SurfaceDialAPI.h index f318567d..e0b854f5 100644 --- a/src/HID-APIs/SurfaceDialAPI.h +++ b/src/HID-APIs/SurfaceDialAPI.h @@ -35,9 +35,9 @@ typedef union{ struct{ uint16_t button: 1; uint16_t rotation: 15; - //int8_t xAxis; - //int8_t yAxis; - + int8_t xAxis: 8; + int8_t yAxis: 8; + }; } HID_SurfaceDialReport_Data_t; @@ -49,17 +49,29 @@ class SurfaceDialAPI inline void end(void); inline void click(void); inline void rotate(int16_t rotation); + inline void position(int8_t x, int8_t y); + inline void posrot(int16_t rotation, int8_t x, int8_t y); inline void press(void); inline void release(void); inline void releaseAll(void); inline bool isPressed(); + inline int8_t getX(); + inline int8_t getY(); + inline bool getOnScreen(); + inline void update(); // Sending is public in the base class for advanced users. virtual void SendReport(void* data, int length) = 0; protected: bool _button; + bool _onScreen; + int8_t _xAxis; + int8_t _yAxis; inline void button(bool b); + inline void xAxis(int8_t x); + inline void yAxis(int8_t y); + inline void onScreen(bool s); }; // Implementation is inline diff --git a/src/HID-APIs/SurfaceDialAPI.hpp b/src/HID-APIs/SurfaceDialAPI.hpp index c09b5d29..9e6ec5b7 100644 --- a/src/HID-APIs/SurfaceDialAPI.hpp +++ b/src/HID-APIs/SurfaceDialAPI.hpp @@ -37,25 +37,39 @@ void SurfaceDialAPI::begin(void) void SurfaceDialAPI::end(void) { _button = false; - rotate(0); + update(); } void SurfaceDialAPI::click(void) { _button = true; - rotate(0); + update(); _button = false; - rotate(0); + update(); } void SurfaceDialAPI::rotate(int16_t rotation) +{ + posrot(rotation, _xAxis, _yAxis); +} + +void SurfaceDialAPI::position(int8_t x, int8_t y) +{ + posrot(0, x, y); +} + +void SurfaceDialAPI::posrot(int16_t rotation, int8_t x, int8_t y) { HID_SurfaceDialReport_Data_t report; + _xAxis = x; + _yAxis = y; report.button = _button; report.rotation = rotation; - //report.xAxis = x; - //report.yAxis = y; - + if(_onScreen) + { + report.xAxis = _xAxis; + report.yAxis = _yAxis; + } SendReport(&report, sizeof(report)); } @@ -64,10 +78,21 @@ void SurfaceDialAPI::button(bool b) if (b != _button) { _button = b; - rotate(0); + update(); } } +void SurfaceDialAPI::xAxis(int8_t x) +{ + _xAxis = x; + posrot(0, _xAxis, _yAxis); +} +void SurfaceDialAPI::yAxis(int8_t y) +{ + _yAxis = y; + posrot(0, _xAxis, _yAxis); +} + void SurfaceDialAPI::press(void) { button(true); @@ -81,10 +106,44 @@ void SurfaceDialAPI::release(void) void SurfaceDialAPI::releaseAll(void) { _button = false; - rotate(0); + update(); +} + +void SurfaceDialAPI::onScreen(bool s) +{ + _onScreen = s; + update(); +} + +void SurfaceDialAPI::update() +{ + HID_SurfaceDialReport_Data_t report; + report.button = _button; + report.rotation = 0; + if(_onScreen) + { + report.xAxis = _xAxis; + report.yAxis = _yAxis; + } + SendReport(&report, sizeof(report)); } bool SurfaceDialAPI::isPressed() { - return _button; + return _button; +} + +bool SurfaceDialAPI::getOnScreen() +{ + return _onScreen; +} + +int8_t SurfaceDialAPI::getX() +{ + return _xAxis; +} + +int8_t SurfaceDialAPI::getY() +{ + return _yAxis; } diff --git a/src/MultiReport/SurfaceDial.cpp b/src/MultiReport/SurfaceDial.cpp index fb405206..57a140bb 100644 --- a/src/MultiReport/SurfaceDial.cpp +++ b/src/MultiReport/SurfaceDial.cpp @@ -50,25 +50,25 @@ static const uint8_t _hidMultiReportDescriptorSurfaceDial[] PROGMEM = { 0x16, 0xf0, 0xf1, // LOGICAL_MINIMUM (-3600) 0x26, 0x10, 0x0e, // LOGICAL_MAXIMUM (3600) 0x81, 0x06, // INPUT (Data,Var,Rel) - // 0x09, 0x30, // USAGE (X) - // 0x75, 0x10, // REPORT_SIZE (16) - // 0x55, 0x0d, // UNIT_EXPONENT (-3) - // 0x65, 0x13, // UNIT (Inch,EngLinear) - // 0x35, 0x00, // PHYSICAL_MINIMUM (0) - // 0x46, 0xc0, 0x5d, // PHYSICAL_MAXIMUM (24000) - // 0x15, 0x00, // LOGICAL_MINIMUM (0) - // 0x26, 0xff, 0x7f, // LOGICAL_MAXIMUM (32767) - // 0x81, 0x02, // INPUT (Data,Var,Abs) - // 0x09, 0x31, // USAGE (Y) - // 0x46, 0xb0, 0x36, // PHYSICAL_MAXIMUM (14000) - // 0x81, 0x02, // INPUT (Data,Var,Abs) - // 0x05, 0x0d, // USAGE_PAGE (Digitizers) - // 0x09, 0x48, // USAGE (Width) - // 0x36, 0xb8, 0x0b, // PHYSICAL_MINIMUM (3000) - // 0x46, 0xb8, 0x0b, // PHYSICAL_MAXIMUM (3000) - // 0x16, 0xb8, 0x0b, // LOGICAL_MINIMUM (3000) - // 0x26, 0xb8, 0x0b, // LOGICAL_MAXIMUM (3000) - // 0x81, 0x03 // INPUT (Cnst,Var,Abs) + 0x09, 0x30, // USAGE (X) + 0x75, 0x10, // REPORT_SIZE (16) + 0x55, 0x0d, // UNIT_EXPONENT (-3) + 0x65, 0x13, // UNIT (Inch,EngLinear) + 0x35, 0x00, // PHYSICAL_MINIMUM (0) + 0x46, 0xc0, 0x5d, // PHYSICAL_MAXIMUM (24000) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x26, 0xff, 0x7f, // LOGICAL_MAXIMUM (32767) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x09, 0x31, // USAGE (Y) + 0x46, 0xb0, 0x36, // PHYSICAL_MAXIMUM (14000) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x05, 0x0d, // USAGE_PAGE (Digitizers) + 0x09, 0x48, // USAGE (Width) + 0x36, 0xb8, 0x0b, // PHYSICAL_MINIMUM (3000) + 0x46, 0xb8, 0x0b, // PHYSICAL_MAXIMUM (3000) + 0x16, 0xb8, 0x0b, // LOGICAL_MINIMUM (3000) + 0x26, 0xb8, 0x0b, // LOGICAL_MAXIMUM (3000) + 0x81, 0x03 // INPUT (Cnst,Var,Abs) 0xc0, // END_COLLECTION 0xc0 // END_COLLECTION }; From fd499d0f9c90e0effb80adf3b1c039d6e027b048 Mon Sep 17 00:00:00 2001 From: OmegaRogue Date: Mon, 18 Mar 2019 17:38:30 +0100 Subject: [PATCH 02/11] j --- src/HID-APIs/SurfaceDialAPI.h | 3 ++- src/HID-APIs/SurfaceDialAPI.hpp | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/HID-APIs/SurfaceDialAPI.h b/src/HID-APIs/SurfaceDialAPI.h index e0b854f5..f50c826f 100644 --- a/src/HID-APIs/SurfaceDialAPI.h +++ b/src/HID-APIs/SurfaceDialAPI.h @@ -37,6 +37,7 @@ typedef union{ uint16_t rotation: 15; int8_t xAxis: 8; int8_t yAxis: 8; + }; } HID_SurfaceDialReport_Data_t; @@ -50,7 +51,7 @@ class SurfaceDialAPI inline void click(void); inline void rotate(int16_t rotation); inline void position(int8_t x, int8_t y); - inline void posrot(int16_t rotation, int8_t x, int8_t y); + inline void reportData(int16_t rotation, int8_t x, int8_t y); inline void press(void); inline void release(void); inline void releaseAll(void); diff --git a/src/HID-APIs/SurfaceDialAPI.hpp b/src/HID-APIs/SurfaceDialAPI.hpp index 9e6ec5b7..20f0a124 100644 --- a/src/HID-APIs/SurfaceDialAPI.hpp +++ b/src/HID-APIs/SurfaceDialAPI.hpp @@ -50,15 +50,15 @@ void SurfaceDialAPI::click(void) void SurfaceDialAPI::rotate(int16_t rotation) { - posrot(rotation, _xAxis, _yAxis); + reportData(rotation, _xAxis, _yAxis); } void SurfaceDialAPI::position(int8_t x, int8_t y) { - posrot(0, x, y); + reportData(0, x, y); } -void SurfaceDialAPI::posrot(int16_t rotation, int8_t x, int8_t y) +void SurfaceDialAPI::reportData(int16_t rotation, int8_t x, int8_t y) { HID_SurfaceDialReport_Data_t report; _xAxis = x; @@ -85,12 +85,12 @@ void SurfaceDialAPI::button(bool b) void SurfaceDialAPI::xAxis(int8_t x) { _xAxis = x; - posrot(0, _xAxis, _yAxis); + reportData(0, _xAxis, _yAxis); } void SurfaceDialAPI::yAxis(int8_t y) { _yAxis = y; - posrot(0, _xAxis, _yAxis); + reportData(0, _xAxis, _yAxis); } void SurfaceDialAPI::press(void) From 736d5a4b0e060ae2523df76c77b63155e0a6644b Mon Sep 17 00:00:00 2001 From: OmegaRogue Date: Mon, 18 Mar 2019 18:48:26 +0100 Subject: [PATCH 03/11] changes --- examples/SurfaceDial/SurfaceDial.ino | 30 ++++++++++++++-------------- src/HID-APIs/SurfaceDialAPI.h | 20 ++++++++++--------- src/HID-APIs/SurfaceDialAPI.hpp | 14 +++++++------ 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/examples/SurfaceDial/SurfaceDial.ino b/examples/SurfaceDial/SurfaceDial.ino index a26324dc..9c17c3b2 100644 --- a/examples/SurfaceDial/SurfaceDial.ino +++ b/examples/SurfaceDial/SurfaceDial.ino @@ -3,7 +3,7 @@ See the readme for credit to other people. Surface dial example - + Use an encoder and a button to create a Surface Dial-compatible device. See the connection diagram how to wire it up. @@ -29,31 +29,31 @@ volatile int previous = 0; volatile int counter = 0; void setup() { - pinMode(pinA, INPUT_PULLUP); + pinMode(pinA, INPUT_PULLUP); pinMode(pinB, INPUT_PULLUP); pinMode(pinButton, INPUT_PULLUP); - attachInterrupt(digitalPinToInterrupt(pinA), changed, CHANGE); + attachInterrupt(digitalPinToInterrupt(pinA), changed, CHANGE); attachInterrupt(digitalPinToInterrupt(pinB), changed, CHANGE); - + SurfaceDial.begin(); } void changed() { - int A = digitalRead(pinA); + int A = digitalRead(pinA); int B = digitalRead(pinB); int current = (A << 1) | B; int combined = (previous << 2) | current; - - if(combined == 0b0010 || + + if(combined == 0b0010 || combined == 0b1011 || - combined == 0b1101 || + combined == 0b1101 || combined == 0b0100) { counter++; } - + if(combined == 0b0001 || combined == 0b0111 || combined == 0b1110 || @@ -64,22 +64,22 @@ void changed() { previous = current; } -void loop(){ +void loop(){ bool buttonValue = digitalRead(pinButton); if(buttonValue != previousButtonValue){ if(buttonValue) { SurfaceDial.press(); } else { SurfaceDial.release(); - } + } previousButtonValue = buttonValue; } - if(counter >= 4) { + if(counter >= 1) { SurfaceDial.rotate(10); - counter -= 4; - } else if(counter <= -4) { + counter -= 1; + } else if(counter <= -1) { SurfaceDial.rotate(-10); - counter += 4; + counter += 1; } } diff --git a/src/HID-APIs/SurfaceDialAPI.h b/src/HID-APIs/SurfaceDialAPI.h index f50c826f..a7f97617 100644 --- a/src/HID-APIs/SurfaceDialAPI.h +++ b/src/HID-APIs/SurfaceDialAPI.h @@ -32,12 +32,14 @@ typedef union{ uint8_t whole8[0]; uint16_t whole16[0]; uint32_t whole32[0]; + uint64_t whole64[0]; struct{ uint16_t button: 1; uint16_t rotation: 15; - int8_t xAxis: 8; - int8_t yAxis: 8; - + int16_t xAxis: 16; + int16_t yAxis: 16; + uint16_t width: 16; + }; } HID_SurfaceDialReport_Data_t; @@ -50,8 +52,8 @@ class SurfaceDialAPI inline void end(void); inline void click(void); inline void rotate(int16_t rotation); - inline void position(int8_t x, int8_t y); - inline void reportData(int16_t rotation, int8_t x, int8_t y); + inline void position(int16_t x, int16_t y); + inline void reportData(int16_t rotation, int16_t x, int16_t y); inline void press(void); inline void release(void); inline void releaseAll(void); @@ -67,11 +69,11 @@ class SurfaceDialAPI protected: bool _button; bool _onScreen; - int8_t _xAxis; - int8_t _yAxis; + int16_t _xAxis; + int16_t _yAxis; inline void button(bool b); - inline void xAxis(int8_t x); - inline void yAxis(int8_t y); + inline void xAxis(int16_t x); + inline void yAxis(int16_t y); inline void onScreen(bool s); }; diff --git a/src/HID-APIs/SurfaceDialAPI.hpp b/src/HID-APIs/SurfaceDialAPI.hpp index 20f0a124..8d83de03 100644 --- a/src/HID-APIs/SurfaceDialAPI.hpp +++ b/src/HID-APIs/SurfaceDialAPI.hpp @@ -53,18 +53,19 @@ void SurfaceDialAPI::rotate(int16_t rotation) reportData(rotation, _xAxis, _yAxis); } -void SurfaceDialAPI::position(int8_t x, int8_t y) +void SurfaceDialAPI::position(int16_t x, int16_t y) { reportData(0, x, y); } -void SurfaceDialAPI::reportData(int16_t rotation, int8_t x, int8_t y) +void SurfaceDialAPI::reportData(int16_t rotation, int16_t x, int16_t y) { HID_SurfaceDialReport_Data_t report; _xAxis = x; _yAxis = y; report.button = _button; report.rotation = rotation; + report.width = 3000; if(_onScreen) { report.xAxis = _xAxis; @@ -82,12 +83,12 @@ void SurfaceDialAPI::button(bool b) } } -void SurfaceDialAPI::xAxis(int8_t x) +void SurfaceDialAPI::xAxis(int16_t x) { _xAxis = x; reportData(0, _xAxis, _yAxis); } -void SurfaceDialAPI::yAxis(int8_t y) +void SurfaceDialAPI::yAxis(int16_t y) { _yAxis = y; reportData(0, _xAxis, _yAxis); @@ -120,6 +121,7 @@ void SurfaceDialAPI::update() HID_SurfaceDialReport_Data_t report; report.button = _button; report.rotation = 0; + report.width = 3000; if(_onScreen) { report.xAxis = _xAxis; @@ -138,12 +140,12 @@ bool SurfaceDialAPI::getOnScreen() return _onScreen; } -int8_t SurfaceDialAPI::getX() +int16_t SurfaceDialAPI::getX() { return _xAxis; } -int8_t SurfaceDialAPI::getY() +int16_t SurfaceDialAPI::getY() { return _yAxis; } From d9507f93fb675c3bad2c7e9ff807641a23d1b683 Mon Sep 17 00:00:00 2001 From: OmegaRogue Date: Mon, 18 Mar 2019 19:34:17 +0100 Subject: [PATCH 04/11] Updated Example --- .idea/codeStyles/codeStyleConfig.xml | 5 ++ .idea/deployment.xml | 14 ++++++ .idea/vcs.xml | 7 +++ examples/SurfaceDial/SurfaceDial.ino | 74 ++++++++++++++++++++++------ src/HID-APIs/SurfaceDialAPI.h | 26 +++++----- src/HID-APIs/SurfaceDialAPI.hpp | 2 +- 6 files changed, 99 insertions(+), 29 deletions(-) create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/deployment.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..a55e7a17 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/deployment.xml b/.idea/deployment.xml new file mode 100644 index 00000000..970ba03d --- /dev/null +++ b/.idea/deployment.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..f090d20a --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/examples/SurfaceDial/SurfaceDial.ino b/examples/SurfaceDial/SurfaceDial.ino index 9c17c3b2..6ce6bea7 100644 --- a/examples/SurfaceDial/SurfaceDial.ino +++ b/examples/SurfaceDial/SurfaceDial.ino @@ -1,16 +1,14 @@ + /* Copyright (c) 2017 wind-rider See the readme for credit to other people. - Surface dial example - + Use an encoder and a button to create a Surface Dial-compatible device. See the connection diagram how to wire it up. - Please note that: - I tested it using an Arduino Pro Micro; TinkerCad didn't have that in its component library - you obviously don't need a motor, but TinkerCad didn't have a separate encoder - The encoder processing code is coming from https://www.allwinedesigns.com/blog/pocketnc-jog-wheel */ @@ -23,7 +21,12 @@ int pinB = 3; // input pin for pushbutton int pinButton = 4; -volatile bool previousButtonValue = false; +unsigned long keyPrevMillis = 0; +const unsigned long keySampleIntervalMs = 25; +byte longKeyPressCountMax = 840; // 80 * 25 = 2000 ms +byte longKeyPressCount = 0; + +byte prevKeyState = HIGH; // button is active low volatile int previous = 0; volatile int counter = 0; @@ -38,6 +41,7 @@ void setup() { attachInterrupt(digitalPinToInterrupt(pinB), changed, CHANGE); SurfaceDial.begin(); + SurfaceDial.onScreen(true); } void changed() { @@ -65,21 +69,61 @@ void changed() { } void loop(){ - bool buttonValue = digitalRead(pinButton); - if(buttonValue != previousButtonValue){ - if(buttonValue) { - SurfaceDial.press(); - } else { - SurfaceDial.release(); + if (millis() - keyPrevMillis >= keySampleIntervalMs) { + keyPrevMillis = millis(); + + byte currKeyState = digitalRead(pinButton); + + if ((prevKeyState == HIGH) && (currKeyState == LOW)) { + keyPress(); + } + else if ((prevKeyState == LOW) && (currKeyState == HIGH)) { + keyRelease(); } - previousButtonValue = buttonValue; + else if (currKeyState == LOW) { + longKeyPressCount++; + } + + prevKeyState = currKeyState; } if(counter >= 1) { - SurfaceDial.rotate(10); + SurfaceDial.reportData(10,0,0); counter -= 1; } else if(counter <= -1) { - SurfaceDial.rotate(-10); + SurfaceDial.reportData(-10,0,0); counter += 1; - } + } +} + +// called when button is kept pressed for less than 2 seconds +void shortKeyPress() { + SurfaceDial.click(); } + + +// called when button is kept pressed for more than 2 seconds +void longKeyPress() { + + SurfaceDial.release(); +} + + + +// called when key goes from not pressed to pressed +void keyPress() { + SurfaceDial.press(); + longKeyPressCount = 0; +} + +// called when key goes from pressed to not pressed +void keyRelease() { + + + if (longKeyPressCount >= longKeyPressCountMax) { + longKeyPress(); + } + else { + shortKeyPress(); + } +} \ No newline at end of file diff --git a/src/HID-APIs/SurfaceDialAPI.h b/src/HID-APIs/SurfaceDialAPI.h index a7f97617..c5a1f298 100644 --- a/src/HID-APIs/SurfaceDialAPI.h +++ b/src/HID-APIs/SurfaceDialAPI.h @@ -52,29 +52,29 @@ class SurfaceDialAPI inline void end(void); inline void click(void); inline void rotate(int16_t rotation); - inline void position(int16_t x, int16_t y); - inline void reportData(int16_t rotation, int16_t x, int16_t y); + inline void position(int16_t x, int16_t y); + inline void reportData(int16_t rotation, int16_t x, int16_t y); inline void press(void); inline void release(void); - inline void releaseAll(void); + inline void releaseAll(void); inline bool isPressed(); - inline int8_t getX(); - inline int8_t getY(); - inline bool getOnScreen(); - inline void update(); + inline int8_t getX(); + inline int8_t getY(); + inline bool getOnScreen(); + inline void update(); // Sending is public in the base class for advanced users. virtual void SendReport(void* data, int length) = 0; protected: bool _button; - bool _onScreen; - int16_t _xAxis; - int16_t _yAxis; + bool _onScreen; + int16_t _xAxis; + int16_t _yAxis; inline void button(bool b); - inline void xAxis(int16_t x); - inline void yAxis(int16_t y); - inline void onScreen(bool s); + inline void xAxis(int16_t x); + inline void yAxis(int16_t y); + inline void onScreen(bool s); }; // Implementation is inline diff --git a/src/HID-APIs/SurfaceDialAPI.hpp b/src/HID-APIs/SurfaceDialAPI.hpp index 8d83de03..0bd1f1a9 100644 --- a/src/HID-APIs/SurfaceDialAPI.hpp +++ b/src/HID-APIs/SurfaceDialAPI.hpp @@ -24,7 +24,7 @@ THE SOFTWARE. // Include guard #pragma once -SurfaceDialAPI::SurfaceDialAPI(void) : _button(false) +SurfaceDialAPI::SurfaceDialAPI(void) : _button(false), _xAxis(0), _yAxis(0), _onScreen(false) { // Empty } From 951f0301b48e40220eabc7155e54effa983fc9fe Mon Sep 17 00:00:00 2001 From: OmegaRogue Date: Mon, 18 Mar 2019 19:35:13 +0100 Subject: [PATCH 05/11] Updated Example --- examples/SurfaceDial/SurfaceDial.ino | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/SurfaceDial/SurfaceDial.ino b/examples/SurfaceDial/SurfaceDial.ino index 6ce6bea7..921f3bde 100644 --- a/examples/SurfaceDial/SurfaceDial.ino +++ b/examples/SurfaceDial/SurfaceDial.ino @@ -10,6 +10,8 @@ - I tested it using an Arduino Pro Micro; TinkerCad didn't have that in its component library - you obviously don't need a motor, but TinkerCad didn't have a separate encoder The encoder processing code is coming from https://www.allwinedesigns.com/blog/pocketnc-jog-wheel + + Edited by OmegaRogue */ #include "HID-Project.h" From 1fe6764e6819bc4f300f549a8c5ed9d4683dd46c Mon Sep 17 00:00:00 2001 From: OmegaRogue Date: Mon, 18 Mar 2019 19:58:34 +0100 Subject: [PATCH 06/11] fixed OnScreen functionality --- src/HID-APIs/SurfaceDialAPI.h | 1 + src/HID-APIs/SurfaceDialAPI.hpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/HID-APIs/SurfaceDialAPI.h b/src/HID-APIs/SurfaceDialAPI.h index c5a1f298..a5e96242 100644 --- a/src/HID-APIs/SurfaceDialAPI.h +++ b/src/HID-APIs/SurfaceDialAPI.h @@ -57,6 +57,7 @@ class SurfaceDialAPI inline void press(void); inline void release(void); inline void releaseAll(void); + inline void putOnScreen(bool s); inline bool isPressed(); inline int8_t getX(); inline int8_t getY(); diff --git a/src/HID-APIs/SurfaceDialAPI.hpp b/src/HID-APIs/SurfaceDialAPI.hpp index 0bd1f1a9..14aaa748 100644 --- a/src/HID-APIs/SurfaceDialAPI.hpp +++ b/src/HID-APIs/SurfaceDialAPI.hpp @@ -116,6 +116,11 @@ void SurfaceDialAPI::onScreen(bool s) update(); } +void SurfaceDialAPI::putOnScreen(bool s) +{ + onScreen(s); +} + void SurfaceDialAPI::update() { HID_SurfaceDialReport_Data_t report; From 0fad9ff4f1f1b94975a29ab9092ac832ae2cdecb Mon Sep 17 00:00:00 2001 From: OmegaRogue Date: Mon, 18 Mar 2019 20:02:26 +0100 Subject: [PATCH 07/11] fixed OnScreen functionality --- examples/SurfaceDial/SurfaceDial.ino | 2 +- src/HID-APIs/SurfaceDialAPI.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/SurfaceDial/SurfaceDial.ino b/examples/SurfaceDial/SurfaceDial.ino index 921f3bde..17928085 100644 --- a/examples/SurfaceDial/SurfaceDial.ino +++ b/examples/SurfaceDial/SurfaceDial.ino @@ -43,7 +43,7 @@ void setup() { attachInterrupt(digitalPinToInterrupt(pinB), changed, CHANGE); SurfaceDial.begin(); - SurfaceDial.onScreen(true); + SurfaceDial.putOnScreen(true); } void changed() { diff --git a/src/HID-APIs/SurfaceDialAPI.h b/src/HID-APIs/SurfaceDialAPI.h index a5e96242..2d54c0ee 100644 --- a/src/HID-APIs/SurfaceDialAPI.h +++ b/src/HID-APIs/SurfaceDialAPI.h @@ -59,8 +59,8 @@ class SurfaceDialAPI inline void releaseAll(void); inline void putOnScreen(bool s); inline bool isPressed(); - inline int8_t getX(); - inline int8_t getY(); + inline int16_t getX(); + inline int16_t getY(); inline bool getOnScreen(); inline void update(); From c57f3bc0ca3de02a7a583f8ff8010d3748c2275f Mon Sep 17 00:00:00 2001 From: OmegaRogue Date: Mon, 18 Mar 2019 20:05:35 +0100 Subject: [PATCH 08/11] fixed OnScreen functionality --- src/MultiReport/SurfaceDial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MultiReport/SurfaceDial.cpp b/src/MultiReport/SurfaceDial.cpp index 57a140bb..0827e118 100644 --- a/src/MultiReport/SurfaceDial.cpp +++ b/src/MultiReport/SurfaceDial.cpp @@ -68,7 +68,7 @@ static const uint8_t _hidMultiReportDescriptorSurfaceDial[] PROGMEM = { 0x46, 0xb8, 0x0b, // PHYSICAL_MAXIMUM (3000) 0x16, 0xb8, 0x0b, // LOGICAL_MINIMUM (3000) 0x26, 0xb8, 0x0b, // LOGICAL_MAXIMUM (3000) - 0x81, 0x03 // INPUT (Cnst,Var,Abs) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) 0xc0, // END_COLLECTION 0xc0 // END_COLLECTION }; From cad668f3dd72c2049fd6b2b706e824d86fac59f8 Mon Sep 17 00:00:00 2001 From: OmegaRogue Date: Wed, 24 Apr 2019 17:31:03 +0200 Subject: [PATCH 09/11] Delete vcs.xml --- .idea/vcs.xml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index f090d20a..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file From fab7ec9807f1ccbb1909062538457e35e385d084 Mon Sep 17 00:00:00 2001 From: OmegaRogue Date: Wed, 24 Apr 2019 17:31:47 +0200 Subject: [PATCH 10/11] Delete deployment.xml --- .idea/deployment.xml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 .idea/deployment.xml diff --git a/.idea/deployment.xml b/.idea/deployment.xml deleted file mode 100644 index 970ba03d..00000000 --- a/.idea/deployment.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file From df80f3e5b0db2495575091c20ee79b8c7d67290e Mon Sep 17 00:00:00 2001 From: OmegaRogue Date: Wed, 24 Apr 2019 17:32:01 +0200 Subject: [PATCH 11/11] Delete codeStyleConfig.xml --- .idea/codeStyles/codeStyleConfig.xml | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .idea/codeStyles/codeStyleConfig.xml diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index a55e7a17..00000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file