Skip to content

Commit fa1e250

Browse files
authored
Merge pull request #337 from lovyan03/develop
1.1.2
2 parents 79a4b91 + 80eb0e8 commit fa1e250

File tree

17 files changed

+1462
-381
lines changed

17 files changed

+1462
-381
lines changed

.github/workflows/ArduinoBuild.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
- 2.0.3
4545
- 2.0.4
4646
- 2.0.5
47+
- 2.0.6
4748

4849
include:
4950
# 3D matrix doesn't apply to these:

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ This library has the following advantages.
4444
- Composite video signal (NTSC, PAL) output (only ESP32)
4545

4646

47-
| | SPI | I2C | 8bit Para |16bit Para | CVBS |
48-
|:------:|:---:|:---:|:---------:|:---------:|:-----:|
49-
|ESP32 | HW | HW | HW (I2S) | --- |HW(I2S)|
50-
|ESP32-S2| HW | HW | HW (I2S) | HW (I2S) | --- |
51-
|ESP32-S3| HW | HW |HW(LCD/CAM)|HW(LCD/CAM)| --- |
52-
|ESP32-C3| HW | HW | SW | --- | --- |
53-
|ESP8266 | HW | SW | --- | --- | --- |
54-
|SAMD51 | HW | HW | --- | --- | --- |
55-
|SAMD21 | HW | HW | --- | --- | --- |
56-
|RP2040 | HW | --- | --- | --- | --- |
47+
| | SPI | I2C | 8bit Para |16bit Para | RGB | CVBS |
48+
|:------:|:---:|:---:|:---------:|:---------:|:---------:|:--------:|
49+
|ESP32 | HW | HW | HW (I2S) | --- | --- |HW(I2SDAC)|
50+
|ESP32-S2| HW | HW | HW (I2S) | HW (I2S) | --- | --- |
51+
|ESP32-S3| HW | HW |HW(LCD/CAM)|HW(LCD/CAM)|HW(LCD/CAM)| --- |
52+
|ESP32-C3| HW | HW | SW | --- | --- | --- |
53+
|ESP8266 | HW | SW | --- | --- | --- | --- |
54+
|SAMD51 | HW | HW | --- | --- | --- | --- |
55+
|SAMD21 | HW | HW | --- | --- | --- | --- |
56+
|RP2040 | HW | --- | --- | --- | --- | --- |
5757

5858
※ HW = HardWare Peripheral / SW = SoftWare implementation
5959

@@ -79,6 +79,7 @@ This library has the following advantages.
7979
- ILI9486
8080
- ILI9488 (Makerfabs Touch with Camera)
8181
- IT8951 (M5Paper)
82+
- NT35510/OTM8009A
8283
- R61529
8384
- RA8875
8485
- RM68120
@@ -544,7 +545,7 @@ TomThumb font : [3-clause BSD](src/lgfx/Fonts/GFXFF/TomThumb.h) Brian J. Swetlan
544545
実装予定 Unimplemented request
545546
----------------
546547
- ディスプレイ Displays
547-
- OTM8009A / NT35510
548548
- SEPS525
549-
549+
- LT7680A / LT7685
550+
- RA8873 / RA8876
550551

doc/Panel_CVBS.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ NTSCを使用した際に黒が僅かに白浮きしていると感じる場合
2323
----------------
2424

2525
- 出力できる最大解像度は信号タイプによって差があります。
26-
- 720 x 480 (NTSC,NTSC-J)
27-
- 864 x 576 (PAL,PAL-M)
26+
- 720 x 480 (PAL-M,NTSC,NTSC-J)
27+
- 864 x 576 (PAL)
2828
- 720 x 576 (PAL-N)
2929
- 最大解像度以下であれば、任意の解像度を設定可能です。
3030
- 最大解像度を整数で約分した解像度の指定を推奨します。
@@ -34,9 +34,9 @@ NTSCを使用した際に黒が僅かに白浮きしていると感じる場合
3434
<TABLE>
3535
<TR>
3636
<TH></TH>
37-
<TH> NTSC <BR> NTSC-J </TH>
37+
<TH> PAL-M <BR> NTSC <BR> NTSC-J </TH>
3838
<TH> PAL-N </TH>
39-
<TH> PAL <BR> PAL-M </TH>
39+
<TH> PAL </TH>
4040
</TR>
4141
<TR align="center">
4242
<TH> max width </TH>
@@ -160,6 +160,12 @@ public:
160160
cfg.chroma_level = 128; // 初期値128
161161
// 数値を下げると彩度が下がり、0で白黒になります。数値を上げると彩度が上がります。;
162162

