Prusa MINI Firmware overview
|
#include "gui.h"
#include "config.h"
#include "window_logo.h"
#include "stm32f4xx_hal.h"
#include "st7789v.h"
#include "sys.h"
#include <assert.h>
|
typedef void() | drawCol_t(size_t rect_index, size_t rect_count, size_t col, size_t row2draw, size_t row_space) |
|
|
int | sim_heater_temp2val (float temp) |
|
void | window_list_spi_item (window_list_t *pwindow_list, uint16_t index, const char **pptext, uint16_t *pid_icon) |
|
void | window_list_modes_item (window_list_t *pwindow_list, uint16_t index, const char **pptext, uint16_t *pid_icon) |
|
void | window_list_inversions_item (window_list_t *pwindow_list, uint16_t index, const char **pptext, uint16_t *pid_icon) |
|
void | window_list_bright_enas_item (window_list_t *pwindow_list, uint16_t index, const char **pptext, uint16_t *pid_icon) |
|
void | drawCol (size_t col, size_t row, size_t len, uint16_t directColor) |
|
void | drawCol_buff (size_t col, size_t row, size_t len, uint16_t *directColorBuff) |
|
void | readCol (size_t col, size_t row, size_t len, uint16_t *directColorBuff) |
|
void | draw_read_drawCol (size_t col, size_t row, size_t row_space, size_t len, uint16_t directColor, uint16_t *directColorBuff) |
|
void | draw_read_drawRect (size_t col, size_t row, size_t len, size_t w, uint16_t directColor, uint16_t *directColorBuff) |
|
size_t | dispRamTest_NextCol (size_t row_pos, size_t rect_w, size_t rect_space, size_t rect_count, size_t border_w) |
|
int | _getRectIndex (size_t col_x, size_t rect_w, size_t rect_space, size_t border_w) |
|
void | dispRamTest (size_t test_ID, size_t row) |
|
void | printRGBWscale (size_t rect_index, size_t rect_count, size_t col, size_t row, size_t row_space) |
|
void | printDirectHex (size_t rect_index, size_t rect_count, size_t col, size_t row, size_t row_space) |
|
void | printRGB (size_t rect_index, size_t rect_count, size_t col, size_t row, size_t row_space) |
|
void | printRGB_DirHx (size_t rect_index, size_t rect_count, size_t col, size_t row, size_t row_space) |
|
void | screen_test_disp_mem_init (screen_t *screen) |
|
void | screen_test_disp_mem_done (screen_t *screen) |
|
void | screen_test_disp_mem_draw (screen_t *screen) |
|
int | screen_test_disp_mem_event (screen_t *screen, window_t *window, uint8_t event, void *param) |
|
|
int16_t | spi_prescaler |
|
static const char * | opt_spi [] = { "21M", "10.5M", "5.25M", "2.63M", "1.31M", "656k", "328k", "164k" } |
|
static const char * | modes [] = { "RGBW scale", "WrRdWr + RGB" } |
|
static const char * | inversions [] = { "Inv. DIS.", "Inv. ENA." } |
|
static const char * | bright_enas [] = { "Bri. DIS.", "Bri. ENA." } |
|
static int16_t | spinSpiClkVal_last = -1 |
|
static int16_t | spinSpiClkVal_actual = -1 |
|
static int16_t | mode = 0 |
|
static int16_t | user_value = 0 |
|
static int16_t | row2draw |
|
static uint8_t | clrR = 0 |
|
static uint8_t | clrG = 0 |
|
static uint8_t | clrB = 0 |
|
static int16_t | gamma_last = -1 |
|
static int16_t | gamma_actual = -1 |
|
static int16_t | brightness_last = -1 |
|
static int16_t | brightness_actual = -1 |
|
static int8_t | isInverted_last = -1 |
|
static int8_t | isInverted_actual = -1 |
|
static int8_t | isBrightness_ena_last = -1 |
|
static int8_t | isBrightness_ena_actual = -1 |
|
drawCol_t * | fptrArr [] = { printRGBWscale, printRGB_DirHx } |
|
uint16_t | directColorBuff [directColorBuff_sz] |
|
screen_t | screen_test_disp_mem |
|
const screen_t * | pscreen_test_disp_mem = &screen_test_disp_mem |
|
◆ pd
◆ opt_spi_sz
◆ modes_sz
#define modes_sz (sizeof(modes) / sizeof(const char *)) |
◆ inversions_sz
◆ bright_enas_sz
◆ fptrArr_sz
◆ RECT_MACRO
◆ directColorBuff_sz
#define directColorBuff_sz 20 |
◆ drawCol_t
typedef void() drawCol_t(size_t rect_index, size_t rect_count, size_t col, size_t row2draw, size_t row_space) |
◆ anonymous enum
◆ anonymous enum
Enumerator |
---|
col_0_w | |
col_1_w | |
◆ anonymous enum
◆ anonymous enum
Enumerator |
---|
TAG_QUIT | |
TAG_BRIGHTNESS | |
◆ sim_heater_temp2val()
int sim_heater_temp2val |
( |
float |
temp | ) |
|
◆ window_list_spi_item()
void window_list_spi_item |
( |
window_list_t * |
pwindow_list, |
|
|
uint16_t |
index, |
|
|
const char ** |
pptext, |
|
|
uint16_t * |
pid_icon |
|
) |
| |
102 *pptext = (
char *)
opt_spi[index];
104 *pptext =
"Index ERROR";
◆ window_list_modes_item()
void window_list_modes_item |
( |
window_list_t * |
pwindow_list, |
|
|
uint16_t |
index, |
|
|
const char ** |
pptext, |
|
|
uint16_t * |
pid_icon |
|
) |
| |
111 *pptext = (
char *)
modes[index];
113 *pptext =
"Index ERROR";
◆ window_list_inversions_item()
void window_list_inversions_item |
( |
window_list_t * |
pwindow_list, |
|
|
uint16_t |
index, |
|
|
const char ** |
pptext, |
|
|
uint16_t * |
pid_icon |
|
) |
| |
122 *pptext =
"Index ERROR";
◆ window_list_bright_enas_item()
void window_list_bright_enas_item |
( |
window_list_t * |
pwindow_list, |
|
|
uint16_t |
index, |
|
|
const char ** |
pptext, |
|
|
uint16_t * |
pid_icon |
|
) |
| |
131 *pptext =
"Index ERROR";
◆ drawCol()
void drawCol |
( |
size_t |
col, |
|
|
size_t |
row, |
|
|
size_t |
len, |
|
|
uint16_t |
directColor |
|
) |
| |
364 for (
size_t i = 0;
i < len; ++
i) {
◆ drawCol_buff()
void drawCol_buff |
( |
size_t |
col, |
|
|
size_t |
row, |
|
|
size_t |
len, |
|
|
uint16_t * |
directColorBuff |
|
) |
| |
370 for (
size_t i = 0;
i < len; ++
i) {
◆ readCol()
void readCol |
( |
size_t |
col, |
|
|
size_t |
row, |
|
|
size_t |
len, |
|
|
uint16_t * |
directColorBuff |
|
) |
| |
377 for (
size_t i = 0;
i < len; ++
i) {
◆ draw_read_drawCol()
void draw_read_drawCol |
( |
size_t |
col, |
|
|
size_t |
row, |
|
|
size_t |
row_space, |
|
|
size_t |
len, |
|
|
uint16_t |
directColor, |
|
|
uint16_t * |
directColorBuff |
|
) |
| |
383 drawCol(col, row, len, directColor);
◆ draw_read_drawRect()
void draw_read_drawRect |
( |
size_t |
col, |
|
|
size_t |
row, |
|
|
size_t |
len, |
|
|
size_t |
w, |
|
|
uint16_t |
directColor, |
|
|
uint16_t * |
directColorBuff |
|
) |
| |
◆ dispRamTest_NextCol()
size_t dispRamTest_NextCol |
( |
size_t |
row_pos, |
|
|
size_t |
rect_w, |
|
|
size_t |
rect_space, |
|
|
size_t |
rect_count, |
|
|
size_t |
border_w |
|
) |
| |
478 const size_t col_pos_end = border_w + rect_count * rect_w + (rect_count - 1) * rect_space;
481 if (col_pos >= col_pos_end)
483 if (col_pos < border_w)
486 if (
_getRectIndex(col_pos, rect_w, rect_space, border_w) == -1)
487 col_pos += rect_space;
◆ _getRectIndex()
int _getRectIndex |
( |
size_t |
col_x, |
|
|
size_t |
rect_w, |
|
|
size_t |
rect_space, |
|
|
size_t |
border_w |
|
) |
| |
493 size_t mod = col_x % (rect_w + rect_space);
494 size_t div = col_x / (rect_w + rect_space);
◆ dispRamTest()
void dispRamTest |
( |
size_t |
test_ID, |
|
|
size_t |
row |
|
) |
| |
455 const size_t rect_w = 12;
456 const size_t rect_space = 1;
457 const size_t rect_count = 16;
458 const size_t border_w = (
display->
w - (rect_w + rect_space) * rect_count) / 2;
459 const size_t row_space = 1;
460 const uint32_t ttl = 45;
462 static size_t col_pos = -1;
463 static uint32_t start_time = 0;
470 size_t rect_index =
_getRectIndex(col_pos, rect_w, rect_space, border_w);
473 fptrArr[test_ID](rect_index, rect_count, col_pos, row, row_space);
◆ printRGBWscale()
void printRGBWscale |
( |
size_t |
rect_index, |
|
|
size_t |
rect_count, |
|
|
size_t |
col, |
|
|
size_t |
row, |
|
|
size_t |
row_space |
|
) |
| |
412 uint32_t val = 0xff * rect_index / rect_count;
◆ printDirectHex()
void printDirectHex |
( |
size_t |
rect_index, |
|
|
size_t |
rect_count, |
|
|
size_t |
col, |
|
|
size_t |
row, |
|
|
size_t |
row_space |
|
) |
| |
◆ printRGB()
void printRGB |
( |
size_t |
rect_index, |
|
|
size_t |
rect_count, |
|
|
size_t |
col, |
|
|
size_t |
row, |
|
|
size_t |
row_space |
|
) |
| |
◆ printRGB_DirHx()
void printRGB_DirHx |
( |
size_t |
rect_index, |
|
|
size_t |
rect_count, |
|
|
size_t |
col, |
|
|
size_t |
row, |
|
|
size_t |
row_space |
|
) |
| |
◆ screen_test_disp_mem_init()
252 int16_t w_of_0x = 23;
253 int16_t col =
col_1 + w_of_0x;
290 int16_t w_of_0xX = 48;
291 int16_t RGBspaceW = 5;
◆ screen_test_disp_mem_done()
◆ screen_test_disp_mem_draw()
◆ screen_test_disp_mem_event()
535 switch ((
int)param) {
◆ spi_prescaler
◆ opt_spi
const char* opt_spi[] = { "21M", "10.5M", "5.25M", "2.63M", "1.31M", "656k", "328k", "164k" } |
|
static |
◆ modes
const char* modes[] = { "RGBW scale", "WrRdWr + RGB" } |
|
static |
◆ inversions
const char* inversions[] = { "Inv. DIS.", "Inv. ENA." } |
|
static |
◆ bright_enas
const char* bright_enas[] = { "Bri. DIS.", "Bri. ENA." } |
|
static |
◆ spinSpiClkVal_last
int16_t spinSpiClkVal_last = -1 |
|
static |
◆ spinSpiClkVal_actual
int16_t spinSpiClkVal_actual = -1 |
|
static |
◆ mode
◆ user_value
◆ row2draw
◆ clrR
◆ clrG
◆ clrB
◆ gamma_last
◆ gamma_actual
int16_t gamma_actual = -1 |
|
static |
◆ brightness_last
int16_t brightness_last = -1 |
|
static |
◆ brightness_actual
int16_t brightness_actual = -1 |
|
static |
◆ isInverted_last
int8_t isInverted_last = -1 |
|
static |
◆ isInverted_actual
int8_t isInverted_actual = -1 |
|
static |
◆ isBrightness_ena_last
int8_t isBrightness_ena_last = -1 |
|
static |
◆ isBrightness_ena_actual
int8_t isBrightness_ena_actual = -1 |
|
static |
◆ fptrArr
◆ directColorBuff
◆ screen_test_disp_mem
◆ pscreen_test_disp_mem
int window_get_item_index(int16_t id)
Definition: window.c:623
void printDirectHex(size_t rect_index, size_t rect_count, size_t col, size_t row, size_t row_space)
Definition: screen_test_disp_mem.c:434
static const char * inversions[]
Definition: screen_test_disp_mem.c:74
void st7789v_set_pixel_directColor(point_ui16_t pt, uint16_t noClr)
Definition: st7789v.c:383
static int8_t isBrightness_ena_last
Definition: screen_test_disp_mem.c:96
void st7789v_gamma_set(uint8_t gamma)
static uint8_t clrR
Definition: screen_test_disp_mem.c:86
void dispRamTest(size_t test_ID, size_t row)
Definition: screen_test_disp_mem.c:452
void st7789v_brightness_disable(void)
void readCol(size_t col, size_t row, size_t len, uint16_t *directColorBuff)
Definition: screen_test_disp_mem.c:376
void screen_test_disp_mem_init(screen_t *screen)
Definition: screen_test_disp_mem.c:179
drawCol_t * fptrArr[]
Definition: screen_test_disp_mem.c:159
void sys_spi_set_prescaler(int prescaler_num)
Definition: sys.cpp:230
float window_get_value(int16_t id)
Definition: window.c:390
static const char * modes[]
Definition: screen_test_disp_mem.c:71
static int16_t gamma_actual
Definition: screen_test_disp_mem.c:91
void window_set_format(int16_t id, const char *format)
Definition: window.c:403
int screen_test_disp_mem_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_test_disp_mem.c:533
static uint8_t clrB
Definition: screen_test_disp_mem.c:88
Definition: screen_test_disp_mem.c:166
#define COLOR_RED
Definition: guitypes.h:42
static rect_ui16_t rect_ui16(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
Definition: guitypes.h:159
void window_destroy(int16_t id)
Definition: window.c:132
#define IDR_FNT_NORMAL
Definition: resource.h:10
uint8_t i
Definition: screen_test_graph.c:72
Definition: screen_test_disp_mem.c:170
void window_list_spi_item(window_list_t *pwindow_list, uint16_t index, const char **pptext, uint16_t *pid_icon)
Definition: screen_test_disp_mem.c:99
static int16_t spinSpiClkVal_actual
Definition: screen_test_disp_mem.c:81
uint16_t st7789v_get_pixel_directColor(point_ui16_t pt)
Definition: st7789v.c:422
void draw_read_drawCol(size_t col, size_t row, size_t row_space, size_t len, uint16_t directColor, uint16_t *directColorBuff)
Definition: screen_test_disp_mem.c:382
static int16_t spinSpiClkVal_last
Definition: screen_test_disp_mem.c:80
#define F(str)
Definition: UHS_macros.h:164
Definition: screen_test_disp_mem.c:169
uint16_t directColorBuff[directColorBuff_sz]
Definition: screen_test_disp_mem.c:408
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
Definition: stm32f4xx_hal.c:339
void screen_close(void)
Definition: screen.c:80
Definition: screen_test_disp_mem.c:22
static int16_t brightness_actual
Definition: screen_test_disp_mem.c:93
#define modes_sz
Definition: screen_test_disp_mem.c:72
#define WINDOW_CLS_LIST
Definition: window.h:13
#define RECT_MACRO(col)
Definition: screen_test_disp_mem.c:171
void window_set_text(int16_t id, const char *text)
Definition: window.c:340
#define opt_spi_sz
Definition: screen_test_disp_mem.c:68
#define WINDOW_CLS_SPIN
Definition: window.h:15
#define COLOR_GREEN
Definition: guitypes.h:53
static const char * opt_spi[]
Definition: screen_test_disp_mem.c:67
#define WINDOW_FLG_NUMB_FLOAT2INT
Definition: window_numb.h:8
#define WINDOW_CLS_FRAME
Definition: window.h:9
void window_set_value(int16_t id, float value)
Definition: window.c:363
void window_list_bright_enas_item(window_list_t *pwindow_list, uint16_t index, const char **pptext, uint16_t *pid_icon)
Definition: screen_test_disp_mem.c:126
static int16_t gamma_last
Definition: screen_test_disp_mem.c:90
void() drawCol_t(size_t rect_index, size_t rect_count, size_t col, size_t row2draw, size_t row_space)
Definition: screen_test_disp_mem.c:157
void window_set_tag(int16_t id, uint8_t tag)
Definition: window.c:329
void st7789v_inversion_on(void)
uint8_t st7789v_brightness_get(void)
static int16_t user_value
Definition: screen_test_disp_mem.c:83
const uint8_t[]
Definition: 404_html.c:3
static int8_t isBrightness_ena_actual
Definition: screen_test_disp_mem.c:97
#define IDR_FNT_BIG
Definition: resource.h:11
Definition: screen_test_disp_mem.c:167
display_t * display
Definition: display.c:6
#define COLOR_BLUE
Definition: guitypes.h:45
int _getRectIndex(size_t col_x, size_t rect_w, size_t rect_space, size_t border_w)
Definition: screen_test_disp_mem.c:491
Definition: screen_test_disp_mem.c:174
#define WINDOW_CLS_TEXT
Definition: window.h:10
#define pd
Definition: screen_test_disp_mem.c:63
static int8_t isInverted_last
Definition: screen_test_disp_mem.c:94
font_t * resource_font(uint16_t id)
Definition: guitypes.c:186
#define WINDOW_EVENT_CLICK
Definition: window.h:46
int16_t window_create_ptr(int16_t cls_id, int16_t id_parent, rect_ui16_t rect, void *ptr)
Definition: window.c:102
void window_enable(int16_t id)
Definition: window.c:517
void drawCol(size_t col, size_t row, size_t len, uint16_t directColor)
Definition: screen_test_disp_mem.c:363
uint8_t st7789v_gamma_get(void)
Definition: screen_test_disp_mem.c:175
void window_list_inversions_item(window_list_t *pwindow_list, uint16_t index, const char **pptext, uint16_t *pid_icon)
Definition: screen_test_disp_mem.c:117
void window_set_min_max_step(int16_t id, float min, float max, float step)
Definition: window.c:767
uint16_t w
Definition: display.h:25
void screen_test_disp_mem_draw(screen_t *screen)
Definition: screen_test_disp_mem.c:530
Definition: screen_test_disp_mem.c:168
#define WINDOW_EVENT_LOOP
Definition: window.h:49
static color_t color_rgb(uint8_t r, uint8_t g, uint8_t b)
Definition: guitypes.h:128
uint32_t color_t
Definition: guitypes.h:62
#define bright_enas_sz
Definition: screen_test_disp_mem.c:78
static const char * bright_enas[]
Definition: screen_test_disp_mem.c:77
void st7789v_brightness_set(uint8_t brightness)
void printRGB(size_t rect_index, size_t rect_count, size_t col, size_t row, size_t row_space)
Definition: screen_test_disp_mem.c:438
void window_set_item_count(int16_t id, int count)
Definition: window.c:573
static int8_t isInverted_actual
Definition: screen_test_disp_mem.c:95
static uint8_t clrG
Definition: screen_test_disp_mem.c:87
static int16_t mode
Definition: screen_test_disp_mem.c:82
void st7789v_inversion_off(void)
void window_set_item_callback(int16_t id, window_list_item_t *fnc)
Definition: window.c:787
void window_set_item_index(int16_t id, int index)
Definition: window.c:598
void drawCol_buff(size_t col, size_t row, size_t len, uint16_t *directColorBuff)
Definition: screen_test_disp_mem.c:369
display_draw_line_t * draw_line
Definition: display.h:31
#define directColorBuff_sz
Definition: screen_test_disp_mem.c:407
static int16_t row2draw
Definition: screen_test_disp_mem.c:84
void window_set_color_text(int16_t id, color_t clr)
Definition: window.c:457
size_t dispRamTest_NextCol(size_t row_pos, size_t rect_w, size_t rect_space, size_t rect_count, size_t border_w)
Definition: screen_test_disp_mem.c:477
static int16_t brightness_last
Definition: screen_test_disp_mem.c:92
void screen_test_disp_mem_done(screen_t *screen)
Definition: screen_test_disp_mem.c:526
static point_ui16_t point_ui16(uint16_t x, uint16_t y)
Definition: guitypes.h:154
#define inversions_sz
Definition: screen_test_disp_mem.c:75
void st7789v_brightness_enable(void)
void window_list_modes_item(window_list_t *pwindow_list, uint16_t index, const char **pptext, uint16_t *pid_icon)
Definition: screen_test_disp_mem.c:108