annotate Small_CPU/Src/stm32f4xx_hal_msp_v3.c @ 181:331882a89421 Cleanup_Compass_Wireless

Removed not suppoted wireless feature The code contains parts of a wireless sensor feature which is not supported by the OSTC4 hardware.
author ideenmodellierer
date Wed, 13 Mar 2019 21:51:25 +0100
parents 5f11787b4f42
children abec171c2c4b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file UART/UART_Printf/Src/stm32f4xx_hal_msp.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author MCD Application Team
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V1.1.0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 26-June-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @brief HAL MSP module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 * Redistribution and use in source and binary forms, with or without modification,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 * are permitted provided that the following conditions are met:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 * 1. Redistributions of source code must retain the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 * this list of conditions and the following disclaimer.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 * this list of conditions and the following disclaimer in the documentation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 * and/or other materials provided with the distribution.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 * may be used to endorse or promote products derived from this software
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 * without specific prior written permission.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #include "baseCPU2.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 /** @addtogroup STM32F4xx_HAL_Examples
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 /** @defgroup HAL_MSP
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 * @brief HAL MSP module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 /* Private typedef -----------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 /* Private define ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 /* Private macro -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 /** @defgroup HAL_MSP_Private_Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 void HAL_I2C_ManualControl_MspInit(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 /*##-1- Enable peripherals and GPIO Clocks #################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 /* Enable GPIO TX/RX clock */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 I2Cx_SCL_GPIO_CLK_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 I2Cx_SDA_GPIO_CLK_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 /*##-2- Configure peripheral GPIO ##########################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 /* I2C CLOCK GPIO pin configuration */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 GPIO_InitStruct.Pin = I2Cx_SCL_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 GPIO_InitStruct.Pull = GPIO_PULLUP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 HAL_GPIO_Init(I2Cx_SCL_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 /* I2C DATA GPIO pin configuration */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 GPIO_InitStruct.Pin = I2Cx_SDA_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 GPIO_InitStruct.Alternate = GPIO_MODE_INPUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 HAL_GPIO_Init(I2Cx_SDA_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 * @brief I2C MSP Initialization
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 * This function configures the hardware resources used in this example:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 * - Peripheral's clock enable
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 * - Peripheral's GPIO Configuration
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 * - DMA configuration for transmission request by peripheral
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 * - NVIC configuration for DMA interrupt request enable
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 * @param hi2c: I2C handle pointer
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 /*##-1- Enable peripherals and GPIO Clocks #################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 /* Enable GPIO TX/RX clock */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 I2Cx_SCL_GPIO_CLK_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 I2Cx_SDA_GPIO_CLK_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 /* Enable I2C1 clock */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 I2Cx_CLK_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 /*##-2- Configure peripheral GPIO ##########################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 /* I2C TX GPIO pin configuration */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 GPIO_InitStruct.Pin = I2Cx_SCL_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 GPIO_InitStruct.Pull = GPIO_PULLUP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 GPIO_InitStruct.Alternate = I2Cx_SCL_AF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 HAL_GPIO_Init(I2Cx_SCL_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 /* I2C RX GPIO pin configuration */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 GPIO_InitStruct.Pin = I2Cx_SDA_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 GPIO_InitStruct.Alternate = I2Cx_SDA_AF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 HAL_GPIO_Init(I2Cx_SDA_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 /*##-3- Configure the NVIC for I2C #########################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 /* NVIC for I2C1 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 HAL_NVIC_SetPriority(I2Cx_ER_IRQn, 1, 2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 HAL_NVIC_EnableIRQ(I2Cx_ER_IRQn);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 HAL_NVIC_SetPriority(I2Cx_EV_IRQn, 1, 3);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 HAL_NVIC_EnableIRQ(I2Cx_EV_IRQn);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 * @brief I2C MSP De-Initialization
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 * This function frees the hardware resources used in this example:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 * - Disable the Peripheral's clock
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 * - Revert GPIO, DMA and NVIC configuration to their default state
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 * @param hi2c: I2C handle pointer
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 /*##-1- Reset peripherals ##################################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 I2Cx_FORCE_RESET();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 I2Cx_RELEASE_RESET();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 /*##-2- Disable peripherals and GPIO Clocks ################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 /* Configure I2C Tx as alternate function */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 HAL_GPIO_DeInit(I2Cx_SCL_GPIO_PORT, I2Cx_SCL_PIN);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 /* Configure I2C Rx as alternate function */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 HAL_GPIO_DeInit(I2Cx_SDA_GPIO_PORT, I2Cx_SDA_PIN);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 /*##-3- Disable the NVIC for I2C ###########################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 HAL_NVIC_DisableIRQ(I2Cx_ER_IRQn);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 HAL_NVIC_DisableIRQ(I2Cx_EV_IRQn);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 * @brief RTC MSP Initialization
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 * This function configures the hardware resources used in this example
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 * @param hrtc: RTC handle pointer
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 * @note Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 * the RTC clock source; in this case the Backup domain will be reset in
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 * order to modify the RTC Clock source, as consequence RTC registers (including
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 * the backup registers) and RCC_BDCR register are set to their reset values.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 if(hrtc->Instance==RTC)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 /* USER CODE BEGIN RTC_MspInit 0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 RCC_OscInitTypeDef RCC_OscInitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 /*##-1- Configue LSI as RTC clock soucre ###################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 RCC_OscInitStruct.LSEState = RCC_LSE_ON;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 HAL_RCC_OscConfig(&RCC_OscInitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 /* USER CODE END RTC_MspInit 0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 /* Peripheral clock enable */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 __HAL_RCC_RTC_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 /* USER CODE BEGIN RTC_MspInit 1 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 /*##-3- Configure the NVIC for RTC WakeUp Timer ############################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 HAL_NVIC_SetPriority(RTC_WKUP_IRQn, 0x0F, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 HAL_NVIC_EnableIRQ(RTC_WKUP_IRQn);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 /* USER CODE END RTC_MspInit 1 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 void HAL_RTC_MspDeInit(RTC_HandleTypeDef* hrtc)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 if(hrtc->Instance==RTC)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 /* USER CODE BEGIN RTC_MspDeInit 0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 /* USER CODE END RTC_MspDeInit 0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 /* Peripheral clock disable */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 __HAL_RCC_RTC_DISABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 /* USER CODE BEGIN RTC_MspDeInit 1 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 /* USER CODE END RTC_MspDeInit 1 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 void HAL_UART_MspInit(UART_HandleTypeDef* huart)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 if(huart->Instance==USART2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 __USART2_CLK_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 GPIO_InitStruct.Pull = GPIO_PULLUP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 if(huart->Instance==USART2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 __USART2_CLK_DISABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/