Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit36c0759

Browse files
authored
Merge pull requestlvgl-micropython#263 from lukier/fix-for-esp32-s3
Fixes for the ESP32 S3 build
2 parents76958e5 +4e5b545 commit36c0759

File tree

3 files changed

+73
-64
lines changed

3 files changed

+73
-64
lines changed
Lines changed: 9 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,22 @@
11
#ifndef__RGB565_DITHER_H__
22
#define__RGB565_DITHER_H__
33

4-
#include<string.h>
4+
#include<stdint.h>
5+
#include<stdbool.h>
56

6-
#defineCALC_THRESHOLD(x,y) (uint8_t)((y & 7) << 3) + (x & 7)
7+
#defineCALC_THRESHOLD(x,y) (uint8_t)(((y & 7) << 3) + (x & 7))
78

8-
staticuint8_t*red_thresh;
9-
staticuint8_t*green_thresh;
10-
staticuint8_t*blue_thresh;
9+
externuint8_t*red_thresh;
10+
externuint8_t*green_thresh;
11+
externuint8_t*blue_thresh;
1112

13+
boolrgb565_dither_init(void);
1214

1315
staticinlinevoidrgb565_dither_pixel(uint8_ttreshold_id,uint16_t*pixel)
1416
{
1517
*pixel= (((((*pixel >>8)&0xF8)+red_thresh[treshold_id]) <<8) |
1618
((((*pixel >>3)&0xFC)+green_thresh[treshold_id]) <<3) |
17-
((((*pixel&0x1F) <<3)+blue_thresh[treshold_id]) >>3));
19+
((((*pixel&0x1F) <<3)+blue_thresh[treshold_id]) >>3));
1820
}
1921

20-
21-
staticinlineboolrgb565_dither_init(void)
22-
{
23-
if (red_thresh==NULL) {
24-
red_thresh= (uint8_t*)malloc(64);
25-
if (red_thresh!=NULL) {
26-
memcpy(red_thresh,
27-
(uint8_t []){
28-
1,7,3,5,0,8,2,6,
29-
7,1,5,3,8,0,6,2,
30-
3,5,0,8,2,6,1,7,
31-
5,3,8,0,6,2,7,1,
32-
0,8,2,6,1,7,3,5,
33-
8,0,6,2,7,1,5,3,
34-
2,6,1,7,3,5,0,8,
35-
6,2,7,1,5,3,8,0
36-
},64);
37-
}
38-
}
39-
40-
if (green_thresh==NULL) {
41-
green_thresh= (uint8_t*)malloc(64);
42-
if (green_thresh!=NULL) {
43-
memcpy(green_thresh,
44-
(uint8_t []){
45-
1,3,2,2,3,1,2,2,
46-
2,2,0,4,2,2,4,0,
47-
3,1,2,2,1,3,2,2,
48-
2,2,4,0,2,2,0,4,
49-
1,3,2,2,3,1,2,2,
50-
2,2,0,4,2,2,4,0,
51-
3,1,2,2,1,3,2,2,
52-
2,2,4,0,2,2,0,4
53-
},64);
54-
}
55-
}
56-
if (blue_thresh==NULL) {
57-
blue_thresh= (uint8_t*)malloc(64);
58-
if (blue_thresh!=NULL) {
59-
memcpy(blue_thresh,
60-
(uint8_t []){
61-
5,3,8,0,6,2,7,1,
62-
3,5,0,8,2,6,1,7,
63-
8,0,6,2,7,1,5,3,
64-
0,8,2,6,1,7,3,5,
65-
6,2,7,1,5,3,8,0,
66-
2,6,1,7,3,5,0,8,
67-
7,1,5,3,8,0,6,2,
68-
1,7,3,5,0,8,2,6
69-
},64);
70-
}
71-
}
72-
73-
if (red_thresh==NULL||blue_thresh==NULL||green_thresh==NULL)return false;
74-
elsereturn true;
75-
}
76-
77-
#endif
22+
#endif
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,66 @@
11

2+
#include"rgb565_dither.h"
3+
#include<string.h>
4+
5+
uint8_t*red_thresh=NULL;
6+
uint8_t*green_thresh=NULL;
7+
uint8_t*blue_thresh=NULL;
8+
9+
boolrgb565_dither_init(void)
10+
{
11+
if (red_thresh==NULL) {
12+
red_thresh= (uint8_t*)malloc(64);
13+
if (red_thresh!=NULL) {
14+
memcpy(red_thresh,
15+
(uint8_t []){
16+
1,7,3,5,0,8,2,6,
17+
7,1,5,3,8,0,6,2,
18+
3,5,0,8,2,6,1,7,
19+
5,3,8,0,6,2,7,1,
20+
0,8,2,6,1,7,3,5,
21+
8,0,6,2,7,1,5,3,
22+
2,6,1,7,3,5,0,8,
23+
6,2,7,1,5,3,8,0
24+
},64);
25+
}
26+
}
27+
28+
if (green_thresh==NULL) {
29+
green_thresh= (uint8_t*)malloc(64);
30+
if (green_thresh!=NULL) {
31+
memcpy(green_thresh,
32+
(uint8_t []){
33+
1,3,2,2,3,1,2,2,
34+
2,2,0,4,2,2,4,0,
35+
3,1,2,2,1,3,2,2,
36+
2,2,4,0,2,2,0,4,
37+
1,3,2,2,3,1,2,2,
38+
2,2,0,4,2,2,4,0,
39+
3,1,2,2,1,3,2,2,
40+
2,2,4,0,2,2,0,4
41+
},64);
42+
}
43+
}
44+
if (blue_thresh==NULL) {
45+
blue_thresh= (uint8_t*)malloc(64);
46+
if (blue_thresh!=NULL) {
47+
memcpy(blue_thresh,
48+
(uint8_t []){
49+
5,3,8,0,6,2,7,1,
50+
3,5,0,8,2,6,1,7,
51+
8,0,6,2,7,1,5,3,
52+
0,8,2,6,1,7,3,5,
53+
6,2,7,1,5,3,8,0,
54+
2,6,1,7,3,5,0,8,
55+
7,1,5,3,8,0,6,2,
56+
1,7,3,5,0,8,2,6
57+
},64);
58+
}
59+
}
60+
61+
if (red_thresh==NULL||blue_thresh==NULL||green_thresh==NULL)return false;
62+
elsereturn true;
63+
}
64+
265

366

‎ext_mod/lcd_bus/micropython.cmake‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ if(ESP_PLATFORM)
1818
${CMAKE_CURRENT_LIST_DIR}/esp32_src/i80_bus.c
1919
${CMAKE_CURRENT_LIST_DIR}/esp32_src/rgb_bus.c
2020
${CMAKE_CURRENT_LIST_DIR}/esp32_src/rgb_bus_rotation.c
21+
${CMAKE_CURRENT_LIST_DIR}/esp32_src/rgb565_dither.c
2122
)
2223

2324
# gets esp_lcd include paths

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp