annotate Small_CPU/Src/stm32f4xx_hal_msp_v3.c @ 561:e581425c7e3e

Solved minor warnings
author Ideenmodellierer
date Sun, 15 Nov 2020 19:54:36 +0100
parents abec171c2c4b
children 1b995079c045
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;
327
abec171c2c4b Deactivated internal pullups and I2C interrupt callback
ideenmodellierer
parents: 38
diff changeset
113 GPIO_InitStruct.Pull = GPIO_NOPULL;
38
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 */
327
abec171c2c4b Deactivated internal pullups and I2C interrupt callback
ideenmodellierer
parents: 38
diff changeset
127
abec171c2c4b Deactivated internal pullups and I2C interrupt callback
ideenmodellierer
parents: 38
diff changeset
128 /* The callbacks are not used => no need to activate the interrupts */
abec171c2c4b Deactivated internal pullups and I2C interrupt callback
ideenmodellierer
parents: 38
diff changeset
129 /*
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 HAL_NVIC_SetPriority(I2Cx_ER_IRQn, 1, 2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 HAL_NVIC_EnableIRQ(I2Cx_ER_IRQn);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 HAL_NVIC_SetPriority(I2Cx_EV_IRQn, 1, 3);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 HAL_NVIC_EnableIRQ(I2Cx_EV_IRQn);
327
abec171c2c4b Deactivated internal pullups and I2C interrupt callback
ideenmodellierer
parents: 38
diff changeset
134 */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 * @brief I2C MSP De-Initialization
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 * This function frees the hardware resources used in this example:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 * - Disable the Peripheral's clock
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 * - Revert GPIO, DMA and NVIC configuration to their default state
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 * @param hi2c: I2C handle pointer
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 /*##-1- Reset peripherals ##################################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 I2Cx_FORCE_RESET();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 I2Cx_RELEASE_RESET();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 /*##-2- Disable peripherals and GPIO Clocks ################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 /* Configure I2C Tx as alternate function */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 HAL_GPIO_DeInit(I2Cx_SCL_GPIO_PORT, I2Cx_SCL_PIN);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 /* Configure I2C Rx as alternate function */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 HAL_GPIO_DeInit(I2Cx_SDA_GPIO_PORT, I2Cx_SDA_PIN);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 /*##-3- Disable the NVIC for I2C ###########################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 HAL_NVIC_DisableIRQ(I2Cx_ER_IRQn);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 HAL_NVIC_DisableIRQ(I2Cx_EV_IRQn);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 * @brief RTC MSP Initialization
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 * This function configures the hardware resources used in this example
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 * @param hrtc: RTC handle pointer
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 * @note Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 * the RTC clock source; in this case the Backup domain will be reset in
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 * order to modify the RTC Clock source, as consequence RTC registers (including
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 * the backup registers) and RCC_BDCR register are set to their reset values.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 if(hrtc->Instance==RTC)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 /* USER CODE BEGIN RTC_MspInit 0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 RCC_OscInitTypeDef RCC_OscInitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 /*##-1- Configue LSI as RTC clock soucre ###################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 RCC_OscInitStruct.LSEState = RCC_LSE_ON;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 HAL_RCC_OscConfig(&RCC_OscInitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 /* USER CODE END RTC_MspInit 0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 /* Peripheral clock enable */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 __HAL_RCC_RTC_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 /* USER CODE BEGIN RTC_MspInit 1 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 /*##-3- Configure the NVIC for RTC WakeUp Timer ############################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 HAL_NVIC_SetPriority(RTC_WKUP_IRQn, 0x0F, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 HAL_NVIC_EnableIRQ(RTC_WKUP_IRQn);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 /* USER CODE END RTC_MspInit 1 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 void HAL_RTC_MspDeInit(RTC_HandleTypeDef* hrtc)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 if(hrtc->Instance==RTC)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 /* USER CODE BEGIN RTC_MspDeInit 0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 /* USER CODE END RTC_MspDeInit 0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 /* Peripheral clock disable */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 __HAL_RCC_RTC_DISABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 /* USER CODE BEGIN RTC_MspDeInit 1 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 /* USER CODE END RTC_MspDeInit 1 */
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 }
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 void HAL_UART_MspInit(UART_HandleTypeDef* huart)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 if(huart->Instance==USART2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 __USART2_CLK_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 GPIO_InitStruct.Pull = GPIO_PULLUP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 if(huart->Instance==USART2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 __USART2_CLK_DISABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/