Prusa MINI Firmware overview
screen_test_disp_mem.c File Reference
#include "gui.h"
#include "config.h"
#include "window_logo.h"
#include "stm32f4xx_hal.h"
#include "st7789v.h"
#include "sys.h"
#include <assert.h>

Classes

struct  screen_test_disp_mem_data_t
 

Macros

#define pd   ((screen_test_disp_mem_data_t *)screen->pdata)
 
#define opt_spi_sz   (sizeof(opt_spi) / sizeof(const char *))
 
#define modes_sz   (sizeof(modes) / sizeof(const char *))
 
#define inversions_sz   (sizeof(inversions) / sizeof(const char *))
 
#define bright_enas_sz   (sizeof(bright_enas) / sizeof(const char *))
 
#define fptrArr_sz   (sizeof(fptrArr) / sizeof(drawCol_t *))
 
#define RECT_MACRO(col)   rect_ui16(col_##col, row2draw, col_##col##_w, row_h)
 
#define directColorBuff_sz   20
 

Typedefs

typedef void() drawCol_t(size_t rect_index, size_t rect_count, size_t col, size_t row2draw, size_t row_space)
 

Enumerations

enum  { col_0 = 2, col_1 = 96 }
 
enum  { col_0_w = col_1 - col_0, col_1_w = 240 - col_1 - col_0 }
 
enum  { col_2_w = 38 }
 
enum  { TAG_QUIT = 10, TAG_BRIGHTNESS }
 

Functions

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)
 

Variables

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_tfptrArr [] = { printRGBWscale, printRGB_DirHx }
 
uint16_t directColorBuff [directColorBuff_sz]
 
screen_t screen_test_disp_mem
 
const screen_tpscreen_test_disp_mem = &screen_test_disp_mem
 

Macro Definition Documentation

◆ pd

#define pd   ((screen_test_disp_mem_data_t *)screen->pdata)

◆ opt_spi_sz

#define opt_spi_sz   (sizeof(opt_spi) / sizeof(const char *))

◆ modes_sz

#define modes_sz   (sizeof(modes) / sizeof(const char *))

◆ inversions_sz

#define inversions_sz   (sizeof(inversions) / sizeof(const char *))

◆ bright_enas_sz

#define bright_enas_sz   (sizeof(bright_enas) / sizeof(const char *))

◆ fptrArr_sz

#define fptrArr_sz   (sizeof(fptrArr) / sizeof(drawCol_t *))

◆ RECT_MACRO

#define RECT_MACRO (   col)    rect_ui16(col_##col, row2draw, col_##col##_w, row_h)

◆ directColorBuff_sz

#define directColorBuff_sz   20

Typedef Documentation

◆ drawCol_t

typedef void() drawCol_t(size_t rect_index, size_t rect_count, size_t col, size_t row2draw, size_t row_space)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
col_0 
col_1 
166  { col_0 = 2,
167  col_1 = 96 };

◆ anonymous enum

anonymous enum
Enumerator
col_0_w 
col_1_w 
168  { col_0_w = col_1 - col_0,
169  col_1_w = 240 - col_1 - col_0 };

◆ anonymous enum

anonymous enum
Enumerator
col_2_w 
170 { col_2_w = 38 };

◆ anonymous enum

anonymous enum
Enumerator
TAG_QUIT 
TAG_BRIGHTNESS 
173  {
174  TAG_QUIT = 10,
176 
177 };

Function Documentation

◆ 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 
)
100  {
101  if (index < opt_spi_sz)
102  *pptext = (char *)opt_spi[index];
103  else
104  *pptext = "Index ERROR";
105  *pid_icon = 0;
106 }
Here is the caller graph for this function:

◆ window_list_modes_item()

void window_list_modes_item ( window_list_t pwindow_list,
uint16_t  index,
const char **  pptext,
uint16_t *  pid_icon 
)
109  {
110  if (index < modes_sz)
111  *pptext = (char *)modes[index];
112  else
113  *pptext = "Index ERROR";
114  *pid_icon = 0;
115 }
Here is the caller graph for this function:

◆ window_list_inversions_item()

