File tree Expand file tree Collapse file tree 4 files changed +12
-2
lines changed
apps_unfrozen/screensavers
apps_unfrozen/screensavers Expand file tree Collapse file tree 4 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,11 @@ def __rng() -> int:
3030 return zc
3131
3232
33+ def color565 (r : int , g : int , b : int ) -> int :
34+ """Convert RGB888 to RGB565 color format"""
35+ return ((r & 0xF8 ) << 8 ) | ((g & 0xFC ) << 3 ) | (b >> 3 )
36+
37+
3338def start (view_manager ) -> bool :
3439 """Start the app"""
3540 import random
@@ -121,7 +126,7 @@ def run(view_manager) -> None:
121126
122127 if 0 <= screen_x < screen_size .x and 0 <= screen_y < screen_size .y :
123128 r = g = b = 255 - sz [i ]
124- color = tft . color565 (r , g , b )
129+ color = color565 (r , g , b )
125130 pixel_vector .x = screen_x
126131 pixel_vector .y = screen_y
127132 tft .pixel (pixel_vector , color )
Original file line number Diff line number Diff line change @@ -30,6 +30,11 @@ def __rng() -> int:
3030 return zc
3131
3232
33+ def color565 (r : int , g : int , b : int ) -> int :
34+ """Convert RGB888 to RGB565 color format"""
35+ return ((r & 0xF8 ) << 8 ) | ((g & 0xFC ) << 3 ) | (b >> 3 )
36+
37+
3338def start (view_manager ) -> bool :
3439 """Start the app"""
3540 import random
@@ -121,7 +126,7 @@ def run(view_manager) -> None:
121126
122127 if 0 <= screen_x < screen_size .x and 0 <= screen_y < screen_size .y :
123128 r = g = b = 255 - sz [i ]
124- color = tft . color565 (r , g , b )
129+ color = color565 (r , g , b )
125130 pixel_vector .x = screen_x
126131 pixel_vector .y = screen_y
127132 tft .pixel (pixel_vector , color )
You can’t perform that action at this time.
0 commit comments