Skip to content

Commit c7e2db6

Browse files
committed
adjustments
1 parent 79160a8 commit c7e2db6

File tree

9 files changed

+75
-9
lines changed

9 files changed

+75
-9
lines changed

platformio.ini

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ build_flags =
5252
-DCONFIG_FILE='"/config.conf"'
5353

5454
lib_deps =
55+
Wire
5556
https://github.com/bmorcelli/AsyncTCP/
5657
esphome/ESPAsyncWebServer-esphome
5758
bblanchon/ArduinoJson @ ^7.0.4

src/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ TouchPoint touchPoint;
4848
keyStroke KeyStroke;
4949

5050
#if defined(HAS_TOUCH)
51-
uint16_t tftHeight = TFT_WIDTH-20;
51+
volatile uint16_t tftHeight = TFT_WIDTH-20;
5252
#else
5353
volatile uint16_t tftHeight = TFT_WIDTH;
5454
#endif

src/mykeyboard.cpp

+40-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,45 @@
1111
int getBattery() { return 0; }
1212

1313

14+
struct box_t
15+
{
16+
int x;
17+
int y;
18+
int w;
19+
int h;
20+
std::uint16_t color;
21+
int touch_id = -1;
22+
char key;
23+
char key_sh;
24+
25+
void clear(void)
26+
{
27+
for (int i = 0; i < 8; ++i)
28+
{
29+
tft.fillRect(x, y, w, h,BGCOLOR);
30+
}
31+
}
32+
void draw(void)
33+
{
34+
int ie = touch_id < 0 ? 4 : 8;
35+
for (int i = 0; i < ie; ++i)
36+
{
37+
tft.drawRect(x, y, w, h,color);
38+
tft.setTextColor(color);
39+
tft.drawChar(key,x+w/2-FM*LW/2,y+h/2-FM*LH/2);
40+
}
41+
}
42+
bool contain(int x, int y)
43+
{
44+
return this->x <= x && x < (this->x + this->w)
45+
&& this->y <= y && y < (this->y + this->h);
46+
}
47+
};
48+
49+
static constexpr std::size_t box_count = 52;
50+
static box_t box_list[box_count];
51+
52+
1453
String keyboard(String mytext, int maxSize, String msg) {
1554
resetTftDisplay();
1655

@@ -168,7 +207,7 @@ String keyboard(String mytext, int maxSize, String msg) {
168207
};
169208
#else // small keyboard size, for small letters (smaller screen)
170209
#define KBLH 10
171-
int ofs[4][2] = {
210+
int ofs[4][3] = {
172211
{7 , 20, 10},
173212
{27, 25, 30},
174213
{52, 25, 55},

variants/CYD-2432S028/variant.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "interface.h"
22
#include "powerSave.h"
3-
#include "core/utils.h"
3+
44

55
#if defined(HAS_CAPACITIVE_TOUCH)
66
#include "CYD28_TouchscreenC.h"

variants/lilygo-t-display-s3-pro/variant.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ void _setBrightness(uint8_t brightval) {
124124
ledcWrite(TFT_BRIGHT_CHANNEL,dutyCycle); // Channel 0
125125
}
126126

127+
struct TouchPointPro {
128+
int16_t x[5];
129+
int16_t y[5];
130+
};
127131
/*********************************************************************
128132
** Function: InputHandler
129133
** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress

variants/lilygo-t-embed-cc1101/pins_arduino.h

+27-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,33 @@ static const uint8_t SCL = GROVE_SCL;
5858
#define SDCARD_MOSI SPI_MOSI_PIN
5959
#define SDCARD_SCK SPI_SCK_PIN
6060

61+
// NRF24 - Over QWIIC Port #2
62+
#define USE_NRF24_VIA_SPI
63+
#define NRF24_CE_PIN 43
64+
#define NRF24_SS_PIN 44
65+
#define NRF24_MOSI_PIN SDCARD_MOSI
66+
#define NRF24_SCK_PIN SDCARD_SCK
67+
#define NRF24_MISO_PIN SDCARD_MISO
68+
69+
// CC1101
70+
#define USE_CC1101_VIA_SPI
71+
#define CC1101_GDO0_PIN 3
72+
#define CC1101_GDO2_PIN 38
73+
#define CC1101_SW1_PIN 47
74+
#define CC1101_SW0_PIN 48
75+
#define CC1101_SS_PIN 12
76+
#define CC1101_MISO_PIN SPI_MISO_PIN
77+
#define CC1101_MOSI_PIN SPI_MOSI_PIN
78+
#define CC1101_SCK_PIN SPI_SCK_PIN
79+
80+
//PN532
81+
#define PN532_RF_REST 45
82+
#define PN532_IRQ 17
83+
84+
// Mic
85+
#define PIN_CLK 39
86+
#define PIN_DATA 42
87+
6188
// Speaker
6289
#define HAS_NS4168_SPKR
6390
#define BCLK 46
@@ -113,7 +140,6 @@ static const uint8_t RX = SERIAL_RX;
113140

114141
// BadUSB
115142
#define USB_as_HID 1
116-
117143
#else
118144
// Lite Version
119145
// #define LITE_VERSION 1

variants/m5stack-core2/variant.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include "interface.h"
22
#include "powerSave.h"
3-
#include "core/utils.h"
4-
53
#include <M5Unified.h>
64

75
/***************************************************************************************

variants/m5stack-cores3/variant.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include "interface.h"
22
#include "powerSave.h"
3-
#include "core/utils.h"
4-
53
#include <M5Unified.h>
64

75
/***************************************************************************************

variants/marauder-mini/variant.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ int getBattery() {
3636
static esp_adc_cal_characteristics_t* adc_chars = nullptr;
3737
static constexpr int BASE_VOLATAGE = 3600;
3838
adc_chars = (esp_adc_cal_characteristics_t*)calloc(1, sizeof(esp_adc_cal_characteristics_t));
39-
esp_adc_cal_characterize((adc_unit_t)_batAdcUnit, ADC_ATTEN_DB_12, ADC_tftWidth_BIT_12, BASE_VOLATAGE, adc_chars);
39+
esp_adc_cal_characterize((adc_unit_t)_batAdcUnit, ADC_ATTEN_DB_12, ADC_WIDTH_BIT_12, BASE_VOLATAGE, adc_chars);
4040
int raw;
4141
raw = adc1_get_raw((adc1_channel_t)_batAdcCh);
4242
uint32_t volt = esp_adc_cal_raw_to_voltage(raw, adc_chars);

0 commit comments

Comments
 (0)