eth_view_process.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. #pragma once
  2. #include "eth_worker.h"
  3. #include "eth_save_process.h"
  4. #include <gui/gui.h>
  5. #define SCREEN_SYMBOLS_WIDTH 30
  6. EthViewProcess* ethernet_view_process_malloc(EthWorkerProcess type, EthernetSaveConfig* config);
  7. void ethernet_view_process_free(EthViewProcess* evp);
  8. void ethernet_view_process_draw(EthViewProcess* process, Canvas* canvas);
  9. void ethernet_view_process_keyevent(EthViewProcess* process, InputKey key);
  10. void ethernet_view_process_print(EthViewProcess* process, const char* str);
  11. void ethernet_view_process_move(EthViewProcess* process, int8_t shift);
  12. void evp_printf(EthViewProcess* process, const char* format, ...);
  13. typedef struct u8x8_struct u8x8_t;
  14. typedef struct u8x8_display_info_struct u8x8_display_info_t;
  15. typedef struct u8x8_tile_struct u8x8_tile_t;
  16. typedef uint8_t (*u8x8_msg_cb)(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr);
  17. typedef uint16_t (*u8x8_char_cb)(u8x8_t* u8x8, uint8_t b);
  18. struct u8x8_struct {
  19. const u8x8_display_info_t* display_info;
  20. u8x8_char_cb next_cb;
  21. u8x8_msg_cb display_cb;
  22. u8x8_msg_cb cad_cb;
  23. u8x8_msg_cb byte_cb;
  24. u8x8_msg_cb gpio_and_delay_cb;
  25. uint32_t bus_clock;
  26. const uint8_t* font;
  27. uint16_t encoding;
  28. uint8_t x_offset;
  29. uint8_t is_font_inverse_mode;
  30. uint8_t
  31. i2c_address;
  32. uint8_t i2c_started;
  33. uint8_t utf8_state;
  34. uint8_t gpio_result;
  35. uint8_t debounce_default_pin_state;
  36. uint8_t debounce_last_pin_state;
  37. uint8_t debounce_state;
  38. uint8_t debounce_result_msg;
  39. };
  40. typedef uint8_t u8g2_uint_t;
  41. typedef int8_t u8g2_int_t;
  42. typedef int16_t u8g2_long_t;
  43. typedef struct u8g2_struct u8g2_t;
  44. typedef struct u8g2_cb_struct u8g2_cb_t;
  45. typedef void (*u8g2_update_dimension_cb)(u8g2_t* u8g2);
  46. typedef void (*u8g2_update_page_win_cb)(u8g2_t* u8g2);
  47. typedef void (
  48. *u8g2_draw_l90_cb)(u8g2_t* u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, uint8_t dir);
  49. typedef void (*u8g2_draw_ll_hvline_cb)(
  50. u8g2_t* u8g2,
  51. u8g2_uint_t x,
  52. u8g2_uint_t y,
  53. u8g2_uint_t len,
  54. uint8_t dir);
  55. typedef uint8_t (*u8g2_get_kerning_cb)(u8g2_t* u8g2, uint16_t e1, uint16_t e2);
  56. struct _u8g2_font_info_t {
  57. uint8_t glyph_cnt;
  58. uint8_t bbx_mode;
  59. uint8_t bits_per_0;
  60. uint8_t bits_per_1;
  61. uint8_t bits_per_char_width;
  62. uint8_t bits_per_char_height;
  63. uint8_t bits_per_char_x;
  64. uint8_t bits_per_char_y;
  65. uint8_t bits_per_delta_x;
  66. int8_t max_char_width;
  67. int8_t
  68. max_char_height;
  69. int8_t x_offset;
  70. int8_t y_offset;
  71. int8_t ascent_A;
  72. int8_t descent_g;
  73. int8_t ascent_para;
  74. int8_t descent_para;
  75. uint16_t start_pos_upper_A;
  76. uint16_t start_pos_lower_a;
  77. };
  78. typedef struct _u8g2_font_info_t u8g2_font_info_t;
  79. struct _u8g2_font_decode_t {
  80. const uint8_t* decode_ptr;
  81. u8g2_uint_t target_x;
  82. u8g2_uint_t target_y;
  83. int8_t x;
  84. int8_t y;
  85. int8_t glyph_width;
  86. int8_t glyph_height;
  87. uint8_t decode_bit_pos;
  88. uint8_t is_transparent;
  89. uint8_t fg_color;
  90. uint8_t bg_color;
  91. };
  92. typedef struct _u8g2_font_decode_t u8g2_font_decode_t;
  93. struct _u8g2_kerning_t {
  94. uint16_t first_table_cnt;
  95. uint16_t second_table_cnt;
  96. const uint16_t* first_encoding_table;
  97. const uint16_t* index_to_second_table;
  98. const uint16_t* second_encoding_table;
  99. const uint8_t* kerning_values;
  100. };
  101. typedef struct _u8g2_kerning_t u8g2_kerning_t;
  102. struct u8g2_cb_struct {
  103. u8g2_update_dimension_cb update_dimension;
  104. u8g2_update_page_win_cb update_page_win;
  105. u8g2_draw_l90_cb draw_l90;
  106. };
  107. typedef u8g2_uint_t (*u8g2_font_calc_vref_fnptr)(u8g2_t* u8g2);
  108. struct u8g2_struct {
  109. u8x8_t u8x8;
  110. u8g2_draw_ll_hvline_cb ll_hvline;
  111. const u8g2_cb_t* cb;
  112. uint8_t*
  113. tile_buf_ptr;
  114. uint8_t tile_buf_height;
  115. uint8_t tile_curr_row;
  116. u8g2_uint_t pixel_buf_width;
  117. u8g2_uint_t pixel_buf_height;
  118. u8g2_uint_t pixel_curr_row;
  119. u8g2_uint_t buf_y0;
  120. u8g2_uint_t buf_y1;
  121. u8g2_uint_t width;
  122. u8g2_uint_t height;
  123. u8g2_uint_t user_x0;
  124. u8g2_uint_t user_x1;
  125. u8g2_uint_t user_y0;
  126. u8g2_uint_t user_y1;
  127. const uint8_t* font;
  128. u8g2_font_calc_vref_fnptr font_calc_vref;
  129. u8g2_font_decode_t font_decode;
  130. u8g2_font_info_t font_info;
  131. uint8_t font_height_mode;
  132. int8_t font_ref_ascent;
  133. int8_t font_ref_descent;
  134. int8_t glyph_x_offset;
  135. uint8_t bitmap_transparency;
  136. uint8_t draw_color;
  137. uint8_t is_auto_page_clear;
  138. };
  139. typedef struct EthViewProcessLine {
  140. char data[SCREEN_SYMBOLS_WIDTH];
  141. } EthViewProcessLine;
  142. struct EthViewProcess {
  143. EthViewProcessLine* fifo;
  144. EthWorkerProcess type;
  145. uint8_t strings_cnt;
  146. uint8_t carriage;
  147. uint8_t position;
  148. uint8_t autofill;
  149. uint8_t editing;
  150. uint8_t x;
  151. uint8_t y;
  152. void* draw_struct;
  153. };
  154. typedef struct EthViewDrawInit {
  155. uint8_t* mac;
  156. uint8_t current_octet;
  157. } EthViewDrawInit;
  158. typedef enum {
  159. EthViewDrawStaticModeIp,
  160. EthViewDrawStaticModeMask,
  161. EthViewDrawStaticModeGateway,
  162. EthViewDrawStaticModeDNS
  163. } EthViewDrawStaticMode;
  164. typedef struct EthViewDrawStatic {
  165. EthViewDrawStaticMode current_mode;
  166. uint8_t* ip;
  167. uint8_t* mask;
  168. uint8_t* gateway;
  169. uint8_t* dns;
  170. uint8_t current_digit;
  171. uint8_t editing;
  172. } EthViewDrawStatic;
  173. typedef struct EthViewDrawPing {
  174. uint8_t current_digit;
  175. uint8_t* ip;
  176. } EthViewDrawPing;