163+
// バックグラウンドでPSRAMの読出しを行うタスクの優先度を設定;
164+
// cfg.task_priority = 25;
165+
166+
// バックグラウンドでPSRAMの読出しを行うタスクを実行するCPUを選択 (APP_CPU_NUM or PRO_CPU_NUM);
167+
// cfg.task_pinned_core = PRO_CPU_NUM;
168+
163169
_panel_instance.config_detail(cfg);
164170
}
165171

@@ -172,7 +178,27 @@ LGFX gfx;
172178

173179
void setup(void)
174180
{
181+
// 色数の指定 (省略時は rgb332_1Byte)
182+
//gfx.setColorDepth( 8); // RGB332 256色
183+
//gfx.setColorDepth(16); // RGB565 65536色
184+
//gfx.setColorDepth(lgfx::color_depth_t::rgb332_1Byte); // RGB332 256色
185+
//gfx.setColorDepth(lgfx::color_depth_t::rgb565_2Byte); // RGB565 65536色
186+
//gfx.setColorDepth(lgfx::color_depth_t::grayscale_8bit); // モノクロ 256階調
187+
188+
//※ 実行中に setColorDepth で色数を変更することも可能ですが、
189+
// メモリの再割当を実行するため描画内容は無効になります。
190+
175191
gfx.init();
192+
193+
for (int x = 0; x < gfx.width(); ++x)
194+
{
195+
int v = x * 256 / gfx.width();
196+
gfx.fillRect(x, 0 * gfx.height() >> 3, 7, gfx.height() >> 3, gfx.color888(v, v, v));
197+
gfx.fillRect(x, 1 * gfx.height() >> 3, 7, gfx.height() >> 3, gfx.color888(v, 0 ,0));
198+
gfx.fillRect(x, 2 * gfx.height() >> 3, 7, gfx.height() >> 3, gfx.color888(0, v, 0));
199+
gfx.fillRect(x, 3 * gfx.height() >> 3, 7, gfx.height() >> 3, gfx.color888(0, 0, v));
200+
}
201+
delay(1000);
176202
}
177203

178204
void loop(void)

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"type": "git",
1212
"url": "https://github.com/lovyan03/LovyanGFX.git"
1313
},
14-
"version": "0.5.0",
14+
"version": "1.1.2",
1515
"frameworks": ["arduino", "espidf"],
1616
"platforms": ["espressif32", "espressif8266", "atmelsam"],
1717
"headers": "LovyanGFX.hpp",

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=LovyanGFX
2-
version=0.5.0
2+
version=1.1.2
33
author=lovyan03
44
maintainer=lovyan03
55
sentence=TFT LCD Graphics driver with touch for ESP32, ESP8266, SAMD21, SAMD51, RP2040

src/LovyanGFX.hpp

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
/*----------------------------------------------------------------------------/
22
Lovyan GFX library - LCD graphics library .
3-
4-
support platform:
5-
ESP32 (SPI/I2S) with Arduino/ESP-IDF
6-
ATSAMD51 (SPI) with Arduino
7-
8-
Original Source:
9-
https://github.com/lovyan03/LovyanGFX/
10-
11-
Licence:
12-
[BSD](https://github.com/lovyan03/LovyanGFX/blob/master/license.txt)
13-
14-
Author:
15-
[lovyan03](https://twitter.com/lovyan03)
16-
17-
Contributors:
18-
[ciniml](https://github.com/ciniml)
19-
[mongonta0716](https://github.com/mongonta0716)
20-
[tobozo](https://github.com/tobozo)
3+
4+
Original Source:
5+
https://github.com/lovyan03/LovyanGFX/
6+
7+
Licence:
8+
[BSD](https://github.com/lovyan03/LovyanGFX/blob/master/license.txt)
9+
10+
Author:
11+
[lovyan03](https://twitter.com/lovyan03)
12+
13+
Contributors:
14+
[ciniml](https://github.com/ciniml)
15+
[mongonta0716](https://github.com/mongonta0716)
16+
[tobozo](https://github.com/tobozo)
2117
/----------------------------------------------------------------------------*/
2218
#ifndef LOVYANGFX_HPP_
2319
#define LOVYANGFX_HPP_
@@ -26,22 +22,20 @@ Original Source:
2622
#undef setFont
2723
#endif
2824

