GUIDEMO_Intro.c 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*********************************************************************
  2. * Portions COPYRIGHT 2016 STMicroelectronics *
  3. * Portions SEGGER Microcontroller GmbH & Co. KG *
  4. * Solutions for real time microcontroller applications *
  5. **********************************************************************
  6. * *
  7. * (c) 1996 - 2015 SEGGER Microcontroller GmbH & Co. KG *
  8. * *
  9. * Internet: www.segger.com Support: support@segger.com *
  10. * *
  11. **********************************************************************
  12. ** emWin V5.28 - Graphical user interface for embedded applications **
  13. All Intellectual Property rights in the Software belongs to SEGGER.
  14. emWin is protected by international copyright laws. Knowledge of the
  15. source code may not be used to write a similar product. This file may
  16. only be used in accordance with the following terms:
  17. The software has been licensed to STMicroelectronics International
  18. N.V. a Dutch company with a Swiss branch and its headquarters in Plan-
  19. les-Ouates, Geneva, 39 Chemin du Champ des Filles, Switzerland for the
  20. purposes of creating libraries for ARM Cortex-M-based 32-bit microcon_
  21. troller products commercialized by Licensee only, sublicensed and dis_
  22. tributed under the terms and conditions of the End User License Agree_
  23. ment supplied by STMicroelectronics International N.V.
  24. Full source code is available at: www.segger.com
  25. We appreciate your understanding and fairness.
  26. ----------------------------------------------------------------------
  27. File : GUIDEMO_Intro.c
  28. Purpose : Introduction for emWin generic demo
  29. (This is also a good file to demo and explain basic
  30. emWin features by setting breakpoints)
  31. ----------------------------------------------------------------------
  32. */
  33. /**
  34. ******************************************************************************
  35. * @file GUIDEMO_Intro.c
  36. * @author MCD Application Team
  37. * @brief Introduction for emWin generic demo
  38. ******************************************************************************
  39. * @attention
  40. *
  41. * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
  42. * All rights reserved.</center></h2>
  43. *
  44. * Redistribution and use in source and binary forms, with or without
  45. * modification, are permitted, provided that the following conditions are met:
  46. *
  47. * 1. Redistribution of source code must retain the above copyright notice,
  48. * this list of conditions and the following disclaimer.
  49. * 2. Redistributions in binary form must reproduce the above copyright notice,
  50. * this list of conditions and the following disclaimer in the documentation
  51. * and/or other materials provided with the distribution.
  52. * 3. Neither the name of STMicroelectronics nor the names of other
  53. * contributors to this software may be used to endorse or promote products
  54. * derived from this software without specific written permission.
  55. * 4. This software, including modifications and/or derivative works of this
  56. * software, must execute solely and exclusively on microcontroller or
  57. * microprocessor devices manufactured by or for STMicroelectronics.
  58. * 5. Redistribution and use of this software other than as permitted under
  59. * this license is void and will automatically terminate your rights under
  60. * this license.
  61. *
  62. * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
  63. * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
  64. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  65. * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
  66. * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
  67. * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  68. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  69. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  70. * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  71. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  72. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  73. * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  74. *
  75. ******************************************************************************
  76. */
  77. #include <string.h>
  78. #include "GUIDEMO.h"
  79. /*********************************************************************
  80. *
  81. * Defines
  82. */
  83. #define SCREEN_DIV 6 // 2^6 = 64
  84. #define FACTOR_EMWIN 4
  85. #define FACTOR_DESC 11
  86. #define FACTOR_ANY_COMP 22
  87. #define FACTOR_VERSION 31
  88. #define FACTOR_LOGO 38
  89. #define FACTOR_WWW 56
  90. #define DIST_ANY_COMP 18
  91. /*********************************************************************
  92. *
  93. * GUIDEMO_Intro
  94. *
  95. **********************************************************************
  96. */
  97. void GUIDEMO_Intro(void) {
  98. char acVersion[30] = "Version of STemWin: ";
  99. int xCenter, xSize, ySize;
  100. xSize = LCD_GetXSize();
  101. ySize = LCD_GetYSize();
  102. xCenter = xSize >> 1;
  103. GUIDEMO_DrawBk(0);
  104. GUI_SetTextMode(GUI_TM_TRANS);
  105. //
  106. // emWin
  107. //
  108. GUI_SetColor(GUI_WHITE);
  109. GUI_SetFont(&GUI_FontRounded22);
  110. GUI_DispStringHCenterAt("STemWin", xCenter, (FACTOR_EMWIN * ySize) >> SCREEN_DIV);
  111. //
  112. // emWin description
  113. //
  114. GUI_SetFont(&GUI_Font16_ASCII);
  115. GUI_DispStringHCenterAt("Universal graphic software\nfor embedded applications", xCenter, (FACTOR_DESC * ySize) >> SCREEN_DIV);
  116. //
  117. // Any text
  118. //
  119. GUI_SetColor(0x2288ff);
  120. GUI_DispStringHCenterAt("For STM32 MCU Products - Cortex M3 - Cortex M4", xCenter, (FACTOR_ANY_COMP * ySize) >> SCREEN_DIV);
  121. //
  122. // Compiled
  123. //
  124. GUI_SetFont(&GUI_Font10S_ASCII);
  125. GUI_DispStringHCenterAt("Compiled " __DATE__ " "__TIME__, xCenter, ((FACTOR_ANY_COMP * ySize) >> SCREEN_DIV) + DIST_ANY_COMP);
  126. //
  127. // Version
  128. //
  129. GUI_SetColor(GUI_WHITE);
  130. GUI_SetFont(&GUI_Font16_ASCII);
  131. strcat(acVersion, GUI_GetVersionString());
  132. GUI_DispStringHCenterAt(acVersion, xCenter, (FACTOR_VERSION * ySize) >> SCREEN_DIV);
  133. //
  134. // Logo
  135. //
  136. GUI_DrawBitmap(&bmSTLogo, (xSize - bmSeggerLogo.XSize) >> 1, (FACTOR_LOGO * ySize) >> SCREEN_DIV);
  137. //
  138. // www.segger.com
  139. //
  140. GUI_SetColor(GUI_WHITE);
  141. GUI_SetFont(&GUI_FontRounded22);
  142. GUI_DispStringHCenterAt("www.st.com/stm32", xCenter, (FACTOR_WWW * ySize) >> SCREEN_DIV);
  143. GUIDEMO_Delay(5000);
  144. }
  145. /*************************** End of file ****************************/