void window_list_inversions_item ( window_list_t pwindow_list,
uint16_t  index,
const char **  pptext,
uint16_t *  pid_icon 
)
118  {
119  if (index < inversions_sz)
120  *pptext = (char *)inversions[index];
121  else
122  *pptext = "Index ERROR";
123  *pid_icon = 0;
124 }
Here is the caller graph for this function:

◆ 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 
)
127  {
128  if (index < bright_enas_sz)
129  *pptext = (char *)bright_enas[index];
130  else
131  *pptext = "Index ERROR";
132  *pid_icon = 0;
133 }
Here is the caller graph for this function:

◆ drawCol()

void drawCol ( size_t  col,
size_t  row,
size_t  len,
uint16_t  directColor 
)
363  {
364  for (size_t i = 0; i < len; ++i) {
365  st7789v_set_pixel_directColor(point_ui16(col, row + i), directColor);
366  }
367 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawCol_buff()

void drawCol_buff ( size_t  col,
size_t  row,
size_t  len,
uint16_t *  directColorBuff 
)
369  {
370  for (size_t i = 0; i < len; ++i) {
372  }
373 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readCol()

void readCol ( size_t  col,
size_t  row,
size_t  len,
uint16_t *  directColorBuff 
)
376  {
377  for (size_t i = 0; i < len; ++i) {
379  }
380 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 
)
382  {
383  drawCol(col, row, len, directColor);
384  readCol(col, row, len, directColorBuff);
385  drawCol_buff(col, row + len + row_space, len, directColorBuff);
386 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 
)
477  {
478  const size_t col_pos_end = border_w + rect_count * rect_w + (rect_count - 1) * rect_space;
479 
480  ++col_pos;
481  if (col_pos >= col_pos_end)
482  return border_w;
483  if (col_pos < border_w)
484  return border_w;
485 
486  if (_getRectIndex(col_pos, rect_w, rect_space, border_w) == -1)
487  col_pos += rect_space;
488  return col_pos;
489 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _getRectIndex()

int _getRectIndex ( size_t  col_x,
size_t  rect_w,
size_t  rect_space,
size_t  border_w 
)
491  {
492  col_x -= border_w;
493  size_t mod = col_x % (rect_w + rect_space);
494  size_t div = col_x / (rect_w + rect_space);
495  if (mod >= rect_w)
496  return -1;
497  return div;
498 }
Here is the caller graph for this function:

◆ dispRamTest()

void dispRamTest ( size_t  test_ID,
size_t  row 
)
452  {
453  //const size_t wr_rows = 20;
454 
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; //time to live
461 
462  static size_t col_pos = -1;
463  static uint32_t start_time = 0;
464 
465  start_time = HAL_GetTick();
466 
467  //ttl check - to be responsive
468  while (start_time + ttl >= HAL_GetTick()) {
469  col_pos = dispRamTest_NextCol(col_pos, rect_w, rect_space, rect_count, border_w);
470  size_t rect_index = _getRectIndex(col_pos, rect_w, rect_space, border_w);
471 
472  if (test_ID < sizeof(fptrArr) / sizeof(drawCol_t *))
473  fptrArr[test_ID](rect_index, rect_count, col_pos, row, row_space);
474  }
475 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ printRGBWscale()

void printRGBWscale ( size_t  rect_index,
size_t  rect_count,
size_t  col,
size_t  row,
size_t  row_space 
)
410  {
411  color_t clr;
412  uint32_t val = 0xff * rect_index / rect_count;
413 
414  //R
415  clr = color_rgb(val, 0, 0);
416  display->draw_line(point_ui16(col, row), point_ui16(col, row + directColorBuff_sz), clr);
417 
418  //G
419  clr = color_rgb(0, val, 0);
420  row += directColorBuff_sz + row_space;
421  display->draw_line(point_ui16(col, row), point_ui16(col, row + directColorBuff_sz), clr);
422 
423  //B
424  clr = color_rgb(0, 0, val);
425  row += directColorBuff_sz + row_space;
426  display->draw_line(point_ui16(col, row), point_ui16(col, row + directColorBuff_sz), clr);
427 
428  //W
429  clr = color_rgb(val, val, val);
430  row += directColorBuff_sz + row_space;
431  display->draw_line(point_ui16(col, row), point_ui16(col, row + directColorBuff_sz), clr);
432 }
Here is the call graph for this function:

◆ printDirectHex()

void printDirectHex ( size_t  rect_index,
size_t  rect_count,
size_t  col,
size_t  row,
size_t  row_space 
)
434  {
436 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ printRGB()

void printRGB ( size_t  rect_index,
size_t  rect_count,
size_t  col,
size_t  row,
size_t  row_space 
)
438  {
439  color_t clr = color_rgb(clrR, clrG, clrB);
440  display->draw_line(point_ui16(col, row), point_ui16(col, row + directColorBuff_sz), clr);
441 
442  clr = color_rgb((uint8_t)(~clrR), (uint8_t)(~clrG), (uint8_t)(~clrB));
443  row += directColorBuff_sz + row_space;
444  display->draw_line(point_ui16(col, row), point_ui16(col, row + directColorBuff_sz), clr);
445 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ printRGB_DirHx()

void printRGB_DirHx ( size_t  rect_index,
size_t  rect_count,
size_t  col,
size_t  row,
size_t  row_space 
)
447  {
448  printDirectHex(rect_index, rect_count, col, row, row_space);
449  printRGB(rect_index, rect_count, col, row + 2 * (directColorBuff_sz + row_space), row_space);
450 }
Here is the call graph for this function:

◆ screen_test_disp_mem_init()

void screen_test_disp_mem_init ( screen_t screen)
179  {
180  row2draw = 0;
181  int16_t id;
182  int16_t row_h = 22; //item_height from list
183 
184  int16_t id0 = window_create_ptr(WINDOW_CLS_FRAME, -1, rect_ui16(0, 0, 0, 0), &(pd->frame));
185 
186  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(0, 0, display->w, 22), &(pd->textMenuName));
187  pd->textMenuName.font = resource_font(IDR_FNT_BIG);
188  window_set_text(id, (const char *)"Disp. TEST rd mem.");
189 
190  row2draw += 25;
191 
192  //write pattern
193  id = window_create_ptr(WINDOW_CLS_TEXT, id0, RECT_MACRO(0), &(pd->textMode));
194  pd->textMode.font = resource_font(IDR_FNT_NORMAL);
195  window_set_text(id, (const char *)"MODE");
196 
197  id = window_create_ptr(WINDOW_CLS_LIST, id0, RECT_MACRO(1), &(pd->spinMode));
199  window_set_item_index(id, 0);
201 
202  row2draw += 25;
203 
204  //clk setting
205  id = window_create_ptr(WINDOW_CLS_TEXT, id0, RECT_MACRO(0), &(pd->textSpiClk));
206  pd->textSpiClk.font = resource_font(IDR_FNT_NORMAL);
207  window_set_text(id, (const char *)"SPI clk");
208 
209  id = window_create_ptr(WINDOW_CLS_LIST, id0, RECT_MACRO(1), &(pd->spinSpiClk));
211  window_set_item_index(id, 0);
213 
214  row2draw += 25;
215 
216  //Gamma setting
217  id = window_create_ptr(WINDOW_CLS_TEXT, id0, RECT_MACRO(0), &(pd->textGamma));
218  pd->textMode.font = resource_font(IDR_FNT_NORMAL);
219  window_set_text(id, (const char *)"Gamma");
220 
221  id = window_create_ptr(WINDOW_CLS_SPIN, id0, rect_ui16(col_1, row2draw, col_2_w, row_h), &(pd->spinGamma));
222  window_set_format(id, "%1.0f");
223  window_set_min_max_step(id, 0.0F, 3.0F, 1.0F);
224  window_set_value(id, (float)st7789v_gamma_get());
225 
226  //INVERSION
227  id = window_create_ptr(WINDOW_CLS_LIST, id0, rect_ui16(col_1 + col_2_w, row2draw, col_1_w - col_2_w, row_h), &(pd->spinInversion));
229  window_set_item_index(id, 0);
231 
232  row2draw += 25;
233  //Brightness setting
234  id = window_create_ptr(WINDOW_CLS_TEXT, id0, RECT_MACRO(0), &(pd->textBrightness));
235  pd->textMode.font = resource_font(IDR_FNT_NORMAL);
236  window_set_text(id, (const char *)"Brightn.");
237 
238  id = window_create_ptr(WINDOW_CLS_SPIN, id0, rect_ui16(col_1, row2draw, col_2_w, row_h), &(pd->spinBrightness));
239  window_set_format(id, "%1.0f");
240  window_set_min_max_step(id, 0.0F, 255.0F, 5.0F);
243 
244  //Brightness enabled
245  id = window_create_ptr(WINDOW_CLS_LIST, id0, rect_ui16(col_1 + col_2_w, row2draw, col_1_w - col_2_w, row_h), &(pd->spinBrigt_ena));
247  window_set_item_index(id, 0);
250 
251  row2draw += 25;
252  int16_t w_of_0x = 23;
253  int16_t col = col_1 + w_of_0x;
254  int16_t offset = 12;
255  //user write pattern
256  id = window_create_ptr(WINDOW_CLS_TEXT, id0, RECT_MACRO(0), &(pd->textSpiUserPattern1));
257  pd->textMode.font = resource_font(IDR_FNT_NORMAL);
258  window_set_text(id, (const char *)"Wr-Rd-Wr");
259  id = window_create_ptr(WINDOW_CLS_TEXT, id0, RECT_MACRO(1), &(pd->text0x));
260  pd->textMode.font = resource_font(IDR_FNT_NORMAL);
261  window_set_text(id, (const char *)"0x");
262 
263  //cannot use normal spin with window_set_format(id, "%A");
264  id = window_create_ptr(WINDOW_CLS_SPIN, id0, rect_ui16(col, row2draw, offset, row_h), &(pd->spinStrHx3));
265  pd->spinStrHx3.window.win.flg |= WINDOW_FLG_NUMB_FLOAT2INT;
266  window_set_format(id, "%X");
267  window_set_min_max_step(id, 0.0F, 15.0F, 1.0F);
268  window_set_value(id, 0.0F);
269  col += offset;
270  id = window_create_ptr(WINDOW_CLS_SPIN, id0, rect_ui16(col, row2draw, offset, row_h), &(pd->spinStrHx2));
271  pd->spinStrHx2.window.win.flg |= WINDOW_FLG_NUMB_FLOAT2INT;
272  window_set_format(id, "%X");
273  window_set_min_max_step(id, 0.0F, 15.0F, 1.0F);
274  window_set_value(id, 0.0F);
275  col += offset;
276  id = window_create_ptr(WINDOW_CLS_SPIN, id0, rect_ui16(col, row2draw, offset, row_h), &(pd->spinStrHx1));
277  pd->spinStrHx1.window.win.flg |= WINDOW_FLG_NUMB_FLOAT2INT;
278  window_set_format(id, "%X");
279  window_set_min_max_step(id, 0.0F, 15.0F, 1.0F);
280  window_set_value(id, 0.0F);
281  col += offset;
282  id = window_create_ptr(WINDOW_CLS_SPIN, id0, rect_ui16(col, row2draw, offset, row_h), &(pd->spinStrHx0));
283  pd->spinStrHx0.window.win.flg |= WINDOW_FLG_NUMB_FLOAT2INT;
284  window_set_format(id, "%X");
285  window_set_min_max_step(id, 0.0F, 15.0F, 1.0F);
286  window_set_value(id, 0.0F);
287 
288  //write pixels
289  row2draw += 25;
290  int16_t w_of_0xX = 48;
291  int16_t RGBspaceW = 5;
292 
293  col = col_0;
294  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(col, row2draw, w_of_0xX, row_h), &(pd->textR0x));
295  pd->textMode.font = resource_font(IDR_FNT_NORMAL);
296  window_set_text(id, (const char *)"R 0x");
298 
299  col += w_of_0xX;
300  id = window_create_ptr(WINDOW_CLS_SPIN, id0, rect_ui16(col, row2draw, offset, row_h), &(pd->spinStrR0));
301  pd->spinStrR0.window.win.flg |= WINDOW_FLG_NUMB_FLOAT2INT;
302  window_set_format(id, "%X");
303  window_set_min_max_step(id, 0.0F, 15.0F, 1.0F);
304  window_set_value(id, 0.0F);
305 
306  col += offset;
307  id = window_create_ptr(WINDOW_CLS_SPIN, id0, rect_ui16(col, row2draw, offset, row_h), &(pd->spinStrR1));
308  pd->spinStrR1.window.win.flg |= WINDOW_FLG_NUMB_FLOAT2INT;
309  window_set_format(id, "%X");
310  window_set_min_max_step(id, 0.0F, 15.0F, 1.0F);
311  window_set_value(id, 0.0F);
312  col += offset;
313  col += RGBspaceW;
314 
315  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(col, row2draw, w_of_0xX, row_h), &(pd->textG0x));
316  pd->textMode.font = resource_font(IDR_FNT_NORMAL);
317  window_set_text(id, (const char *)"G 0x");
319 
320  col += w_of_0xX;
321  id = window_create_ptr(WINDOW_CLS_SPIN, id0, rect_ui16(col, row2draw, offset, row_h), &(pd->spinStrG0));
322  pd->spinStrG0.window.win.flg |= WINDOW_FLG_NUMB_FLOAT2INT;
323  window_set_format(id, "%X");
324  window_set_min_max_step(id, 0.0F, 15.0F, 1.0F);
325  window_set_value(id, 0.0F);
326  col += offset;
327  id = window_create_ptr(WINDOW_CLS_SPIN, id0, rect_ui16(col, row2draw, offset, row_h), &(pd->spinStrG1));
328  pd->spinStrG1.window.win.flg |= WINDOW_FLG_NUMB_FLOAT2INT;
329  window_set_format(id, "%X");
330  window_set_min_max_step(id, 0.0F, 15.0F, 1.0F);
331  window_set_value(id, 0.0F);
332  col += offset;
333  col += RGBspaceW;
334 
335  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(col, row2draw, w_of_0xX, row_h), &(pd->textB0x));
336  pd->textMode.font = resource_font(IDR_FNT_NORMAL);
337  window_set_text(id, (const char *)"B 0x");
339 
340  col += w_of_0xX;
341  id = window_create_ptr(WINDOW_CLS_SPIN, id0, rect_ui16(col, row2draw, offset, row_h), &(pd->spinStrB0));
342  pd->spinStrB0.window.win.flg |= WINDOW_FLG_NUMB_FLOAT2INT;
343  window_set_format(id, "%X");
344  window_set_min_max_step(id, 0.0F, 15.0F, 1.0F);
345  window_set_value(id, 0.0F);
346  col += offset;
347  id = window_create_ptr(WINDOW_CLS_SPIN, id0, rect_ui16(col, row2draw, offset, row_h), &(pd->spinStrB1));
348  pd->spinStrB1.window.win.flg |= WINDOW_FLG_NUMB_FLOAT2INT;
349  window_set_format(id, "%X");
350  window_set_min_max_step(id, 0.0F, 15.0F, 1.0F);
351  window_set_value(id, 0.0F);
352 
353  row2draw += 25; //position for drawing - it is global in this file
354 
355  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(col_0, 290, 60, 22), &(pd->textExit));
356  pd->textExit.font = resource_font(IDR_FNT_BIG);
357  window_set_text(id, (const char *)"EXIT");
358  window_enable(id);
360 }
Here is the call graph for this function:

◆ screen_test_disp_mem_done()

void screen_test_disp_mem_done ( screen_t screen)
526  {
527  window_destroy(pd->frame.win.id);
528 }
Here is the call graph for this function:

◆ screen_test_disp_mem_draw()

void screen_test_disp_mem_draw ( screen_t screen)
530  {
531 }

◆ screen_test_disp_mem_event()

int screen_test_disp_mem_event ( screen_t screen,
window_t window,
uint8_t  event,
void param 
)
533  {
534  if (event == WINDOW_EVENT_CLICK)
535  switch ((int)param) {
536  case TAG_QUIT:
537  screen_close();
538  return 1;
539  }
540  /*if (event == WINDOW_EVENT_CHANGE){
541  switch ((int)param){
542  case TAG_BRIGHTNESS:
543  isBrightness_ena_actual = window_get_item_index(pd->spinBrigt_ena.window.win.id);
544  //if(isBrightness_ena_actual!=isBrightness_ena_last)
545  {
546  if(isBrightness_ena_actual) st7789v_brightness_enable();
547  else st7789v_brightness_disable();
548  isBrightness_ena_last = isBrightness_ena_actual;
549  }
550 
551 
552  brightness_actual = window_get_item_index(pd->spinBrightness.window.win.id);
553  //if(brightness_actual!=brightness_last)
554  {
555  st7789v_brightness_set(brightness_actual);
556  brightness_last = brightness_actual;
557  }
558  break;
559  }
560 
561  }*/
562  if (event == WINDOW_EVENT_LOOP) {
563 
564  isBrightness_ena_actual = window_get_item_index(pd->spinBrigt_ena.win.id);
565  brightness_actual = window_get_value(pd->spinBrightness.window.win.id);
566 
570 
573  else
576  }
577 
578  mode = window_get_item_index(pd->spinMode.win.id);
579 
580  user_value = window_get_item_index(pd->spinStrHx0.window.win.id)
581  | ((window_get_item_index(pd->spinStrHx1.window.win.id)) << 4)
582  | ((window_get_item_index(pd->spinStrHx2.window.win.id)) << 8)
583  | ((window_get_item_index(pd->spinStrHx3.window.win.id)) << 12);
584 
585  clrR = (window_get_item_index(pd->spinStrR0.window.win.id) << 4) | window_get_item_index(pd->spinStrR1.window.win.id);
586  clrG = (window_get_item_index(pd->spinStrG0.window.win.id) << 4) | window_get_item_index(pd->spinStrG1.window.win.id);
587  clrB = (window_get_item_index(pd->spinStrB0.window.win.id) << 4) | window_get_item_index(pd->spinStrB1.window.win.id);
588 
589  gamma_actual = window_get_item_index(pd->spinGamma.window.win.id);
590  if (gamma_actual != gamma_last) {
593  }
594 
595  isInverted_actual = window_get_item_index(pd->spinInversion.win.id);
597  if (isInverted_actual)
599  else
602  }
603 
604  //check if spin changed
605  spinSpiClkVal_actual = window_get_item_index(pd->spinSpiClk.win.id);
609  //window_set_text(pd->numbSpiClk.win.id,(const char*)opt_spi[spinSpiClkVal_actual]);
610  }
611 
613  }
614 
615  return 0;
616 }
Here is the call graph for this function:

