Select one of the symbols to view example projects that use it.
 
Outline
Includes
#include "k_bsp.h"
External variables
TS_State
k_BspInit()
k_TouchUpdate()
BSP_SD_MspInit(SD_HandleTypeDef *, void *)
Files
loading...
CodeScopeSTM32 Libraries and SamplesSTemWinCore/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
135
136
137
138
139
140
141
142
143
144
145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @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" /** @addtogroup CORE * @{ *//* ... */ /** @defgroup KERNEL_BSP * @brief Kernel BSP routines * @{ *//* ... */ Includes /* External variables --------------------------------------------------------*/ TS_StateTypeDef TS_State = {0}; External variables /* Private typedef -----------------------------------------------------------*/ /* Private defines -----------------------------------------------------------*/ /* Private macros ------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /** * @brief Initializes QSPI and CRC. * @param None * @retval None *//* ... */ void k_BspInit(void) { /* Initialize the QSPI */ BSP_QSPI_Init(); BSP_QSPI_MemoryMappedMode(); BSP_TS_InitEx(240, 240, TS_ORIENTATION_PORTRAIT); /* Enable CRC to Unlock GUI */ __HAL_RCC_CRC_CLK_ENABLE(); }{ ... } /** * @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; BSP_TS_GetState((TS_StateTypeDef *)&ts); ts.touchX[0] = TouchScreen_Get_Calibrated_X(ts.touchX[0]); ts.touchY[0] = TouchScreen_Get_Calibrated_Y(ts.touchY[0]); if((ts.touchX[0] >= LCD_GetXSize()) ||(ts.touchY[0] >= LCD_GetYSize()) ) { ts.touchX[0] = 0; ts.touchY[0] = 0; }if ((ts.touchX[0] >= LCD_GetXSize()) ||(ts.touchY[0] >= LCD_GetYSize())) { ... } if((TS_State.Pressed != ts.touchDetected )|| (TS_State.x != ts.touchX[0]) || (TS_State.y != ts.touchY[0])) { TS_State.Pressed = ts.touchDetected; if(ts.touchDetected) { TS_State.x = ts.touchX[0]; TS_State.y = ts.touchY[0]; 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 )|| (TS_State.x != ts.touchX[0]) || (TS_State.y != ts.touchY[0])) { ... } }{ ... } /** * @brief Initializes the SD MSP. * @param hsd: SD handle * @param Params * @retval None *//* ... */ void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params) { GPIO_InitTypeDef gpio_init_structure; /* Enable SDIO clock */ __HAL_RCC_SDIO_CLK_ENABLE(); /* Enable DMA2 clocks */ __DMAx_TxRx_CLK_ENABLE(); /* Enable GPIOs clock */ __HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE(); /* Common GPIO configuration */ gpio_init_structure.Mode = GPIO_MODE_AF_PP; gpio_init_structure.Pull = GPIO_PULLUP; gpio_init_structure.Speed = GPIO_SPEED_HIGH; gpio_init_structure.Alternate = GPIO_AF12_SDIO; /* GPIOC configuration */ gpio_init_structure.Pin = GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12; HAL_GPIO_Init(GPIOC, &gpio_init_structure); /* GPIOD configuration */ gpio_init_structure.Pin = GPIO_PIN_2; HAL_GPIO_Init(GPIOD, &gpio_init_structure); /* NVIC configuration for SDIO interrupts */ HAL_NVIC_SetPriority(SDIO_IRQn, 0x0E, 0x00); HAL_NVIC_EnableIRQ(SDIO_IRQn); }{ ... } /** * @} *//* ... */ /** * @} *//* ... */