Prusa MINI Firmware overview
|
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
Go to the source code of this file.
|
static uint16_t | swap_ui16 (uint16_t val) |
|
static uint16_t | swap_ui32 (uint32_t val) |
|
static color_t | color_rgb (uint8_t r, uint8_t g, uint8_t b) |
|
static uint16_t | color_to_565 (color_t clr) |
|
static color_t | color_from_565 (uint16_t clr565) |
|
static color_t | color_alpha (color_t clr0, color_t clr1, uint8_t alpha) |
|
static point_ui16_t | point_ui16 (uint16_t x, uint16_t y) |
|
static rect_ui16_t | rect_ui16 (uint16_t x, uint16_t y, uint16_t w, uint16_t h) |
|
static padding_ui8_t | padding_ui8 (uint8_t l, uint8_t t, uint8_t r, uint8_t b) |
|
static int | point_in_rect_ui16 (point_ui16_t pt, rect_ui16_t rc) |
|
static int | rect_in_rect_ui16 (rect_ui16_t rc, rect_ui16_t rc1) |
|
static int | rect_empty_ui16 (rect_ui16_t rc) |
|
rect_ui16_t | rect_intersect_ui16 (rect_ui16_t rc, rect_ui16_t rc1) |
|
rect_ui16_t | rect_ui16_add_padding_ui8 (rect_ui16_t rc, padding_ui8_t pad) |
|
rect_ui16_t | rect_ui16_sub_padding_ui8 (rect_ui16_t rc, padding_ui8_t pad) |
|
rect_ui16_t | rect_align_ui16 (rect_ui16_t rc, rect_ui16_t rc1, uint8_t align) |
|
point_ui16_t | font_meas_text (font_t *pf, const char *str) |
|
int | font_line_chars (font_t *pf, const char *str, uint16_t line_width) |
|
point_ui16_t | icon_meas (const uint8_t *pi) |
|
const uint8_t * | resource_ptr (uint16_t id) |
|
uint16_t | resource_size (uint16_t id) |
|
FILE * | resource_fopen (uint16_t id, const char *opentype) |
|
font_t * | resource_font (uint16_t id) |
|
◆ ALIGN_LEFT
◆ ALIGN_HCENTER
#define ALIGN_HCENTER 0x01 |
◆ ALIGN_RIGHT
◆ ALIGN_HMASK
◆ ALIGN_TOP
◆ ALIGN_VCENTER
#define ALIGN_VCENTER 0x10 |
◆ ALIGN_BOTTOM
#define ALIGN_BOTTOM 0x20 |
◆ ALIGN_VMASK
◆ ALIGN_MASK
◆ ALIGN_CENTER
◆ ALIGN_LEFT_TOP
◆ ALIGN_LEFT_CENTER
◆ ALIGN_LEFT_BOTTOM
◆ ALIGN_RIGHT_TOP
◆ ALIGN_RIGHT_CENTER
◆ ALIGN_RIGHT_BOTTOM
◆ ALIGN_CENTER_TOP
◆ ALIGN_CENTER_BOTTOM
◆ ROPFN_COPY
◆ ROPFN_INVERT
#define ROPFN_INVERT 0x01 |
◆ ROPFN_SWAPBW
#define ROPFN_SWAPBW 0x02 |
◆ ROPFN_DISABLE
#define ROPFN_DISABLE 0x04 |
◆ FONT_FLG_SWAP
#define FONT_FLG_SWAP 0x00000001 |
◆ FONT_FLG_LSBF
#define FONT_FLG_LSBF 0x00000002 |
◆ COLOR_BLACK
#define COLOR_BLACK 0x00000000L |
◆ COLOR_WHITE
#define COLOR_WHITE 0x00ffffffL |
◆ COLOR_RED
#define COLOR_RED 0x000000ffL |
◆ COLOR_RED_ALERT
#define COLOR_RED_ALERT 0x002646e7L |
◆ COLOR_LIME
#define COLOR_LIME 0x0000ff00L |
◆ COLOR_BLUE
#define COLOR_BLUE 0x00ff0000L |
◆ COLOR_YELLOW
#define COLOR_YELLOW 0x0000ffffL |
◆ COLOR_CYAN
#define COLOR_CYAN 0x00ffff00L |
◆ COLOR_MAGENTA
#define COLOR_MAGENTA 0x00ff00ffL |
◆ COLOR_SILVER
#define COLOR_SILVER 0x00c0c0c0L |
◆ COLOR_GRAY
#define COLOR_GRAY 0x00808080L |
◆ COLOR_MAROON
#define COLOR_MAROON 0x00000080L |
◆ COLOR_OLIVE
#define COLOR_OLIVE 0x00008080L |
◆ COLOR_GREEN
#define COLOR_GREEN 0x00008000L |
◆ COLOR_PURPLE
#define COLOR_PURPLE 0x00800080L |
◆ COLOR_TEAL
#define COLOR_TEAL 0x00808000L |
◆ COLOR_NAVY
#define COLOR_NAVY 0x00800000L |
◆ COLOR_ORANGE
#define COLOR_ORANGE 0x001B65F8L |
◆ RESOURCE_TYPE_RAW
#define RESOURCE_TYPE_RAW 0 |
◆ RESOURCE_TYPE_TXT
#define RESOURCE_TYPE_TXT 1 |
◆ RESOURCE_TYPE_FNT
#define RESOURCE_TYPE_FNT 2 |
◆ RESOURCE_TYPE_BMP
#define RESOURCE_TYPE_BMP 3 |
◆ RESOURCE_TYPE_PNG
#define RESOURCE_TYPE_PNG 4 |
◆ RESOURCE_TABLE_BEGIN
◆ RESOURCE_TABLE_END
#define RESOURCE_TABLE_END |
◆ RESOURCE_ENTRY_NUL
#define RESOURCE_ENTRY_NUL |
( |
| ) |
{ 0, 0 }, |
◆ RESOURCE_ENTRY_PNG
#define RESOURCE_ENTRY_PNG |
( |
|
v | ) |
{ v, sizeof(v) }, |
◆ RESOURCE_ENTRY_FNT
#define RESOURCE_ENTRY_FNT |
( |
|
v | ) |
{ (uint8_t *)&v, sizeof(font_t) }, |
◆ color_t
◆ point_ui16_t
◆ rect_ui16_t
◆ font_t
◆ padding_ui8_t
◆ bitmap_t
◆ resource_entry_t
◆ gui_defaults_t
◆ swap_ui16()
static uint16_t swap_ui16 |
( |
uint16_t |
val | ) |
|
|
static |
121 return (val >> 8) | ((val & 0xff) << 8);
◆ swap_ui32()
static uint16_t swap_ui32 |
( |
uint32_t |
val | ) |
|
|
static |
125 return (val >> 16) | ((val & 0xffff) << 16);
◆ color_rgb()
129 return r | ((uint32_t)g << 8) | ((uint32_t)
b << 16);
◆ color_to_565()
static uint16_t color_to_565 |
( |
color_t |
clr | ) |
|
|
static |
133 return swap_ui16(((clr >> 19) & 0x001f) | ((clr >> 5) & 0x07e0) | ((clr << 8) & 0xf800));
◆ color_from_565()
static color_t color_from_565 |
( |
uint16_t |
clr565 | ) |
|
|
static |
◆ color_alpha()
143 uint8_t g0 = (clr0 >> 8) & 0xff;
144 uint8_t b0 = (clr0 >> 16) & 0xff;
146 uint8_t g1 = (clr1 >> 8) & 0xff;
147 uint8_t b1 = (clr1 >> 16) & 0xff;
148 uint8_t r = ((255 - alpha) * r0 + alpha * r1) / 255;
149 uint8_t g = ((255 - alpha) * g0 + alpha * g1) / 255;
150 uint8_t b = ((255 - alpha) * b0 + alpha * b1) / 255;
◆ point_ui16()
◆ rect_ui16()
static rect_ui16_t rect_ui16 |
( |
uint16_t |
x, |
|
|
uint16_t |
y, |
|
|
uint16_t |
w, |
|
|
uint16_t |
h |
|
) |
| |
|
static |
◆ padding_ui8()
◆ point_in_rect_ui16()
170 return ((pt.
x >= rc.
x) && (pt.
x < (rc.
x + rc.
w)) && (pt.
y >= rc.
y) && (pt.
y < (rc.
y + rc.
h))) ? 1 : 0;
◆ rect_in_rect_ui16()
174 return ((rc.
x >= rc1.
x) && ((rc.
x + rc.
w) <= (rc1.
x + rc1.
w)) && (rc.
y >= rc1.
y) && ((rc.
y + rc.
h) <= (rc1.
y + rc1.
h))) ? 1 : 0;
◆ rect_empty_ui16()
178 return ((rc.
w == 0) || (rc.
h == 0)) ? 1 : 0;
◆ rect_intersect_ui16()
38 uint16_t x[6] = { rc.
x, rc.
x + rc.
w, rc1.
x, rc1.
x + rc1.
w, 0, 0 };
39 uint16_t y[6] = { rc.
y, rc.
y + rc.
h, rc1.
y, rc1.
y + rc1.
h, 0, 0 };
42 rect_ui16_t rc2 = { x[4], y[4], x[5] - x[4], y[5] - y[4] };
◆ rect_ui16_add_padding_ui8()
51 rect.
y = rc.
y - pad.
top;
◆ rect_ui16_sub_padding_ui8()
◆ rect_align_ui16()
71 rect.
x = ((rc.
x + rc.
w) > rc1.
w) ? ((rc.
x + rc.
w) - rc1.
w) : 0;
75 rect.
x = rc.
x + ((rc.
w - rc1.
w) / 2);
77 rect.
x = (rc.
x > ((rc1.
w - rc.
w) / 2)) ? rc.
x - ((rc1.
w - rc.
w) / 2) : 0;
85 rect.
y = ((rc.
y + rc.
h) > rc1.
h) ? ((rc.
y + rc.
h) - rc1.
h) : 0;
89 rect.
y = rc.
y + ((rc.
h - rc1.
h) / 2);
91 rect.
y = (rc.
y > ((rc1.
h - rc.
h) / 2)) ? rc.
y - ((rc1.
h - rc.
h) / 2) : 0;
◆ font_meas_text()
104 int len = strlen(str);
◆ font_line_chars()
int font_line_chars |
( |
font_t * |
pf, |
|
|
const char * |
str, |
|
|
uint16_t |
line_width |
|
) |
| |
125 int len = strlen(str);
131 while ((w + char_w) <= line_width) {
144 while ((n > 0) && ((str[n] !=
' ') && (str[n] !=
'\n'))) {
149 n = line_width / char_w;
◆ icon_meas()
157 if (memcmp(pi,
"\x89PNG", 4) == 0) {
◆ resource_ptr()
◆ resource_size()
uint16_t resource_size |
( |
uint16_t |
id | ) |
|
◆ resource_fopen()
FILE* resource_fopen |
( |
uint16_t |
id, |
|
|
const char * |
opentype |
|
) |
| |
◆ resource_font()
font_t* resource_font |
( |
uint16_t |
id | ) |
|
uint16_t y
Definition: guitypes.h:71
uint8_t h
Definition: guitypes.h:78
#define ALIGN_BOTTOM
Definition: guitypes.h:16
uint16_t w
Definition: guitypes.h:72
Definition: guitypes.h:76
uint8_t bottom
Definition: guitypes.h:90
uint8_t top
Definition: guitypes.h:88
const uint16_t resource_table_size
uint8_t right
Definition: guitypes.h:89
uint16_t x
Definition: guitypes.h:65
const uint8_t * ptr
Definition: guitypes.h:102
#define ALIGN_RIGHT
Definition: guitypes.h:12
void interval_intersect_ui16(uint16_t *p)
Definition: guitypes.c:7
Definition: guitypes.h:64
uint8_t left
Definition: guitypes.h:87
static uint16_t swap_ui16(uint16_t val)
Definition: guitypes.h:120
uint16_t y
Definition: guitypes.h:66
#define ALIGN_TOP
Definition: guitypes.h:14
uint8_t w
Definition: guitypes.h:77
Definition: guitypes.h:86
Definition: guitypes.h:69
#define ALIGN_LEFT
Definition: guitypes.h:10
const uint8_t[]
Definition: 404_html.c:3
uint16_t h
Definition: guitypes.h:73
#define ALIGN_VCENTER
Definition: guitypes.h:15
const uint16_t resource_count
const resource_entry_t resource_table[]
const uint16_t size
Definition: guitypes.h:103
Definition: guitypes.h:101
uint16_t x
Definition: guitypes.h:70
static color_t color_rgb(uint8_t r, uint8_t g, uint8_t b)
Definition: guitypes.h:128
list b
Definition: createSpeedLookupTable.py:30
#define ALIGN_HCENTER
Definition: guitypes.h:11
static point_ui16_t point_ui16(uint16_t x, uint16_t y)
Definition: guitypes.h:154
static png_bytep size_t size
Definition: pngwrite.c:2170
#define ALIGN_HMASK
Definition: guitypes.h:13
#define ALIGN_VMASK
Definition: guitypes.h:17