29-
#if __has_include("lgfx/v1_init.hpp") && ( defined ( LGFX_USE_V1 ) || !__has_include("lgfx/v0_init.hpp") )
25+
#if defined ( LGFX_USE_V0 ) && __has_include("lgfx/v0_init.hpp")
26+
27+
#include "lgfx/v0_init.hpp"
3028

31-
#include "lgfx/v1_init.hpp"
29+
#else
3230

33-
#if defined ( LGFX_AUTODETECT )
31+
#include "lgfx/v1_init.hpp"
3432

35-
#include "LGFX_AUTODETECT.hpp"
33+
#if defined ( LGFX_AUTODETECT )
3634

37-
#endif
35+
#include "LGFX_AUTODETECT.hpp"
3836

39-
#else // if defined ( LGFX_USE_V0 )
37+
#endif
4038

41-
#if __has_include("lgfx/v0_init.hpp")
42-
#include "lgfx/v0_init.hpp"
4339
#endif
4440

4541
#endif
46-
47-
#endif

src/lgfx/v1/LGFXBase.hpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -859,8 +859,9 @@ namespace lgfx
859859
}
860860
else
861861
{
862-
if (dst_depth == rgb565_2Byte) { pc.fp_copy = pixelcopy_t::copy_rgb_fast<swap565_t, T>; }
863-
else { pc.fp_copy = pixelcopy_t::copy_rgb_fast<rgb332_t, T>; }
862+
if ( dst_depth == rgb565_2Byte) { pc.fp_copy = pixelcopy_t::copy_rgb_fast<swap565_t, T>; }
863+
else if (dst_depth == rgb332_1Byte) { pc.fp_copy = pixelcopy_t::copy_rgb_fast<rgb332_t, T>; }
864+
else { pc.fp_copy = pixelcopy_t::copy_rgb_fast<grayscale_t, T>; }
864865
}
865866
return pc;
866867
}
@@ -919,8 +920,9 @@ namespace lgfx
919920
}
920921
else
921922
{
922-
if (dst_depth == rgb565_2Byte) { pc.fp_copy = pixelcopy_t::copy_palette_fast<swap565_t, T>; }
923-
else { pc.fp_copy = pixelcopy_t::copy_palette_fast<rgb332_t, T>; }
923+
if ( dst_depth == rgb565_2Byte) { pc.fp_copy = pixelcopy_t::copy_palette_fast<swap565_t, T>; }
924+
else if (dst_depth == rgb332_1Byte) { pc.fp_copy = pixelcopy_t::copy_palette_fast<rgb332_t, T>; }
925+
else { pc.fp_copy = pixelcopy_t::copy_palette_fast<grayscale_t, T>; }
924926
}
925927
}
926928
return pc;
@@ -1060,8 +1062,10 @@ namespace lgfx
10601062
{
10611063
if (depth == rgb565_2Byte) {
10621064
pc.fp_copy = pixelcopy_t::copy_rgb_antialias<swap565_t>;
1063-
} else {
1065+
} else if (depth == rgb332_1Byte) {
10641066
pc.fp_copy = pixelcopy_t::copy_rgb_antialias<rgb332_t>;
1067+
} else {
1068+
pc.fp_copy = pixelcopy_t::copy_rgb_antialias<grayscale_t>;
10651069
}
10661070
}
10671071
return pc;

src/lgfx/v1/gitTagVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#define LGFX_VERSION_MAJOR 1
22
#define LGFX_VERSION_MINOR 1
3-
#define LGFX_VERSION_PATCH 0
3+
#define LGFX_VERSION_PATCH 2
44
#define LOVYANGFX_VERSION F( LGFX_VERSION_MAJOR "." LGFX_VERSION_MINOR "." LGFX_VERSION_PATCH )

