File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 14
14
#endif
15
15
#define SPI_PORT 0
16
16
17
+ #ifdef USE_TOUCH
18
+ #define TOUCH_CS 29
19
+ #endif
20
+
17
21
class LGFX : public lgfx ::LGFX_Device
18
22
{
19
23
lgfx::Panel_ST7735S _panel_instance;
20
24
lgfx::Bus_SPI _bus_instance; // SPIバスのインスタンス
21
25
#ifdef USE_BACKLIGHT
22
26
lgfx::Light_PWM _light_instance;
23
27
#endif
28
+ #ifdef USE_TOUCH
29
+ lgfx::Touch_XPT2046 _touch_instance;
30
+ #endif
24
31
25
32
public:
26
33
LGFX (void )
@@ -76,6 +83,22 @@ class LGFX : public lgfx::LGFX_Device
76
83
}
77
84
#endif
78
85
86
+ #ifdef USE_TOUCH
87
+ {
88
+ auto cfg = _touch_instance.config ();
89
+ cfg.bus_shared = true ;
90
+ cfg.spi_host = SPI_PORT;
91
+ cfg.pin_sclk = TFT_SCLK;
92
+ cfg.pin_mosi = TFT_MOSI;
93
+ cfg.pin_miso = TFT_MISO;
94
+ cfg.pin_cs = TOUCH_CS;
95
+
96
+ _touch_instance.config (cfg);
97
+ _panel_instance.setTouch (&_touch_instance);
98
+ }
99
+ #endif
100
+
101
+
79
102
setPanel (&_panel_instance); // 使用するパネルをセットします。
80
103
}
81
104
};
You can’t perform that action at this time.
0 commit comments