Select one of the symbols to view example projects that use it.
 
Outline
Includes
#include "k_bsp.h"
#include "k_calibration.h"
#include "GUI.h"
#include "DIALOG.h"
k_BspInit()
k_BspAudioInit()
k_TouchUpdate()
Files
loading...
CodeScopeSTM32 Libraries and SamplesMB1063Core/Src/k_bsp.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file k_bsp.c * @author MCD Application Team * @brief This file provides the kernel bsp functions ****************************************************************************** * @attention * * Copyright (c) 2017 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ /* Includes ------------------------------------------------------------------*/ #include "k_bsp.h" #include "k_calibration.h" #include "GUI.h" #include "DIALOG.h" /** @addtogroup CORE * @{ *//* ... */ /** @defgroup KERNEL_BSP * @brief Kernel BSP routines * @{ *//* ... */ Includes /* External variables --------------------------------------------------------*/ /* Private typedef -----------------------------------------------------------*/ /* Private defines -----------------------------------------------------------*/ /* Private macros ------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /** * @brief Initializes LEDs, SDRAM, touch screen, CRC and SRAM. * @param None * @retval None *//* ... */ void k_BspInit(void) { /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the SDRAM */ BSP_SDRAM_Init(); /* Initialize the Touch screen */ BSP_TS_Init(640, 480); /* Enable CRC to Unlock GUI */ __HAL_RCC_CRC_CLK_ENABLE(); /* Enable Back up SRAM */ __HAL_RCC_BKPSRAM_CLK_ENABLE(); }{ ... } /** * @brief Initializes BSP Audio * @param None * @retval None *//* ... */ void k_BspAudioInit(void) { BSP_AUDIO_OUT_Init(OUTPUT_DEVICE_AUTO, AUDIO_DEFAULT_VOLUME, I2S_AUDIOFREQ_44K); BSP_AUDIO_OUT_SetAudioFrameSlot(CODEC_AUDIOFRAME_SLOT_02); }{ ... } /** * @brief Read the coordinate of the point touched and assign their * value to the variables u32_TSXCoordinate and u32_TSYCoordinate * @param None * @retval None *//* ... */ void k_TouchUpdate(void) { static GUI_PID_STATE TS_State = {0, 0, 0, 0}; __IO TS_StateTypeDef ts; uint16_t xDiff, yDiff; BSP_TS_GetState((TS_StateTypeDef *)&ts); if((ts.x >= LCD_GetXSize()) ||(ts.y >= LCD_GetYSize()) ) { ts.x = 0; ts.y = 0; ts.TouchDetected =0; }if ((ts.x >= LCD_GetXSize()) ||(ts.y >= LCD_GetYSize())) { ... } xDiff = (TS_State.x > ts.x) ? (TS_State.x - ts.x) : (ts.x - TS_State.x); yDiff = (TS_State.y > ts.y) ? (TS_State.y - ts.y) : (ts.y - TS_State.y); if((TS_State.Pressed != ts.TouchDetected ) || (xDiff > 30 )|| (yDiff > 30)) { TS_State.Pressed = ts.TouchDetected; TS_State.Layer = 0; if(ts.TouchDetected) { TS_State.x = ts.x; TS_State.y = ts.y; GUI_TOUCH_StoreStateEx(&TS_State); }if (ts.TouchDetected) { ... } else { GUI_TOUCH_StoreStateEx(&TS_State); TS_State.x = 0; TS_State.y = 0; }else { ... } }if ((TS_State.Pressed != ts.TouchDetected ) || (xDiff > 30 )|| (yDiff > 30)) { ... } }{ ... } /** * @} *//* ... */ /** * @} *//* ... */