src/lgfx/v1/misc/colortype.hpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -586,13 +586,15 @@ namespace lgfx
586586
template<> LGFX_INLINE uint32_t color_convert<bgra8888_t , bgr666_t >(uint32_t c) { c<<=2; return (c << 8) + ((c & 0xC0C0C0) << 2) + 0xFF; }
587587
template<> LGFX_INLINE uint32_t color_convert<bgra8888_t , bgr888_t >(uint32_t c) { return (c << 8) + 0xFF; }
588588
template<> LGFX_INLINE uint32_t color_convert<bgra8888_t , grayscale_t>(uint32_t c) { return (((c << 8) + c) << 16) + (c << 8) + 0xFF; }
589-
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, rgb332_t >(uint32_t c) { uint_fast16_t t = ((c>>5)*0x49); t += ((c>>2)&7)*0x92; t += (c&3) * 0xAA; return t >> 3; }
590-
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, rgb565_t >(uint32_t c) { uint_fast16_t g = ( c & 0x07E0); g |= g >> 6; uint_fast16_t rb = ((c>>11)+(c&0x1F))*0x21; return (rb+g)>>4; }
591-
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, rgb888_t >(uint32_t c) { uint_fast16_t g = ( c >> 8) & 0xFF; g = (g << 1) + (g >> 7); return (g + ((c>>16)&0xFF)+(c&0xFF))>>2; }
592-
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, argb8888_t >(uint32_t c) { uint_fast16_t g = ( c >> 8) & 0xFF; g = (g << 1) + (g >> 7); return (g + ((c>>16)&0xFF)+(c&0xFF))>>2; }
593-
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, swap565_t >(uint32_t c) { uint_fast16_t rb = ((((c>>3)&0x1F) + ((c>>8)&0x1F)) * 0x21) >> 2; uint_fast16_t g = (c & 7); g = (((g << 3) + (c >> 13)) << 3) + g; return (rb+g) >> 2; }
594-
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, bgr666_t >(uint32_t c) { uint_fast16_t g = ((c >> 8) & 0x3F)*0x82; uint_fast16_t rb = ((c>>16) + (c&0x3F))*0x41; return (rb+g)>>6; }
595-
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, bgr888_t >(uint32_t c) { uint_fast16_t g = ( c >> 8) & 0xFF; g = (g << 1) + (g >> 7); return (g + ((c>>16)&0xFF)+(c&0xFF))>>2; }
589+
590+
// ITU-R BT.601 RGB to Y convert R 0.299 + G 0.587 + B 0.114
591+
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, rgb332_t >(uint32_t c) { return (((c >> 5) & 0x07) * 43 + ((c >> 2) & 0x07) * 86 + (c & 0x03) * 39) >> 2; }
592+
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, rgb565_t >(uint32_t c) { return (((c >> 11) & 0x1F) * 79 + ((c >> 5) & 0x3F) * 76 + (c & 0x1F) * 30) >> 5; }
593+
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, rgb888_t >(uint32_t c) { return (((c >> 16) & 0xFF) * 77 + ((c >> 8) & 0xFF) * 151 + (c & 0xFF) * 29) >> 8; }
594+
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, argb8888_t >(uint32_t c) { return (((c >> 24) & 0xFF) * 77 + ((c >> 16) & 0xFF) * 151 + ((c >> 8) & 0xFF) * 29) >> 8; }
595+
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, swap565_t >(uint32_t c) { return (((c >> 3) & 0x1F) * 79+(((c<<3)+(c>>13))&0x3F)*76 + ((c >> 8) & 0x1F) * 30) >> 5; }
596+
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, bgr666_t >(uint32_t c) { return (( c & 0x3F) * 39 + ((c >> 8) & 0x3F) * 76 + ((c >> 16) & 0x3F) * 15) >> 5; }
597+
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, bgr888_t >(uint32_t c) { return (( c & 0xFF) * 77 + ((c >> 8) & 0xFF) * 151 + ((c >> 16) & 0xFF) * 29) >> 8; }
596598
template<> LGFX_INLINE uint32_t color_convert<grayscale_t, bgra8888_t >(uint32_t c) { return color_convert<grayscale_t, bgr888_t>(c>>8); }
597599

