Skip to content

Commit bcbd106

Browse files
Rocketctfacchinm
authored andcommitted
added new qtouch management for new release
1 parent a68dd1b commit bcbd106

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

src/Arduino_MKRIoTCarrier_Qtouch.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,16 @@ MKRIoTCarrierQtouch::MKRIoTCarrierQtouch() {
2626
}
2727

2828
//Individual pad
29-
MKRIoTCarrierQtouch::MKRIoTCarrierQtouch(touchButtons padIndex) {
29+
MKRIoTCarrierQtouch::MKRIoTCarrierQtouch(touchButtons padIndex,getRev_t getRevision) {
3030
_padID = padIndex;
31+
board_revision = getRevision;
32+
}
33+
34+
// sets function called on slave write
35+
MKRIoTCarrierQtouch::MKRIoTCarrierQtouch(getRev_t getRevision)
36+
{
37+
//If board_revision = 0, IMU module is LSM6DSOX, otherwise is LSM6DS3
38+
board_revision = getRevision;
3139
}
3240

3341
bool MKRIoTCarrierQtouch::getTouch(touchButtons padIndex) {
@@ -93,6 +101,22 @@ void MKRIoTCarrierQtouch::updateConfig(int newSens, touchButtons padIndex) {
93101

94102
//Manager
95103
bool MKRIoTCarrierQtouch::begin() {
104+
// FIXME: TODO: check that passing revision makes sense
105+
_revision = board_revision();
106+
if (_revision == BOARD_REVISION_2){
107+
TOUCH.setTouchPad(mkr_iot_carrier_rev2::Y0,
108+
mkr_iot_carrier_rev2::Y1,
109+
mkr_iot_carrier_rev2::Y2,
110+
mkr_iot_carrier_rev2::Y3,
111+
mkr_iot_carrier_rev2::Y4);
112+
113+
} else {
114+
TOUCH.setTouchPad(mkr_iot_carrier_rev1::Y0,
115+
mkr_iot_carrier_rev1::Y1,
116+
mkr_iot_carrier_rev1::Y2,
117+
mkr_iot_carrier_rev1::Y3,
118+
mkr_iot_carrier_rev1::Y4);
119+
}
96120
return TOUCH.begin();
97121
}
98122

src/Arduino_MKRIoTCarrier_Qtouch.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#include "Arduino.h"
2525
#include "Arduino_MCHPTouch.h"
26+
#include <MKRIoTCarrierDefines.h>
2627

2728
static bool _available = false;
2829

@@ -37,7 +38,8 @@ typedef enum {
3738
class MKRIoTCarrierQtouch{
3839
public:
3940
MKRIoTCarrierQtouch();
40-
MKRIoTCarrierQtouch(touchButtons padIndex);
41+
MKRIoTCarrierQtouch(int (*)(void));
42+
MKRIoTCarrierQtouch(touchButtons padIndex,int (*)(void));
4143
bool begin();
4244
bool update();
4345

@@ -59,6 +61,8 @@ class MKRIoTCarrierQtouch{
5961
touchButtons _padID;
6062
int _padIndex;
6163

64+
int (*board_revision)(void);
65+
int _revision;
6266

6367
bool _touchesPrev[5] = {0, 0, 0, 0, 0}; //To know last touches
6468

0 commit comments

Comments
 (0)