oled_common.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. #include "stm32g4xx_hal.h"
  2. #include "oled_common.h"
  3. #include "oled_config.h"
  4. #include "config.h"
  5. #include "i2c_bridge.h"
  6. #include "spi_bridge.h"
  7. #include "logo_grayscale.h"
  8. #include "fonts.h"
  9. #include "SSD1327.h"
  10. #include "cmsis_os.h"
  11. #include <string.h>
  12. #include <stdio.h>
  13. extern "C" {
  14. #include "GFX_SSD1327.h"
  15. #include "GUI_Paint.h"
  16. #include "fonts.h"
  17. #include "fonts_old.h"
  18. #include "oled_config.h"
  19. }
  20. #if defined(I2C_BRIDGE)
  21. I2C_HandleTypeDef *i2c_bridge;
  22. #elif defined(SPI_BRIDGE)
  23. SPI_HandleTypeDef *spi_bridge;
  24. #endif
  25. uint8_t oled_buf[OLED_BUF_SIZE];
  26. //
  27. void init_oled(void)
  28. {
  29. init_gpio_oled();
  30. oled_reset();
  31. #if defined(I2C_BRIDGE)
  32. i2c_bridge_init();
  33. i2c_bridge = i2c_get_bridge();
  34. #elif defined(SPI_BRIDGE)
  35. spi_bridge_init();
  36. spi_bridge = spi_get_bridge();
  37. #endif
  38. oled_init();
  39. Paint_NewImage(oled_buf, OLED_WIDTH, OLED_HEIGHT, 0, BLACK);
  40. Paint_SetScale(16);
  41. Paint_SelectImage(oled_buf);
  42. oled_clear(BLACK);
  43. #if 0
  44. test_oled();
  45. while(1) {}
  46. #endif
  47. oled_display();
  48. }
  49. //
  50. void init_gpio_oled(void)
  51. {
  52. GPIO_InitTypeDef GPIO_InitStruct = {0};
  53. __HAL_RCC_GPIOA_CLK_ENABLE();
  54. // GPIOA_5 - reset
  55. GPIO_InitStruct.Pin = OLED_RST_PIN;
  56. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  57. GPIO_InitStruct.Pull = GPIO_NOPULL;
  58. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  59. HAL_GPIO_Init(OLED_RST_PORT, &GPIO_InitStruct);
  60. // GPIOA_6 - DC
  61. GPIO_InitStruct.Pin = OLED_DC_PIN;
  62. HAL_GPIO_Init(OLED_DC_PORT, &GPIO_InitStruct);
  63. HAL_GPIO_WritePin(OLED_RST_PORT, OLED_RST_PIN, GPIO_PIN_RESET);
  64. #if defined(I2C_BRIDGE)
  65. HAL_GPIO_WritePin(OLED_DC_PORT, OLED_DC_PIN, GPIO_PIN_SET);
  66. #elif defined(SPI_BRIDGE)
  67. HAL_GPIO_WritePin(OLED_DC_PORT, OLED_DC_PIN, GPIO_PIN_RESET);
  68. #endif
  69. }
  70. //
  71. void oled_reset(void)
  72. {
  73. OLED_RST_1;
  74. oled_delay_ms(100);
  75. OLED_RST_0;
  76. oled_delay_ms(100);
  77. OLED_RST_1;
  78. oled_delay_ms(100);
  79. }
  80. //
  81. void oled_delay_ms(uint32_t ms)
  82. {
  83. osDelay(ms);
  84. }
  85. // TODO убрать sizeof
  86. void oled_command(uint8_t com)
  87. {
  88. #ifdef I2C_BRIDGE
  89. HAL_I2C_Mem_Write(i2c_bridge, OLED_I2C_ADDR, 0x00, 1, &com, sizeof(com), 100);
  90. #endif
  91. #ifdef SPI_BRIDGE
  92. OLED_DC_0;
  93. OLED_CS_0;
  94. HAL_SPI_Transmit(spi_bridge, &com, 1, 10);
  95. OLED_CS_1;
  96. #endif
  97. }
  98. // TODO убрать sizeof
  99. void oled_data(uint8_t dat)
  100. {
  101. #ifdef I2C_BRIDGE
  102. HAL_I2C_Mem_Write(i2c_bridge, OLED_I2C_ADDR, 0x40, 1, &dat, sizeof(dat), 100);
  103. #endif
  104. #ifdef SPI_BRIDGE
  105. OLED_DC_1;
  106. OLED_CS_0;
  107. HAL_SPI_Transmit(spi_bridge, &dat, 1, 10);
  108. OLED_CS_1;
  109. #endif
  110. }
  111. //
  112. void oled_display(void)
  113. {
  114. oled_command(SSD1327_SETCOLUMNADDRESS);
  115. oled_command(0x00);
  116. oled_command(0x3F);
  117. oled_command(SSD1327_SETROWADDRESS);
  118. oled_command(0x00);
  119. oled_command(0x7F);
  120. #ifdef I2C_BRIDGE
  121. HAL_I2C_Mem_Write(i2c_bridge, OLED_I2C_ADDR, 0x40, 1, (uint8_t*)&oled_buf, OLED_BUF_SIZE, 1000);
  122. #endif
  123. #ifdef SPI_BRIDGE
  124. OLED_DC_1;
  125. OLED_CS_0;
  126. HAL_SPI_Transmit(spi_bridge, (uint8_t*)&oled_buf, OLED_BUF_SIZE, 100);
  127. OLED_CS_1;
  128. #endif
  129. }
  130. //
  131. void oled_bitmap(uint8_t *bitmap)
  132. {
  133. oled_command(0x22);
  134. oled_command(0x00);
  135. oled_command(0x07);
  136. #ifdef I2C_BRIDGE
  137. HAL_I2C_Mem_Write(i2c_bridge, OLED_I2C_ADDR, 0x40, 1, bitmap, (OLED_HEIGHT * OLED_WIDTH / 8), 100);
  138. #endif
  139. #ifdef SPI_BRIDGE
  140. OLED_DC_1;
  141. OLED_CS_0;
  142. HAL_SPI_Transmit(spi_bridge, bitmap, (OLED_HEIGHT * OLED_WIDTH / 8), 100);
  143. OLED_CS_1;
  144. #endif
  145. }
  146. //
  147. void oled_invert_colors(uint8_t invert)
  148. {
  149. oled_command(invert ? SSD1327_INVERTDISPLAY : SSD1327_NORMALDISPLAY);
  150. }
  151. //
  152. void oled_rotate_display(uint8_t rotate)
  153. {
  154. if (rotate > 1) rotate = 1;
  155. oled_command(0xA0 | (0x01 & rotate)); // Set Segment Re-Map Default
  156. // 0xA0 (0x00) => column Address 0 mapped to 127
  157. // 0xA1 (0x01) => Column Address 127 mapped to 0
  158. oled_command(0xC0 | (0x08 & (rotate<<3))); // Set COM Output Scan Direction
  159. // 0xC0 (0x00) => normal mode (RESET) Scan from COM0 to COM[N-1];Where N is the Multiplex ratio.
  160. // 0xC8 (0xC8) => remapped mode. Scan from COM[N-1] to COM0;;Where N is the Multiplex ratio.
  161. }
  162. //
  163. void oled_display_on(uint8_t on)
  164. {
  165. oled_command(on ? SSD1327_DISPLAYON : SSD1327_DISPLAYOFF);
  166. }
  167. //
  168. void oled_set_contrast(uint8_t contrast)
  169. {
  170. oled_command(SSD1327_SETCONTRASTCURRENT); // Set Contrast Control
  171. oled_command(contrast);
  172. }
  173. //
  174. void oled_start_scroll_right(uint8_t start_page, uint8_t end_page, uint8_t speed)
  175. {
  176. oled_command(SSD1327_RIGHT_HORIZONTAL_SCROLL);
  177. oled_command(0x00);
  178. oled_command(start_page);
  179. oled_command(speed);
  180. oled_command(end_page);
  181. oled_command(SSD1327_ACTIVATE_SCROLL);
  182. }
  183. //
  184. void oled_start_scroll_left(uint8_t start_page, uint8_t end_page, uint8_t speed)
  185. {
  186. oled_command(SSD1327_LEFT_HORIZONTAL_SCROLL);
  187. oled_command(0x00);
  188. oled_command(start_page);
  189. oled_command(speed);
  190. oled_command(end_page);
  191. oled_command(SSD1327_ACTIVATE_SCROLL);
  192. }
  193. //
  194. void oled_stop_scroll(void)
  195. {
  196. oled_command(SSD1327_DEACTIVATE_SCROLL);
  197. }
  198. //
  199. void oled_init(void)
  200. {
  201. oled_command(0xae);//--turn off oled panel
  202. oled_command(0x15); // set column address
  203. oled_command(0x00); // start column 0
  204. oled_command(0x7f); // end column 127
  205. oled_command(0x75); // set row address
  206. oled_command(0x00); // start row 0
  207. oled_command(0x7f); // end row 127
  208. oled_command(0x81); // set contrast control
  209. oled_command(0x80);
  210. oled_command(0xa0); // gment remap
  211. oled_command(0x51); //51
  212. oled_command(0xa1); // start line
  213. oled_command(0x00);
  214. oled_command(0xa2); // display offset
  215. oled_command(0x00);
  216. oled_command(0xa4); // rmal display
  217. oled_command(0xa8); // set multiplex ratio
  218. oled_command(0x7f);
  219. oled_command(0xb1); // set phase leghth
  220. oled_command(0xf1);
  221. oled_command(0xb3); // set dclk
  222. oled_command(0x00); //80Hz:0xc1 90Hz:0xe1 100Hz:0x00 110Hz:0x30 120Hz:0x50 130Hz:0x70 01
  223. oled_command(0xab); //
  224. oled_command(0x01); //
  225. oled_command(0xb6); // set phase leghth
  226. oled_command(0x0f);
  227. oled_command(0xbe);
  228. oled_command(0x0f);
  229. oled_command(0xbc);
  230. oled_command(0x08);
  231. oled_command(0xd5);
  232. oled_command(0x62);
  233. oled_command(0xfd);
  234. oled_command(0x12);
  235. oled_display_on(1);
  236. #if 0
  237. // Рабочий вариант
  238. oled_command(0xae);//--turn off oled panel
  239. oled_command(0x15); // set column address
  240. oled_command(0x00); // start column 0
  241. oled_command(0x7f); // end column 127
  242. oled_command(0x75); // set row address
  243. oled_command(0x00); // start row 0
  244. oled_command(0x7f); // end row 127
  245. oled_command(0x81); // set contrast control
  246. oled_command(0x80);
  247. oled_command(0xa0); // gment remap
  248. oled_command(0x51); //51
  249. oled_command(0xa1); // start line
  250. oled_command(0x00);
  251. oled_command(0xa2); // display offset
  252. oled_command(0x00);
  253. oled_command(0xa4); // rmal display
  254. oled_command(0xa8); // set multiplex ratio
  255. oled_command(0x7f);
  256. oled_command(0xb1); // set phase leghth
  257. oled_command(0xf1);
  258. oled_command(0xb3); // set dclk
  259. oled_command(0x00); //80Hz:0xc1 90Hz:0xe1 100Hz:0x00 110Hz:0x30 120Hz:0x50 130Hz:0x70 01
  260. oled_command(0xab); //
  261. oled_command(0x01); //
  262. oled_command(0xb6); // set phase leghth
  263. oled_command(0x0f);
  264. oled_command(0xbe);
  265. oled_command(0x0f);
  266. oled_command(0xbc);
  267. oled_command(0x08);
  268. oled_command(0xd5);
  269. oled_command(0x62);
  270. oled_command(0xfd);
  271. oled_command(0x12);
  272. oled_display_on(1);
  273. #endif
  274. #if 0
  275. oled_command(SSD1327_DISPLAYOFF); // Display Off
  276. oled_command(SSD1327_SETCOLUMNADDRESS);
  277. oled_command(0x00);
  278. oled_command(0x7F);
  279. oled_command(SSD1327_SETROWADDRESS);
  280. oled_command(0x00);
  281. oled_command(0x7F);
  282. oled_set_contrast(0x7F);
  283. oled_command(SSD1327_SEGREMAP);
  284. oled_command(0x51);
  285. oled_command(SSD1327_SETDISPLAYSTARTLINE);
  286. oled_command(0x00);
  287. oled_command(SSD1327_SETDISPLAYOFFSET);
  288. oled_command(0x0);
  289. oled_command(SSD1327_DISPLAYALLON_RESUME); // Entire Display ON
  290. oled_command(SSD1327_SETMULTIPLEX);
  291. oled_command(0x7F);
  292. oled_command(SSD1327_SETPHASELENGTH);
  293. oled_command(0xF1); // !
  294. oled_command(SSD1327_SETFRONTCLOCKDIVIDER_OSCILLATORFREQUENCY);
  295. oled_command(0x00);
  296. oled_command(SSD1327_FUNCTIONSELECTIONA); // !
  297. oled_command(0x01); // !
  298. oled_command(SSD1327_SETSECONDPRECHARGEPERTIOD);
  299. oled_command(0x0F); // !
  300. oled_command(SSD1327_SETSETVCOMVOLTAGE);
  301. oled_command(0x0F); // !
  302. oled_command(SSD1327_SETPRECHARGEVOLTAGE);
  303. oled_command(0x08); // !
  304. oled_command(SSD1327_FUNCTIONSELECTIONB);
  305. oled_command(0x62);
  306. oled_command(SSD1327_SETCOMMANDLOCK); // !
  307. oled_command(0x12); // !
  308. oled_display_on(1);
  309. #endif
  310. }
  311. //
  312. void oled_draw_pixel(int16_t x, int16_t y, uint8_t color)
  313. {
  314. if ((x < 0) || (x >= OLED_WIDTH) || (y < 0) || (y >= OLED_HEIGHT))
  315. return;
  316. uint8_t SelectedCell = oled_buf[x/2 + y*(OLED_WIDTH/2)];
  317. if(x % 2)
  318. {
  319. SelectedCell &= ~(0x0F);
  320. SelectedCell |= (0x0F & color);
  321. }
  322. else
  323. {
  324. SelectedCell &= ~(0xF0);
  325. SelectedCell |= (0xF0 & (color<<4));
  326. }
  327. oled_buf[x/2 + y*(OLED_WIDTH/2)] = SelectedCell;
  328. }
  329. //
  330. void oled_clear(uint8_t color)
  331. {
  332. if (color > WHITE) color = WHITE;
  333. memset(oled_buf, (color << 4 | color), OLED_BUF_SIZE);
  334. }
  335. //
  336. void oled_dma_end_callback(SPI_HandleTypeDef *hspi)
  337. {
  338. #if defined(SPI_BRIDGE)
  339. if (hspi == spi_bridge) {
  340. OLED_CS_1;
  341. }
  342. #endif
  343. }
  344. // ------------------------------------------------------------------------------- //
  345. //
  346. void oled_draw_rec(int x_start, int y_start, int x_end, int y_end, uint8_t color)
  347. {
  348. for (int i = 0; i < y_end; i++) {
  349. GFX_DrawLine(x_start, y_start + i, x_end, y_start + i, color);
  350. }
  351. GFX_DrawLine(x_start, y_end, x_end, y_end, color);
  352. }
  353. #define STR_H 20
  354. #define STR_Y_S 36
  355. #define STR_FRAME_START_Y 8
  356. #define STR_X_S 4
  357. #define STR_X_E 123
  358. //
  359. void oled_draw_string_frame(uint8_t str_num)
  360. {
  361. for (int i = 0; i < 2; i++) {
  362. // нижняя
  363. GFX_DrawLine(STR_X_S, str_num*STR_H + STR_Y_S + i, STR_X_E, str_num*STR_H + STR_Y_S + i, 15);
  364. // верхняя
  365. GFX_DrawLine(STR_X_S, str_num*STR_H + STR_Y_S - STR_H + i, STR_X_E, str_num*STR_H + STR_Y_S - STR_H + i, 15);
  366. }
  367. // Правая
  368. GFX_DrawLine(STR_X_E, str_num*STR_H + STR_Y_S, STR_X_E, str_num*STR_H + STR_Y_S - STR_H, 15);
  369. // Левая
  370. GFX_DrawLine(STR_X_S, str_num*STR_H + STR_Y_S, STR_X_S, str_num*STR_H + STR_Y_S - STR_H, 15);
  371. }
  372. //
  373. void oled_frame(uint8_t str_y, bool double_str)
  374. {
  375. // Двойная строка
  376. if (double_str) {
  377. GFX_DrawRoundRectangle(0, str_y - FRAME_BORDER, 127, 2*MENU_STR_HEIGHT - FRAME_BORDER, 3, 15);
  378. }
  379. else {
  380. GFX_DrawRoundRectangle(0, str_y - FRAME_BORDER, 127, MENU_STR_HEIGHT, 3, 15);
  381. }
  382. }
  383. // Выравнивание по правому краю.
  384. // Формирует строку, дополненную пробелами слева
  385. void oled_int_right_alignment(int value, uint8_t char_num, char *out)
  386. {
  387. char buf[20];
  388. memset(buf, 0, 20);
  389. sprintf(buf, "%i", value);
  390. strncpy(out, " ", char_num - strlen(buf));
  391. strcat(out, buf);
  392. }
  393. // Выравнивание по правому краю с размерностью
  394. // Формирует строку, дополненную пробелами слева с постфиксом
  395. void oled_int_right_alignment_post(int value, uint8_t char_num, char *postfix, char *out)
  396. {
  397. char buf[20];
  398. memset(buf, 0, 20);
  399. sprintf(buf, "%i", value);
  400. strncpy(out, " ", char_num - strlen(buf) - strlen(postfix));
  401. strcat(out, buf);
  402. strcat(out, postfix);
  403. }
  404. //
  405. void oled_float_right_aligment(float value, uint8_t char_num, char *out)
  406. {
  407. char buf[20];
  408. memset(buf, 0, 20);
  409. sprintf(buf, "%.2f", value);
  410. strncpy(out, " ", char_num - strlen(buf));
  411. strcat(out, buf);
  412. }
  413. //
  414. void test_oled_old(void)
  415. {
  416. #if 0
  417. for (int i = 0; i < 16; i++) {
  418. SSD1327_DrawPixel(10, 20 + i, i);
  419. }
  420. SSD1327_DrawPixel(20, 20, 15);
  421. SSD1327_DrawPixel(30, 20, 15);
  422. SSD1327_DrawPixel(40, 20, 5);
  423. #endif
  424. //void GFX_DrawLine(int x_start, int y_start, int x_end, int y_end, uint8_t color);
  425. // Верхняя
  426. GFX_DrawLine(0, 0, 127, 0, 15);
  427. // Левая
  428. GFX_DrawLine(0, 0, 0, 127, 15);
  429. // Правая
  430. GFX_DrawLine(127, 0, 127, 127, 15);
  431. // Нижняя
  432. GFX_DrawLine(0, 127, 127, 127, 15);
  433. //GFX_SetFont(font_8x5);
  434. GFX_SetFontSize(1);
  435. GFX_DrawString(4, 10, (char*)"BbAa12345", 15, 0);
  436. GFX_SetFontSize(2);
  437. GFX_DrawString(4, 30, (char*)"BbAa12345", 15, 0);
  438. GFX_SetFontSize(3);
  439. GFX_DrawString(4, 60, (char*)"BbAa12345", 15, 0);
  440. oled_display();
  441. }
  442. //
  443. void test_oled(void)
  444. {
  445. //void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_FillWay);
  446. #if 1
  447. //OLED_1in5_B_Clear();
  448. Paint_NewImage(oled_buf, OLED_WIDTH, OLED_HEIGHT, 0, BLACK);
  449. Paint_SetScale(16);
  450. // 1.Select Image
  451. Paint_SelectImage(oled_buf);
  452. Paint_Clear(BLACK);
  453. while (1)
  454. {
  455. /*
  456. Paint_DrawPoint(20, 10, WHITE, DOT_PIXEL_1X1, DOT_STYLE_DFT);
  457. Paint_DrawPoint(30, 10, WHITE, DOT_PIXEL_2X2, DOT_STYLE_DFT);
  458. Paint_DrawPoint(40, 10, WHITE, DOT_PIXEL_3X3, DOT_STYLE_DFT);
  459. Paint_DrawLine(10, 10, 10, 20, WHITE, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
  460. Paint_DrawLine(20, 20, 20, 30, WHITE, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
  461. Paint_DrawLine(30, 30, 30, 40, WHITE, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
  462. Paint_DrawLine(40, 40, 40, 50, WHITE, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
  463. Paint_DrawCircle(60, 30, 15, WHITE, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
  464. Paint_DrawCircle(100, 40, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
  465. Paint_DrawRectangle(50, 30, 60, 40, WHITE, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
  466. Paint_DrawRectangle(90, 30, 110, 50, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
  467. oled_display();
  468. osDelay(2000);
  469. //Paint_Clear(BLACK);
  470. oled_clear(BLACK);
  471. oled_display();
  472. osDelay(2000);
  473. */
  474. #if 0
  475. Paint_DrawString_EN(10, 0, "waveshare", &Font16, 0x1, 0xb);
  476. Paint_DrawString_EN(10, 17, "hello world", &Font8, 0x2, 0xc);
  477. Paint_DrawNum(10, 30, 123.456789, &Font8, 4, 0x3, 0xd);
  478. Paint_DrawNum(10, 43, 987654, &Font12, 5, 0x4, 0xe);
  479. #endif
  480. Paint_DrawString_EN(10, 0, "waveshare", &Font16, 0xf, 0x0);
  481. Paint_DrawString_EN(10, 17, "hello world", &Font8, 0xf, 0x0);
  482. Paint_DrawNum(10, 30, 123.456789, &Font8, 4, 0xf, 0x0);
  483. Paint_DrawNum(10, 43, 987654, &Font12, 5, 0xf, 0x0);
  484. Paint_DrawString_EN(10, 60, "hello world", &Font8, 0xf, 0x0);
  485. // ----------------------------------------------------------------------- //
  486. // Другая либа
  487. //font_8x13
  488. GFX_SetFont(font_8x5);
  489. GFX_SetFontSize(1);
  490. GFX_DrawString(8, 80, (char*)"12345", 15, 0);
  491. GFX_SetFont(font_8x13);
  492. GFX_SetFontSize(1);
  493. GFX_DrawString(8, 100, (char*)"12345", 15, 0);
  494. //void GFX_DrawRoundRectangle(int x, int y, uint16_t w, uint16_t h, uint16_t r, uint8_t color)
  495. // Скругленная рамка и логотип
  496. GFX_DrawRoundRectangle(0, 0, 127, 127, 5, 15);
  497. Paint_DrawString_EN(45, 120, "Fly Electronics", &Font8, 0xf, 0x0);
  498. oled_display();
  499. }
  500. //Paint_DrawPoint(40, 40, WHITE, DOT_PIXEL_8X8, DOT_FILL_AROUND);
  501. //void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend,
  502. // UWORD Color, DOT_PIXEL Line_width, LINE_STYLE Line_Style)
  503. Paint_DrawLine(10, 10, 10, 20, WHITE, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
  504. Paint_DrawString_EN(10, 17, "hello world", &Font8, 0x2, 0xc);
  505. #endif
  506. #if 0
  507. GFX_SetFont(Font8_Table);
  508. GFX_SetFontSize(1);
  509. //GFX_SetFont(font_8x13);
  510. ///GFX_SetFontSize(1);
  511. GFX_DrawString(8, 20, (char*)"Hellow world", 15, 0);
  512. #endif
  513. oled_display();
  514. }