598600
LGFX_INLINE rgb332_t& rgb332_t ::operator=(const rgb565_t& c) { set(color_convert<rgb332_t , rgb565_t >(c.get())); return *this; }
@@ -708,6 +710,7 @@ namespace lgfx
708710
case rgb666_3Byte : return color_convert<bgr666_t , rgb332_t>;
709711
case rgb565_2Byte : return color_convert<swap565_t , rgb332_t>;
710712
case rgb332_1Byte : return no_convert;
713+
case grayscale_8bit: return color_convert<grayscale_t, rgb332_t>;
711714
default: break;
712715
}
713716
} else if (std::is_same<TSrc, rgb888_t>::value || std::is_same<TSrc, uint32_t>::value) {
@@ -717,6 +720,7 @@ namespace lgfx
717720
case rgb666_3Byte : return color_convert<bgr666_t , rgb888_t>;
718721
case rgb565_2Byte : return color_convert<swap565_t , rgb888_t>;
719722
case rgb332_1Byte : return color_convert<rgb332_t , rgb888_t>;
723+
case grayscale_8bit: return color_convert<grayscale_t,rgb888_t>;
720724
default: break;
721725
}
722726
} else if (std::is_same<TSrc, argb8888_t>::value) {
@@ -726,6 +730,7 @@ namespace lgfx
726730
case rgb666_3Byte : return color_convert<bgr666_t , rgb888_t>;
727731
case rgb565_2Byte : return color_convert<swap565_t, rgb888_t>;
728732
case rgb332_1Byte : return color_convert<rgb332_t , rgb888_t>;
733+
case grayscale_8bit: return color_convert<grayscale_t,rgb888_t>;
729734
default: break;
730735
}
731736
} else if (std::is_same<TSrc, bgr888_t>::value) {
@@ -735,6 +740,7 @@ namespace lgfx
735740
case rgb666_3Byte : return color_convert<bgr666_t , bgr888_t>;
736741
case rgb565_2Byte : return color_convert<swap565_t , bgr888_t>;
737742
case rgb332_1Byte : return color_convert<rgb332_t , bgr888_t>;
743+
case grayscale_8bit: return color_convert<grayscale_t,bgr888_t>;
738744
default: break;
739745
}
740746
} else { // if (std::is_same<TSrc, rgb565_t>::value || std::is_same<TSrc, uint16_t>::value || std::is_same<TSrc, int>::value)
@@ -744,6 +750,7 @@ namespace lgfx
744750
case rgb666_3Byte : return color_convert<bgr666_t , rgb565_t>;
745751
case rgb565_2Byte : return getSwap16;
746752
case rgb332_1Byte : return color_convert<rgb332_t , rgb565_t>;
753+
case grayscale_8bit: return color_convert<grayscale_t,rgb565_t>;
747754
default: break;
748755
}
749756
}
@@ -822,11 +829,12 @@ namespace lgfx
822829
convert_bgr888 = get_fp_convert_src<bgr888_t >(depth_);
823830

824831
switch (depth_) {
825-
case argb8888_4Byte: revert_rgb888 = color_convert<rgb888_t, bgra8888_t>; break;
826-
case rgb888_3Byte: revert_rgb888 = color_convert<rgb888_t, bgr888_t >; break;
827-
case rgb666_3Byte: revert_rgb888 = color_convert<rgb888_t, bgr666_t >; break;
828-
case rgb565_2Byte: revert_rgb888 = color_convert<rgb888_t, swap565_t >; break;
829-
case rgb332_1Byte: revert_rgb888 = color_convert<rgb888_t, rgb332_t >; break;
832+
case argb8888_4Byte: revert_rgb888 = color_convert<rgb888_t, bgra8888_t >; break;
833+
case rgb888_3Byte: revert_rgb888 = color_convert<rgb888_t, bgr888_t >; break;
834+
case rgb666_3Byte: revert_rgb888 = color_convert<rgb888_t, bgr666_t >; break;
835+
case rgb565_2Byte: revert_rgb888 = color_convert<rgb888_t, swap565_t >; break;
836+
case rgb332_1Byte: revert_rgb888 = color_convert<rgb888_t, rgb332_t >; break;
837+
case grayscale_8bit: revert_rgb888 = color_convert<rgb888_t, grayscale_t>; break;
830838
default: revert_rgb888 = no_convert;
831839
}
832840
}

src/lgfx/v1/misc/pixelcopy.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@ namespace lgfx
6464
if (src_depth == rgb565_2Byte) {
6565
fp_copy = pixelcopy_t::get_fp_copy_rgb_affine<swap565_t>(dst_depth);
6666
fp_skip = pixelcopy_t::skip_rgb_affine<swap565_t>;
67-
} else { // src_depth == rgb332_1Byte:
67+
} else if (src_depth == rgb332_1Byte) {
6868
fp_copy = pixelcopy_t::get_fp_copy_rgb_affine<rgb332_t >(dst_depth);
6969
fp_skip = pixelcopy_t::skip_rgb_affine<rgb332_t>;
70+
} else { // src_depth == grayscale_8bit:
71+
fp_copy = pixelcopy_t::get_fp_copy_rgb_affine<grayscale_t >(dst_depth);
72+
fp_skip = pixelcopy_t::skip_rgb_affine<grayscale_t>;
7073
}
7174
}
7275
}

0 commit comments

Comments
 (0)