1
- #define LGFX_USE_V1
2
1
#include < M5Unified.h>
2
+ #include < M5UnitRCA.h>
3
3
4
4
#include " wav_unsigned_8bit_click.cpp"
5
5
6
- class LGFX : public lgfx ::LGFX_Device {
7
- public:
8
- lgfx::Panel_CVBS _panel_instance;
9
-
10
- LGFX (void ) {
11
- {
12
- auto cfg = _panel_instance.config ();
13
-
14
- cfg.memory_width = 240 ;
15
- cfg.memory_height = 180 ;
16
- cfg.panel_width = 240 ;
17
- cfg.panel_height = 180 ;
18
- cfg.offset_x = 0 ;
19
- cfg.offset_y = 0 ;
20
- _panel_instance.config (cfg);
21
- }
22
- {
23
- auto cfg = _panel_instance.config_detail ();
24
-
25
- // cfg.signal_type = cfg.signal_type_t::NTSC_J;
26
- // cfg.signal_type = cfg.signal_type_t::PAL;
27
- // cfg.signal_type = cfg.signal_type_t::PAL_M;
28
- cfg.signal_type = cfg.signal_type_t ::PAL_N;
29
-
30
- cfg.pin_dac = 25 ;
31
- cfg.use_psram = 0 ;
32
- cfg.output_level = 128 ;
33
- cfg.chroma_level = 128 ;
34
- _panel_instance.config_detail (cfg);
35
- }
36
-
37
- setPanel (&_panel_instance);
38
- }
39
- };
6
+ M5UnitRCA gfx_rca;
40
7
41
- LGFX gfx_rca;
8
+ // M5UnitRCA gfx_rca ( 216 // logical_width
9
+ // , 144 // logical_height
10
+ // , 256 // output_width
11
+ // , 160 // output_height
12
+ // , M5UnitRCA::signal_type_t::PAL // signal_type
13
+ // , 26 // GPIO pin
14
+ // );
15
+ // signal_type: can be selected from NTSC / NTSC_J / PAL / PAL_M / PAL_N.
16
+ // GPIO pin: can be selected from 25 / 26
42
17
43
18
static constexpr int color_list[3 ] = {TFT_RED, TFT_GREEN, TFT_BLUE};
44
19
static int color_index = 0 ;
@@ -73,7 +48,7 @@ void setup(void) {
73
48
M5.Display .setTextColor (TFT_WHITE, TFT_BLACK);
74
49
M5.Display .drawCenterString (" M5 RCA Module :)" , 160 , 20 );
75
50
76
- M5.Display .drawCenterString (" Using Pin 25 " , 160 , 120 );
51
+ M5.Display .drawCenterString (" Using Pin 26 " , 160 , 120 );
77
52
M5.Display .drawString (" Pin 25" , 25 , 210 );
78
53
M5.Display .drawString (" Pin 26" , 220 , 210 );
79
54
@@ -160,24 +135,7 @@ void loop(void) {
160
135
is_pin_25 = true ;
161
136
M5.Display .drawCenterString (" Using Pin 25" , 160 , 120 );
162
137
163
- lgfx::Panel_CVBS* p = (lgfx::Panel_CVBS*)gfx_rca.panel ();
164
- p->deinit ();
165
- auto cfg = p->config ();
166
- cfg.memory_width = 240 ;
167
- cfg.memory_height = 180 ;
168
- cfg.panel_width = 240 ;
169
- cfg.panel_height = 180 ;
170
- cfg.offset_x = 0 ;
171
- cfg.offset_y = 0 ;
172
- p->config (cfg);
173
- auto cfg_d = p->config_detail ();
174
- cfg_d.pin_dac = 25 ;
175
- cfg_d.use_psram = 0 ;
176
- cfg_d.output_level = 128 ;
177
- cfg_d.chroma_level = 128 ;
178
- p->config_detail (cfg_d);
179
-
180
- gfx_rca.init ();
138
+ gfx_rca.setOutputPin (25 );
181
139
gfx_rca.setTextColor (TFT_WHITE, color_list[color_index]);
182
140
gfx_rca.drawCenterString (" Using Pin 25" , 120 , 110 );
183
141
}
@@ -189,24 +147,7 @@ void loop(void) {
189
147
is_pin_25 = false ;
190
148
M5.Display .drawCenterString (" Using Pin 26" , 160 , 120 );
191
149
192
- lgfx::Panel_CVBS* p = (lgfx::Panel_CVBS*)gfx_rca.panel ();
193
- p->deinit ();
194
- auto cfg = p->config ();
195
- cfg.memory_width = 240 ;
196
- cfg.memory_height = 180 ;
197
- cfg.panel_width = 240 ;
198
- cfg.panel_height = 180 ;
199
- cfg.offset_x = 0 ;
200
- cfg.offset_y = 0 ;
201
- p->config (cfg);
202
- auto cfg_d = p->config_detail ();
203
- cfg_d.pin_dac = 26 ;
204
- cfg_d.use_psram = 0 ;
205
- cfg_d.output_level = 128 ;
206
- cfg_d.chroma_level = 128 ;
207
- p->config_detail (cfg_d);
208
-
209
- gfx_rca.init ();
150
+ gfx_rca.setOutputPin (26 );
210
151
gfx_rca.setTextColor (TFT_WHITE, color_list[color_index]);
211
152
gfx_rca.drawCenterString (" Using Pin 26" , 120 , 110 );
212
153
}
0 commit comments