Muteki
EABI code execution on Besta® RTOS devices.
Loading...
Searching...
No Matches
lcd.h
Go to the documentation of this file.
1/*
2 * Copyright 2026 dogtopus
3 * SPDX-License-Identifier: MIT
4 */
5
10
11#ifndef __MUTEKI_DRAW_TYPES_LCD_H__
12#define __MUTEKI_DRAW_TYPES_LCD_H__
13
14#include "../../threading.h"
15#include "font.h"
16#include "surface.h"
17#include "primitives.h"
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
47
66
84
102
115 DASH_8_8_16_0,
116 DASH_4,
117 DASH_0_4_16_4_4_4,
118 DASH_12_4_4_4_4_4,
119 DASH_1,
120 DASH_2,
121 DASH_16,
122 DASH_0_1_8_1_8_1_8_1_4_0 = 12,
123 DASH_4_1_8_1_7_1_9_1,
124 DASH_3_1_7_1_7_1_4_8,
125 DASH_3_1_7_1_7_1_7_1_4_0,
126 DASH_0_1_6_1_1_1_4_1_3_1_2_1_5_2_3_0,
127 DASH_3_2_5_1_2_1_3_1_4_1_1_1_6_1,
128 DASH_7_1_6_1_6_1_6_1_3_0,
129 DASH_3_1_6_1_6_1_6_1_7_0,
130 DASH_24_8 = 22,
134 DASH_CUSTOM = 0x100,
135};
136
140typedef struct lcd_draw_s lcd_draw_t;
142typedef struct lcd_lock_s lcd_lock_t;
144typedef struct lcd_base_s lcd_base_t;
147
148#if defined(MUTEKI_HAS_THREAD_SAFE_LCD) && MUTEKI_HAS_THREAD_SAFE_LCD == 1
149#define lcd_s lcd_thread_safe_s
151typedef struct lcd_thread_safe_s lcd_t;
152#else
153#define lcd_s lcd_base_s
155typedef struct lcd_base_s lcd_t;
156#endif
157
163 short x; // 0x0:0x2 (lcd_t[0x5c:0x5e])
165 short y; // 0x2:0x4 (lcd_t[0x5e:0x60])
167 unsigned int size; // 0x4:0x8 (lcd_t[0x60:0x64])
172 short type; // 0x8:0xa (lcd_t[0x64:0x66])
174 short unk_0xa; // 0xa:0xc (lcd_t[0x66:0x68])
176 short grab_count; // 0xc:0xe (lcd_t[0x68:0x6a])
178 short unk_0xe; // 0xe:0x10 (lcd_t[0x6a:0x6c])
179}; // 0x10 bytes
180
186 int unk_0x0; // 0x0:0x4 (lcd_t[0x14:0x18])
188 int fg_color; // 0x4:0x8 (lcd_t[0x18:0x1c])
190 unsigned int stroke_dash_pattern; // 0x8:0xc (lcd_t[0x1c:0x20])
192 short stroke_size; // 0xc:0xe (lcd_t[0x20:0x22])
197 short stroke_dash; // 0xe:0x10 (lcd_t[0x22:0x24])
199 int unk_0x10; // 0x10:0x14 (lcd_t[0x24:0x28])
201 int unk_0x14; // 0x14:0x18 (lcd_t[0x28:0x2c])
203 int unk_0x18; // 0x18:0x1c (lcd_t[0x2c:0x30])
205 int unk_0x1c; // 0x1c:0x20 (lcd_t[0x30:0x34])
206}; // 0x20 bytes
207
215 int unk_0x0; // 0x0:0x4 (lcd_thread_safe_t[0x94:0x98])
217 bxc_cs_t *cs; // 0x4:0x8 (lcd_thread_safe_t[0x98:0x9c])
219 void (*lock)(void); // 0x8:0xc (lcd_thread_safe_t[0x9c:0xa0])
221 void (*unlock)(void); // 0xc:0x10 (lcd_thread_safe_t[0xa0:0xa4])
223 int unk_0xa4[23]; // 0x10:0x6c (lcd_thread_safe_t[0xa4:0x100])
224}; // 0x6c bytes
225
239typedef int (*lcd_rotate_callback_t)(lcd_t *self, int rotation);
240
249 void *pixel_end; // 0x4:0x8
251 size_t pixel_size; // 0x8:0xc
253 int bg_color; // 0xc:0x10
255 int transparent_color; // 0x10:0x14
257 lcd_draw_t draw; // 0x14:0x34
259 font_info_t font; // 0x34:0x5c
265 int unk_0x74[3]; // 0x74:0x80
267 lcd_cursor_t *cursor; // 0x80:0x84
269 short width; // 0x84:0x86
271 short height; // 0x86:0x88
276 int rotation; // 0x88:0x8c
282 short depth_bytes; // 0x8c:0x8e
287 short xsize; // 0x8e:0x90
293}; // 0x94 bytes
294
303 void *pixel_end; // 0x4:0x8
305 size_t pixel_size; // 0x8:0xc
307 int bg_color; // 0xc:0x10
309 int transparent_color; // 0x10:0x14
311 lcd_draw_t draw; // 0x14:0x34
313 font_info_t font; // 0x34:0x5c
319 int unk_0x74[3]; // 0x74:0x80
321 lcd_cursor_t *cursor; // 0x80:0x84
323 short width; // 0x84:0x86
325 short height; // 0x86:0x88
330 int rotation; // 0x88:0x8c
336 short depth_bytes; // 0x8c:0x8e
341 short xsize; // 0x8e:0x90
348 int unk_0x94; // 0x94:0x98
350 bxc_cs_t *cs; // 0x98:0x9c
352 void (*lock)(void); // 0x9c:0xa0
354 void (*unlock)(void); // 0xa0:0xa4
356 int unk_0xa4[23]; // 0xa4:0x100
357};
358
359#ifdef __cplusplus
360} // extern "C"
361#endif
362
363#endif // __MUTEKI_DRAW_TYPES_LCD_H__
Native threading API.
struct bxc_cs_s bxc_cs_t
Critical section descriptor type.
Definition threading.h:174
Drawing routine primitive types.
struct lcd_rect_s lcd_rect_t
Rectangle used to represent usable drawing area in an LCD descriptor.
The LCD descriptor.
Definition lcd.h:245
int rotation
Current canvas rotation.
Definition lcd.h:276
font_info_t font
Per-LCD states shared by specifically font rendering routines.
Definition lcd.h:259
lcd_cursor_t * cursor
Cursor states.
Definition lcd.h:267
lcd_rotate_callback_t rotate
Rotation callback.
Definition lcd.h:292
short depth_bytes
Integer size of each pixel in bytes.
Definition lcd.h:282
lcd_rect_t drawing_area
Usable drawing area of the LCD.
Definition lcd.h:263
lcd_draw_t draw
Per-LCD states shared by drawing routines.
Definition lcd.h:257
void * pixel_end
End address of the pixel/framebuffer.
Definition lcd.h:249
size_t pixel_size
Total size of the pixel/framebuffer in bytes.
Definition lcd.h:251
short width
Width of the LCD in pixels.
Definition lcd.h:269
int unk_0x74[3]
Unknown.
Definition lcd.h:265
short xsize
Pixel row size in bytes.
Definition lcd.h:287
int transparent_color
Current transparent color.
Definition lcd.h:255
short height
Height of the LCD in pixels.
Definition lcd.h:271
lcd_surface_t * surface
Surface linked to the LCD.
Definition lcd.h:247
lcd_cursor_t saved_cursor
A copy of the cursor states when the LCD descriptor was created.
Definition lcd.h:261
int bg_color
Current background color.
Definition lcd.h:253
Cursor states usually linked to an LCD descriptor.
Definition lcd.h:161
short x
X coordinate of the cursor.
Definition lcd.h:163
short type
Type of the cursor.
Definition lcd.h:172
short unk_0xe
Unknown.
Definition lcd.h:178
short unk_0xa
Unknown.
Definition lcd.h:174
unsigned int size
Size of the cursor.
Definition lcd.h:167
short y
Y coordinate of the cursor.
Definition lcd.h:165
short grab_count
Number of times this cursor has been locked/grabbed by other code.
Definition lcd.h:176
Drawing routine common states.
Definition lcd.h:184
int unk_0x18
Unknown.
Definition lcd.h:203
unsigned int stroke_dash_pattern
Dash bit pattern.
Definition lcd.h:190
int unk_0x14
Unknown.
Definition lcd.h:201
int unk_0x0
Unknown.
Definition lcd.h:186
short stroke_size
Size of stroke.
Definition lcd.h:192
short stroke_dash
Predefined dash pattern.
Definition lcd.h:197
int unk_0x10
Unknown.
Definition lcd.h:199
int fg_color
Current foreground color.
Definition lcd.h:188
int unk_0x1c
Unknown.
Definition lcd.h:205
An extended part of the LCD descriptor that implements descriptor locking.
Definition lcd.h:213
int unk_0x0
Unknown.
Definition lcd.h:215
bxc_cs_t * cs
A critical section descriptor. It's unclear where it is used.
Definition lcd.h:217
int unk_0xa4[23]
Unknown.
Definition lcd.h:223
void(*) lock(void)
Shortcut to lock the descriptor.
Definition lcd.h:219
void(*) unlock(void)
Shortcut to unlock the descriptor.
Definition lcd.h:221
A thread-safe variant of the LCD descriptor used on some versions of Besta RTOS.
Definition lcd.h:299
lcd_surface_t * surface
Surface linked to the LCD.
Definition lcd.h:301
int transparent_color
Current transparent color.
Definition lcd.h:309
int bg_color
Current background color.
Definition lcd.h:307
lcd_draw_t draw
Per-LCD states shared by drawing routines.
Definition lcd.h:311
int rotation
Current canvas rotation.
Definition lcd.h:330
int unk_0xa4[23]
Unknown.
Definition lcd.h:356
short depth_bytes
Integer size of each pixel in bytes.
Definition lcd.h:336
int unk_0x94
Unknown.
Definition lcd.h:348
bxc_cs_t * cs
A critical section descriptor. It's unclear where it is used.
Definition lcd.h:350
int unk_0x74[3]
Unknown.
Definition lcd.h:319
font_info_t font
Per-LCD states shared by specifically font rendering routines.
Definition lcd.h:313
lcd_cursor_t * cursor
Cursor states.
Definition lcd.h:321
lcd_rect_t drawing_area
Usable drawing area of the LCD.
Definition lcd.h:317
short height
Height of the LCD in pixels.
Definition lcd.h:325
size_t pixel_size
Total size of the pixel/framebuffer in bytes.
Definition lcd.h:305
void(*) unlock(void)
Shortcut to unlock the descriptor.
Definition lcd.h:354
void * pixel_end
End address of the pixel/framebuffer.
Definition lcd.h:303
lcd_rotate_callback_t rotate
Rotation callback.
Definition lcd.h:346
short width
Width of the LCD in pixels.
Definition lcd.h:323
lcd_cursor_t saved_cursor
A copy of the cursor states when the LCD descriptor was created.
Definition lcd.h:315
void(*) lock(void)
Shortcut to lock the descriptor.
Definition lcd.h:352
short xsize
Pixel row size in bytes.
Definition lcd.h:341
Font management data types.
struct font_info_s font_info_t
Font rendering routine common states.
struct lcd_base_s lcd_base_t
lcd_base_s
Definition lcd.h:144
struct lcd_cursor_s lcd_cursor_t
lcd_cursor_s
Definition lcd.h:138
struct lcd_lock_s lcd_lock_t
lcd_lock_s
Definition lcd.h:142
stroke_predefined_dash_e
Predefined dash patterns.
Definition lcd.h:110
@ DASH_NONE
Solid line.
Definition lcd.h:114
@ DASH_CUSTOM
Custom dash pattern.
Definition lcd.h:134
struct lcd_draw_s lcd_draw_t
lcd_draw_s
Definition lcd.h:140
struct lcd_base_s lcd_t
lcd_base_s
Definition lcd.h:155
lcd_rotation_e
Rotation values used by lcd_rotate_callback_t.
Definition lcd.h:88
@ LCD_ROTATION_TOP_SIDE_RIGHT
Set the rotation so the top side of the canvas is facing right.
Definition lcd.h:96
@ LCD_ROTATION_TOP_SIDE_UP
Set the rotation so the top side of the canvas is facing up.
Definition lcd.h:90
@ LCD_ROTATION_APPLY
Actually rotate the buffer. Used internally.
Definition lcd.h:100
@ LCD_ROTATION_TOP_SIDE_LEFT
Set the rotation so the top side of the canvas is facing left.
Definition lcd.h:92
@ LCD_ROTATION_TOP_SIDE_DOWN
Set the rotation so the top side of the canvas is facing down.
Definition lcd.h:94
@ LCD_ROTATION_QUERY
Query the current rotation. Will not change the current location.
Definition lcd.h:98
struct lcd_thread_safe_s lcd_thread_safe_t
lcd_thread_safe_s
Definition lcd.h:146
lcd_print_flag_e
Process flags for string and character printing.
Definition lcd.h:27
@ LCD_PRINT_UNDERSCORE_ONLY
Draw underscores only.
Definition lcd.h:45
@ LCD_PRINT_INVERT_ALT
Seems to be an alternative version of LCD_PRINT_INVERT.
Definition lcd.h:40
@ LCD_PRINT_NONE
No extra process.
Definition lcd.h:31
@ LCD_PRINT_INVERT
Invert colors.
Definition lcd.h:36
lcd_str_align_e
String alignment types.
Definition lcd.h:70
@ LCD_STR_ALIGN_RIGHT
Align to top-right.
Definition lcd.h:78
@ LCD_STR_ALIGN_LEFT
Align to top-left.
Definition lcd.h:74
@ LCD_STR_ALIGN_CENTER
Align to top-center.
Definition lcd.h:82
lcd_print_str_flag_e
Process flags for string printing only.
Definition lcd.h:51
@ LCD_PRINT_STR_ENCODING_BIG5
Assume text encoding to be BIG5 instead of UTF-16.
Definition lcd.h:56
@ LCD_PRINT_STR_ENCODING_GB18030
Assume text encoding to be GB18030 instead of UTF-16.
Definition lcd.h:60
@ LCD_PRINT_STR_ENCODING_TIS_620
Assume text encoding to be TIS-620 instead of UTF-16.
Definition lcd.h:64
int(*) lcd_rotate_callback_t(lcd_t *self, int rotation)
Callback type for handling canvas rotation.
Definition lcd.h:239
Surface type definitions.
struct lcd_surface_s lcd_surface_t
Descriptor of an LCD drawing surface or hardware framebuffer.