-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathArduino_MKRIoTCarrier_Qtouch.h
72 lines (56 loc) · 2.23 KB
/
Arduino_MKRIoTCarrier_Qtouch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
This file is part of the Arduino_MKRIoTCarrier library.
Copyright (c) 2020 Arduino SA.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef ARDUINO_MKRIoTCarrier_Qtouch
#define ARDUINO_MKRIoTCarrier_Qtouch
#include "Arduino.h"
#include "Arduino_MCHPTouch.h"
static bool _available = false;
typedef enum {
TOUCH0 = 0,
TOUCH1,
TOUCH2,
TOUCH3,
TOUCH4
} touchButtons;
class MKRIoTCarrierQtouch{
public:
MKRIoTCarrierQtouch();
MKRIoTCarrierQtouch(touchButtons padIndex);
bool begin();
bool update();
//Set touch settings
void updateConfig(int newSens, touchButtons padIndex);
void updateConfig(int newSens);
bool getTouch(touchButtons _padIndex);
bool getTouch() __attribute__((deprecated));
bool onTouchDown(touchButtons _padIndex);
bool onTouchDown() __attribute__((deprecated));
bool onTouchUp(touchButtons _padIndex);
bool onTouchUp() __attribute__((deprecated));
bool onTouchChange(touchButtons _padIndex);
bool onTouchChange() __attribute__((deprecated));
bool customSens = false;
private:
touchButtons _padID;
int _padIndex;
bool _touchesPrev[5] = {0, 0, 0, 0, 0}; //To know last touches
//Config
bool setOnChange = false; //Touch on change
bool setOnNormal = false; //Always read
bool setOnUp = false; //When the pad is not being touched
bool setOnDown = false; //When is pressed, to make 2 Downs you need to touch it, release it and touch it again
};
#endif