Variable Documentation

◆ spi_prescaler

int16_t 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

int16_t mode = 0
static

◆ user_value

int16_t user_value = 0
static

◆ row2draw

int16_t row2draw
static

◆ clrR

uint8_t clrR = 0
static

◆ clrG

uint8_t clrG = 0
static

◆ clrB

uint8_t clrB = 0
static

◆ gamma_last

int16_t gamma_last = -1
static

◆ 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

uint16_t directColorBuff[directColorBuff_sz]

◆ screen_test_disp_mem

◆ pscreen_test_disp_mem

const screen_t* pscreen_test_disp_mem = &screen_test_disp_mem
window_get_item_index
int window_get_item_index(int16_t id)
Definition: window.c:623
printDirectHex
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
inversions
static const char * inversions[]
Definition: screen_test_disp_mem.c:74
st7789v_set_pixel_directColor
void st7789v_set_pixel_directColor(point_ui16_t pt, uint16_t noClr)
Definition: st7789v.c:383
isBrightness_ena_last
static int8_t isBrightness_ena_last
Definition: screen_test_disp_mem.c:96
st7789v_gamma_set
void st7789v_gamma_set(uint8_t gamma)
clrR
static uint8_t clrR
Definition: screen_test_disp_mem.c:86
dispRamTest
void dispRamTest(size_t test_ID, size_t row)
Definition: screen_test_disp_mem.c:452
st7789v_brightness_disable
void st7789v_brightness_disable(void)
readCol
void readCol(size_t col, size_t row, size_t len, uint16_t *directColorBuff)
Definition: screen_test_disp_mem.c:376
screen_test_disp_mem_init
void screen_test_disp_mem_init(screen_t *screen)
Definition: screen_test_disp_mem.c:179
fptrArr
drawCol_t * fptrArr[]
Definition: screen_test_disp_mem.c:159
sys_spi_set_prescaler
void sys_spi_set_prescaler(int prescaler_num)
Definition: sys.cpp:230
window_get_value
float window_get_value(int16_t id)
Definition: window.c:390
modes
static const char * modes[]
Definition: screen_test_disp_mem.c:71
gamma_actual
static int16_t gamma_actual
Definition: screen_test_disp_mem.c:91
window_set_format
void window_set_format(int16_t id, const char *format)
Definition: window.c:403
screen_test_disp_mem_event
int screen_test_disp_mem_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_test_disp_mem.c:533
clrB
static uint8_t clrB
Definition: screen_test_disp_mem.c:88
col_0
Definition: screen_test_disp_mem.c:166
COLOR_RED
#define COLOR_RED
Definition: guitypes.h:42
rect_ui16
static rect_ui16_t rect_ui16(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
Definition: guitypes.h:159
window_destroy
void window_destroy(int16_t id)
Definition: window.c:132
IDR_FNT_NORMAL
#define IDR_FNT_NORMAL
Definition: resource.h:10
i
uint8_t i
Definition: screen_test_graph.c:72
col_2_w
Definition: screen_test_disp_mem.c:170
window_list_spi_item
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
spinSpiClkVal_actual
static int16_t spinSpiClkVal_actual
Definition: screen_test_disp_mem.c:81
st7789v_get_pixel_directColor
uint16_t st7789v_get_pixel_directColor(point_ui16_t pt)
Definition: st7789v.c:422
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)
Definition: screen_test_disp_mem.c:382
spinSpiClkVal_last
static int16_t spinSpiClkVal_last
Definition: screen_test_disp_mem.c:80
F
#define F(str)
Definition: UHS_macros.h:164
col_1_w
Definition: screen_test_disp_mem.c:169
directColorBuff
uint16_t directColorBuff[directColorBuff_sz]
Definition: screen_test_disp_mem.c:408
HAL_GetTick
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
Definition: stm32f4xx_hal.c:339
screen_close
void screen_close(void)
Definition: screen.c:80
screen_test_disp_mem_data_t
Definition: screen_test_disp_mem.c:22
brightness_actual
static int16_t brightness_actual
Definition: screen_test_disp_mem.c:93
modes_sz
#define modes_sz
Definition: screen_test_disp_mem.c:72
WINDOW_CLS_LIST
#define WINDOW_CLS_LIST
Definition: window.h:13
RECT_MACRO
#define RECT_MACRO(col)
Definition: screen_test_disp_mem.c:171
window_set_text
void window_set_text(int16_t id, const char *text)
Definition: window.c:340
opt_spi_sz
#define opt_spi_sz
Definition: screen_test_disp_mem.c:68
WINDOW_CLS_SPIN
#define WINDOW_CLS_SPIN
Definition: window.h:15
COLOR_GREEN
#define COLOR_GREEN
Definition: guitypes.h:53
opt_spi
static const char * opt_spi[]
Definition: screen_test_disp_mem.c:67
WINDOW_FLG_NUMB_FLOAT2INT
#define WINDOW_FLG_NUMB_FLOAT2INT
Definition: window_numb.h:8
WINDOW_CLS_FRAME
#define WINDOW_CLS_FRAME
Definition: window.h:9
window_set_value
void window_set_value(int16_t id, float value)
Definition: window.c:363
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)
Definition: screen_test_disp_mem.c:126
gamma_last
static int16_t gamma_last
Definition: screen_test_disp_mem.c:90
drawCol_t
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
window_set_tag
void window_set_tag(int16_t id, uint8_t tag)
Definition: window.c:329
st7789v_inversion_on
void st7789v_inversion_on(void)
st7789v_brightness_get
uint8_t st7789v_brightness_get(void)
user_value
static int16_t user_value
Definition: screen_test_disp_mem.c:83
uint8_t
const uint8_t[]
Definition: 404_html.c:3
isBrightness_ena_actual
static int8_t isBrightness_ena_actual
Definition: screen_test_disp_mem.c:97
IDR_FNT_BIG
#define IDR_FNT_BIG
Definition: resource.h:11
col_1
Definition: screen_test_disp_mem.c:167
display
display_t * display
Definition: display.c:6
COLOR_BLUE
#define COLOR_BLUE
Definition: guitypes.h:45
_getRectIndex
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
TAG_QUIT
Definition: screen_test_disp_mem.c:174
WINDOW_CLS_TEXT
#define WINDOW_CLS_TEXT
Definition: window.h:10
pd
#define pd
Definition: screen_test_disp_mem.c:63
isInverted_last
static int8_t isInverted_last
Definition: screen_test_disp_mem.c:94
resource_font
font_t * resource_font(uint16_t id)
Definition: guitypes.c:186
WINDOW_EVENT_CLICK
#define WINDOW_EVENT_CLICK
Definition: window.h:46
window_create_ptr
int16_t window_create_ptr(int16_t cls_id, int16_t id_parent, rect_ui16_t rect, void *ptr)
Definition: window.c:102
window_enable
void window_enable(int16_t id)
Definition: window.c:517
drawCol
void drawCol(size_t col, size_t row, size_t len, uint16_t directColor)
Definition: screen_test_disp_mem.c:363
st7789v_gamma_get
uint8_t st7789v_gamma_get(void)
TAG_BRIGHTNESS
Definition: screen_test_disp_mem.c:175
window_list_inversions_item
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
window_set_min_max_step
void window_set_min_max_step(int16_t id, float min, float max, float step)
Definition: window.c:767
_display_t::w
uint16_t w
Definition: display.h:25
screen_test_disp_mem_draw
void screen_test_disp_mem_draw(screen_t *screen)
Definition: screen_test_disp_mem.c:530
col_0_w
Definition: screen_test_disp_mem.c:168
WINDOW_EVENT_LOOP
#define WINDOW_EVENT_LOOP
Definition: window.h:49
color_rgb
static color_t color_rgb(uint8_t r, uint8_t g, uint8_t b)
Definition: guitypes.h:128
color_t
uint32_t color_t
Definition: guitypes.h:62
bright_enas_sz
#define bright_enas_sz
Definition: screen_test_disp_mem.c:78
bright_enas
static const char * bright_enas[]
Definition: screen_test_disp_mem.c:77
st7789v_brightness_set
void st7789v_brightness_set(uint8_t brightness)
printRGB
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
window_set_item_count
void window_set_item_count(int16_t id, int count)
Definition: window.c:573
isInverted_actual
static int8_t isInverted_actual
Definition: screen_test_disp_mem.c:95
clrG
static uint8_t clrG
Definition: screen_test_disp_mem.c:87
mode
static int16_t mode
Definition: screen_test_disp_mem.c:82
st7789v_inversion_off
void st7789v_inversion_off(void)
window_set_item_callback
void window_set_item_callback(int16_t id, window_list_item_t *fnc)
Definition: window.c:787
window_set_item_index
void window_set_item_index(int16_t id, int index)
Definition: window.c:598
drawCol_buff
void drawCol_buff(size_t col, size_t row, size_t len, uint16_t *directColorBuff)
Definition: screen_test_disp_mem.c:369
_display_t::draw_line
display_draw_line_t * draw_line
Definition: display.h:31
directColorBuff_sz
#define directColorBuff_sz
Definition: screen_test_disp_mem.c:407
row2draw
static int16_t row2draw
Definition: screen_test_disp_mem.c:84
window_set_color_text
void window_set_color_text(int16_t id, color_t clr)
Definition: window.c:457
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)
Definition: screen_test_disp_mem.c:477
brightness_last
static int16_t brightness_last
Definition: screen_test_disp_mem.c:92
screen_test_disp_mem_done
void screen_test_disp_mem_done(screen_t *screen)
Definition: screen_test_disp_mem.c:526
point_ui16
static point_ui16_t point_ui16(uint16_t x, uint16_t y)
Definition: guitypes.h:154
inversions_sz
#define inversions_sz
Definition: screen_test_disp_mem.c:75
st7789v_brightness_enable
void st7789v_brightness_enable(void)
window_list_modes_item
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