· 6 years ago · Dec 24, 2019, 09:12 PM
1diff --git a/Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_iwdg.h b/Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_iwdg.h
2index 205f35b..1dbdbd1 100644
3--- a/Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_iwdg.h
4+++ b/Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_iwdg.h
5@@ -1,239 +1,241 @@
6-/**
7- ******************************************************************************
8- * @file stm32l4xx_hal_iwdg.h
9- * @author MCD Application Team
10- * @brief Header file of IWDG HAL module.
11- ******************************************************************************
12- * @attention
13- *
14- * <h2><center>© Copyright (c) 2017 STMicroelectronics.
15- * All rights reserved.</center></h2>
16- *
17- * This software component is licensed by ST under BSD 3-Clause license,
18- * the "License"; You may not use this file except in compliance with the
19- * License. You may obtain a copy of the License at:
20- * opensource.org/licenses/BSD-3-Clause
21- *
22- ******************************************************************************
23- */
24-
25-/* Define to prevent recursive inclusion -------------------------------------*/
26-#ifndef STM32L4xx_HAL_IWDG_H
27-#define STM32L4xx_HAL_IWDG_H
28-
29-#ifdef __cplusplus
30-extern "C" {
31-#endif
32-
33-/* Includes ------------------------------------------------------------------*/
34-#include "stm32l4xx_hal_def.h"
35-
36-/** @addtogroup STM32L4xx_HAL_Driver
37- * @{
38- */
39-
40-/** @defgroup IWDG IWDG
41- * @{
42- */
43-
44-/* Exported types ------------------------------------------------------------*/
45-/** @defgroup IWDG_Exported_Types IWDG Exported Types
46- * @{
47- */
48-
49-/**
50- * @brief IWDG Init structure definition
51- */
52-typedef struct {
53- uint32_t Prescaler; /*!< Select the prescaler of the IWDG.
54- This parameter can be a value of @ref IWDG_Prescaler */
55-
56- uint32_t Reload; /*!< Specifies the IWDG down-counter reload value.
57- This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */
58-
59- uint32_t Window; /*!< Specifies the window value to be compared to the down-counter.
60- This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */
61-
62-} IWDG_InitTypeDef;
63-
64-/**
65- * @brief IWDG Handle Structure definition
66- */
67-typedef struct {
68- IWDG_TypeDef *Instance; /*!< Register base address */
69-
70- IWDG_InitTypeDef Init; /*!< IWDG required parameters */
71-} IWDG_HandleTypeDef;
72-
73-
74-/**
75- * @}
76- */
77-
78-/* Exported constants --------------------------------------------------------*/
79-/** @defgroup IWDG_Exported_Constants IWDG Exported Constants
80- * @{
81- */
82-
83-/** @defgroup IWDG_Prescaler IWDG Prescaler
84- * @{
85- */
86-#define IWDG_PRESCALER_4 0x00000000u /*!< IWDG prescaler set to 4 */
87-#define IWDG_PRESCALER_8 IWDG_PR_PR_0 /*!< IWDG prescaler set to 8 */
88-#define IWDG_PRESCALER_16 IWDG_PR_PR_1 /*!< IWDG prescaler set to 16 */
89-#define IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 32 */
90-#define IWDG_PRESCALER_64 IWDG_PR_PR_2 /*!< IWDG prescaler set to 64 */
91-#define IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 128 */
92-#define IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1) /*!< IWDG prescaler set to 256 */
93-
94-/**
95- * @}
96- */
97-
98-/** @defgroup IWDG_Window_option IWDG Window option
99- * @{
100- */
101-#define IWDG_WINDOW_DISABLE IWDG_WINR_WIN
102-/**
103- * @}
104- */
105-
106-
107-/**
108- * @}
109- */
110-
111-/* Exported macros -----------------------------------------------------------*/
112-/** @defgroup IWDG_Exported_Macros IWDG Exported Macros
113- * @{
114- */
115-
116-/**
117- * @brief Enable the IWDG peripheral.
118- * @param __HANDLE__ IWDG handle
119- * @retval None
120- */
121-#define __HAL_IWDG_START(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_ENABLE)
122-
123-/**
124- * @brief Reload IWDG counter with value defined in the reload register
125- * (write access to IWDG_PR, IWDG_RLR & IWDG_WINR registers disabled).
126- * @param __HANDLE__ IWDG handle
127- * @retval None
128- */
129-#define __HAL_IWDG_RELOAD_COUNTER(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_RELOAD)
130-
131-/**
132- * @}
133- */
134-
135-/* Exported functions --------------------------------------------------------*/
136-/** @defgroup IWDG_Exported_Functions IWDG Exported Functions
137- * @{
138- */
139-
140-/** @defgroup IWDG_Exported_Functions_Group1 Initialization and Start functions
141- * @{
142- */
143-/* Initialization/Start functions ********************************************/
144-HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg);
145-/**
146- * @}
147- */
148-
149-/** @defgroup IWDG_Exported_Functions_Group2 IO operation functions
150- * @{
151- */
152-/* I/O operation functions ****************************************************/
153-HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg);
154-/**
155- * @}
156- */
157-
158-/**
159- * @}
160- */
161-
162-/* Private constants ---------------------------------------------------------*/
163-/** @defgroup IWDG_Private_Constants IWDG Private Constants
164- * @{
165- */
166-
167-/**
168- * @brief IWDG Key Register BitMask
169- */
170-#define IWDG_KEY_RELOAD 0x0000AAAAu /*!< IWDG Reload Counter Enable */
171-#define IWDG_KEY_ENABLE 0x0000CCCCu /*!< IWDG Peripheral Enable */
172-#define IWDG_KEY_WRITE_ACCESS_ENABLE 0x00005555u /*!< IWDG KR Write Access Enable */
173-#define IWDG_KEY_WRITE_ACCESS_DISABLE 0x00000000u /*!< IWDG KR Write Access Disable */
174-
175-/**
176- * @}
177- */
178-
179-/* Private macros ------------------------------------------------------------*/
180-/** @defgroup IWDG_Private_Macros IWDG Private Macros
181- * @{
182- */
183-
184-/**
185- * @brief Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers.
186- * @param __HANDLE__ IWDG handle
187- * @retval None
188- */
189-#define IWDG_ENABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_ENABLE)
190-
191-/**
192- * @brief Disable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers.
193- * @param __HANDLE__ IWDG handle
194- * @retval None
195- */
196-#define IWDG_DISABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_DISABLE)
197-
198-/**
199- * @brief Check IWDG prescaler value.
200- * @param __PRESCALER__ IWDG prescaler value
201- * @retval None
202- */
203-#define IS_IWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == IWDG_PRESCALER_4) || \
204- ((__PRESCALER__) == IWDG_PRESCALER_8) || \
205- ((__PRESCALER__) == IWDG_PRESCALER_16) || \
206- ((__PRESCALER__) == IWDG_PRESCALER_32) || \
207- ((__PRESCALER__) == IWDG_PRESCALER_64) || \
208- ((__PRESCALER__) == IWDG_PRESCALER_128)|| \
209- ((__PRESCALER__) == IWDG_PRESCALER_256))
210-
211-/**
212- * @brief Check IWDG reload value.
213- * @param __RELOAD__ IWDG reload value
214- * @retval None
215- */
216-#define IS_IWDG_RELOAD(__RELOAD__) ((__RELOAD__) <= IWDG_RLR_RL)
217-
218-/**
219- * @brief Check IWDG window value.
220- * @param __WINDOW__ IWDG window value
221- * @retval None
222- */
223-#define IS_IWDG_WINDOW(__WINDOW__) ((__WINDOW__) <= IWDG_WINR_WIN)
224-
225-/**
226- * @}
227- */
228-
229-/**
230- * @}
231- */
232-
233-/**
234- * @}
235- */
236-
237-
238-#ifdef __cplusplus
239-}
240-#endif
241-
242-#endif /* STM32L4xx_HAL_IWDG_H */
243-
244-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
245+/**^M
246+ ******************************************************************************^M
247+ * @file stm32l4xx_hal_iwdg.h^M
248+ * @author MCD Application Team^M
249+ * @brief Header file of IWDG HAL module.^M
250+ ******************************************************************************^M
251+ * @attention^M
252+ *^M
253+ * <h2><center>© Copyright (c) 2017 STMicroelectronics.^M
254+ * All rights reserved.</center></h2>^M
255+ *^M
256+ * This software component is licensed by ST under BSD 3-Clause license,^M
257+ * the "License"; You may not use this file except in compliance with the^M
258+ * License. You may obtain a copy of the License at:^M
259+ * opensource.org/licenses/BSD-3-Clause^M
260+ *^M
261+ ******************************************************************************^M
262+ */^M
263+^M
264+/* Define to prevent recursive inclusion -------------------------------------*/^M
265+#ifndef STM32L4xx_HAL_IWDG_H^M
266+#define STM32L4xx_HAL_IWDG_H^M
267+^M
268+#ifdef __cplusplus^M
269+extern "C" {^M
270+#endif^M
271+^M
272+/* Includes ------------------------------------------------------------------*/^M
273+#include "stm32l4xx_hal_def.h"^M
274+^M
275+/** @addtogroup STM32L4xx_HAL_Driver^M
276+ * @{^M
277+ */^M
278+^M
279+/** @defgroup IWDG IWDG^M
280+ * @{^M
281+ */^M
282+^M
283+/* Exported types ------------------------------------------------------------*/^M
284+/** @defgroup IWDG_Exported_Types IWDG Exported Types^M
285+ * @{^M
286+ */^M
287+^M
288+/**^M
289+ * @brief IWDG Init structure definition^M
290+ */^M
291+typedef struct^M
292+{^M
293+ uint32_t Prescaler; /*!< Select the prescaler of the IWDG.^M
294+ This parameter can be a value of @ref IWDG_Prescaler */^M
295+^M
296+ uint32_t Reload; /*!< Specifies the IWDG down-counter reload value.^M
297+ This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */^M
298+^M
299+ uint32_t Window; /*!< Specifies the window value to be compared to the down-counter.^M
300+ This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */^M
301+^M
302+} IWDG_InitTypeDef;^M
303+^M
304+/**^M
305+ * @brief IWDG Handle Structure definition^M
306+ */^M
307+typedef struct^M
308+{^M
309+ IWDG_TypeDef *Instance; /*!< Register base address */^M
310+^M
311+ IWDG_InitTypeDef Init; /*!< IWDG required parameters */^M
312+} IWDG_HandleTypeDef;^M
313+^M
314+^M
315+/**^M
316+ * @}^M
317+ */^M
318+^M
319+/* Exported constants --------------------------------------------------------*/^M
320+/** @defgroup IWDG_Exported_Constants IWDG Exported Constants^M
321+ * @{^M
322+ */^M
323+^M
324+/** @defgroup IWDG_Prescaler IWDG Prescaler^M
325+ * @{^M
326+ */^M
327+#define IWDG_PRESCALER_4 0x00000000u /*!< IWDG prescaler set to 4 */^M
328+#define IWDG_PRESCALER_8 IWDG_PR_PR_0 /*!< IWDG prescaler set to 8 */^M
329+#define IWDG_PRESCALER_16 IWDG_PR_PR_1 /*!< IWDG prescaler set to 16 */^M
330+#define IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 32 */^M
331+#define IWDG_PRESCALER_64 IWDG_PR_PR_2 /*!< IWDG prescaler set to 64 */^M
332+#define IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 128 */^M
333+#define IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1) /*!< IWDG prescaler set to 256 */^M
334+^M
335+/**^M
336+ * @}^M
337+ */^M
338+^M
339+/** @defgroup IWDG_Window_option IWDG Window option^M
340+ * @{^M
341+ */^M
342+#define IWDG_WINDOW_DISABLE IWDG_WINR_WIN^M
343+/**^M
344+ * @}^M
345+ */^M
346+^M
347+^M
348+/**^M
349+ * @}^M
350+ */^M
351+^M
352+/* Exported macros -----------------------------------------------------------*/^M
353+/** @defgroup IWDG_Exported_Macros IWDG Exported Macros^M
354+ * @{^M
355+ */^M
356+^M
357+/**^M
358+ * @brief Enable the IWDG peripheral.^M
359+ * @param __HANDLE__ IWDG handle^M
360+ * @retval None^M
361+ */^M
362+#define __HAL_IWDG_START(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_ENABLE)^M
363+^M
364+/**^M
365+ * @brief Reload IWDG counter with value defined in the reload register^M
366+ * (write access to IWDG_PR, IWDG_RLR & IWDG_WINR registers disabled).^M
367+ * @param __HANDLE__ IWDG handle^M
368+ * @retval None^M
369+ */^M
370+#define __HAL_IWDG_RELOAD_COUNTER(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_RELOAD)^M
371+^M
372+/**^M
373+ * @}^M
374+ */^M
375+^M
376+/* Exported functions --------------------------------------------------------*/^M
377+/** @defgroup IWDG_Exported_Functions IWDG Exported Functions^M
378+ * @{^M
379+ */^M
380+^M
381+/** @defgroup IWDG_Exported_Functions_Group1 Initialization and Start functions^M
382+ * @{^M
383+ */^M
384+/* Initialization/Start functions ********************************************/^M
385+HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg);^M
386+/**^M
387+ * @}^M
388+ */^M
389+^M
390+/** @defgroup IWDG_Exported_Functions_Group2 IO operation functions^M
391+ * @{^M
392+ */^M
393+/* I/O operation functions ****************************************************/^M
394+HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg);^M
395+/**^M
396+ * @}^M
397+ */^M
398+^M
399+/**^M
400+ * @}^M
401+ */^M
402+^M
403+/* Private constants ---------------------------------------------------------*/^M
404+/** @defgroup IWDG_Private_Constants IWDG Private Constants^M
405+ * @{^M
406+ */^M
407+^M
408+/**^M
409+ * @brief IWDG Key Register BitMask^M
410+ */^M
411+#define IWDG_KEY_RELOAD 0x0000AAAAu /*!< IWDG Reload Counter Enable */^M
412+#define IWDG_KEY_ENABLE 0x0000CCCCu /*!< IWDG Peripheral Enable */^M
413+#define IWDG_KEY_WRITE_ACCESS_ENABLE 0x00005555u /*!< IWDG KR Write Access Enable */^M
414+#define IWDG_KEY_WRITE_ACCESS_DISABLE 0x00000000u /*!< IWDG KR Write Access Disable */^M
415+^M
416+/**^M
417+ * @}^M
418+ */^M
419+^M
420+/* Private macros ------------------------------------------------------------*/^M
421+/** @defgroup IWDG_Private_Macros IWDG Private Macros^M
422+ * @{^M
423+ */^M
424+^M
425+/**^M
426+ * @brief Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers.^M
427+ * @param __HANDLE__ IWDG handle^M
428+ * @retval None^M
429+ */^M
430+#define IWDG_ENABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_ENABLE)^M
431+^M
432+/**^M
433+ * @brief Disable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers.^M
434+ * @param __HANDLE__ IWDG handle^M
435+ * @retval None^M
436+ */^M
437+#define IWDG_DISABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_DISABLE)^M
438+^M
439+/**^M
440+ * @brief Check IWDG prescaler value.^M
441+ * @param __PRESCALER__ IWDG prescaler value^M
442+ * @retval None^M
443+ */^M
444+#define IS_IWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == IWDG_PRESCALER_4) || \^M
445+ ((__PRESCALER__) == IWDG_PRESCALER_8) || \^M
446+ ((__PRESCALER__) == IWDG_PRESCALER_16) || \^M
447+ ((__PRESCALER__) == IWDG_PRESCALER_32) || \^M
448+ ((__PRESCALER__) == IWDG_PRESCALER_64) || \^M
449+ ((__PRESCALER__) == IWDG_PRESCALER_128)|| \^M
450+ ((__PRESCALER__) == IWDG_PRESCALER_256))^M
451+^M
452+/**^M
453+ * @brief Check IWDG reload value.^M
454+ * @param __RELOAD__ IWDG reload value^M
455+ * @retval None^M
456+ */^M
457+#define IS_IWDG_RELOAD(__RELOAD__) ((__RELOAD__) <= IWDG_RLR_RL)^M
458+^M
459+/**^M
460+ * @brief Check IWDG window value.^M
461+ * @param __WINDOW__ IWDG window value^M
462+ * @retval None^M
463+ */^M
464+#define IS_IWDG_WINDOW(__WINDOW__) ((__WINDOW__) <= IWDG_WINR_WIN)^M
465+^M
466+/**^M
467+ * @}^M
468+ */^M
469+^M
470+/**^M
471+ * @}^M
472+ */^M
473+^M
474+/**^M
475+ * @}^M
476+ */^M
477+^M
478+^M
479+#ifdef __cplusplus^M
480+}^M
481+#endif^M
482+^M
483+#endif /* STM32L4xx_HAL_IWDG_H */^M
484+^M
485+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/^M
486diff --git a/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_iwdg.c b/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_iwdg.c
487index 5707a93..8c49fbd 100644
488--- a/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_iwdg.c
489+++ b/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_iwdg.c
490@@ -1,260 +1,264 @@
491-/**
492- ******************************************************************************
493- * @file stm32l4xx_hal_iwdg.c
494- * @author MCD Application Team
495- * @brief IWDG HAL module driver.
496- * This file provides firmware functions to manage the following
497- * functionalities of the Independent Watchdog (IWDG) peripheral:
498- * + Initialization and Start functions
499- * + IO operation functions
500- *
501- @verbatim
502- ==============================================================================
503- ##### IWDG Generic features #####
504- ==============================================================================
505- [..]
506- (+) The IWDG can be started by either software or hardware (configurable
507- through option byte).
508-
509- (+) The IWDG is clocked by Low-Speed clock (LSI) and thus stays active even
510- if the main clock fails.
511-
512- (+) Once the IWDG is started, the LSI is forced ON and both can not be
513- disabled. The counter starts counting down from the reset value (0xFFF).
514- When it reaches the end of count value (0x000) a reset signal is
515- generated (IWDG reset).
516-
517- (+) Whenever the key value 0x0000 AAAA is written in the IWDG_KR register,
518- the IWDG_RLR value is reloaded in the counter and the watchdog reset is
519- prevented.
520-
521- (+) The IWDG is implemented in the VDD voltage domain that is still functional
522- in STOP and STANDBY mode (IWDG reset can wake-up from STANDBY).
523- IWDGRST flag in RCC_CSR register can be used to inform when an IWDG
524- reset occurs.
525-
526- (+) Debug mode : When the microcontroller enters debug mode (core halted),
527- the IWDG counter either continues to work normally or stops, depending
528- on DBG_IWDG_STOP configuration bit in DBG module, accessible through
529- __HAL_DBGMCU_FREEZE_IWDG() and __HAL_DBGMCU_UNFREEZE_IWDG() macros
530-
531- [..] Min-max timeout value @32KHz (LSI): ~125us / ~32.7s
532- The IWDG timeout may vary due to LSI frequency dispersion. STM32L4xx
533- devices provide the capability to measure the LSI frequency (LSI clock
534- connected internally to TIM16 CH1 input capture). The measured value
535- can be used to have an IWDG timeout with an acceptable accuracy.
536-
537- ##### How to use this driver #####
538- ==============================================================================
539- [..]
540- (#) Use IWDG using HAL_IWDG_Init() function to :
541- (+) Enable instance by writing Start keyword in IWDG_KEY register. LSI
542- clock is forced ON and IWDG counter starts downcounting.
543- (+) Enable write access to configuration register: IWDG_PR, IWDG_RLR &
544- IWDG_WINR.
545- (+) Configure the IWDG prescaler and counter reload value. This reload
546- value will be loaded in the IWDG counter each time the watchdog is
547- reloaded, then the IWDG will start counting down from this value.
548- (+) wait for status flags to be reset
549- (+) Depending on window parameter:
550- (++) If Window Init parameter is same as Window register value,
551- nothing more is done but reload counter value in order to exit
552- function withy exact time base.
553- (++) Else modify Window register. This will automatically reload
554- watchdog counter.
555-
556- (#) Then the application program must refresh the IWDG counter at regular
557- intervals during normal operation to prevent an MCU reset, using
558- HAL_IWDG_Refresh() function.
559-
560- *** IWDG HAL driver macros list ***
561- ====================================
562- [..]
563- Below the list of most used macros in IWDG HAL driver:
564- (+) __HAL_IWDG_START: Enable the IWDG peripheral
565- (+) __HAL_IWDG_RELOAD_COUNTER: Reloads IWDG counter with value defined in
566- the reload register
567-
568- @endverbatim
569- ******************************************************************************
570- * @attention
571- *
572- * <h2><center>© Copyright (c) 2017 STMicroelectronics.
573- * All rights reserved.</center></h2>
574- *
575- * This software component is licensed by ST under BSD 3-Clause license,
576- * the "License"; You may not use this file except in compliance with the
577- * License. You may obtain a copy of the License at:
578- * opensource.org/licenses/BSD-3-Clause
579- *
580- ******************************************************************************
581- */
582-
583-/* Includes ------------------------------------------------------------------*/
584-#include "stm32l4xx_hal.h"
585-
586-/** @addtogroup STM32L4xx_HAL_Driver
587- * @{
588- */
589-
590-#ifdef HAL_IWDG_MODULE_ENABLED
591-/** @addtogroup IWDG
592- * @brief IWDG HAL module driver.
593- * @{
594- */
595-
596-/* Private typedef -----------------------------------------------------------*/
597-/* Private define ------------------------------------------------------------*/
598-/** @defgroup IWDG_Private_Defines IWDG Private Defines
599- * @{
600- */
601-/* Status register need 5 RC LSI divided by prescaler clock to be updated. With
602- higher prescaler (256), and according to LSI variation, we need to wait at
603- least 6 cycles so 48 ms. */
604-#define HAL_IWDG_DEFAULT_TIMEOUT 48u
605-/**
606- * @}
607- */
608-
609-/* Private macro -------------------------------------------------------------*/
610-/* Private variables ---------------------------------------------------------*/
611-/* Private function prototypes -----------------------------------------------*/
612-/* Exported functions --------------------------------------------------------*/
613-
614-/** @addtogroup IWDG_Exported_Functions
615- * @{
616- */
617-
618-/** @addtogroup IWDG_Exported_Functions_Group1
619- * @brief Initialization and Start functions.
620- *
621-@verbatim
622- ===============================================================================
623- ##### Initialization and Start functions #####
624- ===============================================================================
625- [..] This section provides functions allowing to:
626- (+) Initialize the IWDG according to the specified parameters in the
627- IWDG_InitTypeDef of associated handle.
628- (+) Manage Window option.
629- (+) Once initialization is performed in HAL_IWDG_Init function, Watchdog
630- is reloaded in order to exit function with correct time base.
631-
632-@endverbatim
633- * @{
634- */
635-
636-/**
637- * @brief Initialize the IWDG according to the specified parameters in the
638- * IWDG_InitTypeDef and start watchdog. Before exiting function,
639- * watchdog is refreshed in order to have correct time base.
640- * @param hiwdg pointer to a IWDG_HandleTypeDef structure that contains
641- * the configuration information for the specified IWDG module.
642- * @retval HAL status
643- */
644-HAL_StatusTypeDef
645-HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg)
646-{
647- uint32_t tickstart;
648-
649- /* Check the IWDG handle allocation */
650- if (hiwdg == NULL) {
651- return HAL_ERROR;
652- }
653-
654- /* Check the parameters */
655- assert_param(IS_IWDG_ALL_INSTANCE(hiwdg->Instance));
656- assert_param(IS_IWDG_PRESCALER(hiwdg->Init.Prescaler));
657- assert_param(IS_IWDG_RELOAD(hiwdg->Init.Reload));
658- assert_param(IS_IWDG_WINDOW(hiwdg->Init.Window));
659-
660- /* Enable IWDG. LSI is turned on automaticaly */
661- __HAL_IWDG_START(hiwdg);
662-
663- /* Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers by writing
664- 0x5555 in KR */
665- IWDG_ENABLE_WRITE_ACCESS(hiwdg);
666-
667- /* Write to IWDG registers the Prescaler & Reload values to work with */
668- hiwdg->Instance->PR = hiwdg->Init.Prescaler;
669- hiwdg->Instance->RLR = hiwdg->Init.Reload;
670-
671- /* Check pending flag, if previous update not done, return timeout */
672- tickstart = HAL_GetTick();
673-
674- /* Wait for register to be updated */
675- while (hiwdg->Instance->SR != 0x00u) {
676- if ((HAL_GetTick() - tickstart) > HAL_IWDG_DEFAULT_TIMEOUT) {
677- return HAL_TIMEOUT;
678- }
679- }
680-
681- /* If window parameter is different than current value, modify window
682- register */
683- if (hiwdg->Instance->WINR != hiwdg->Init.Window) {
684- /* Write to IWDG WINR the IWDG_Window value to compare with. In any case,
685- even if window feature is disabled, Watchdog will be reloaded by writing
686- windows register */
687- hiwdg->Instance->WINR = hiwdg->Init.Window;
688- } else {
689- /* Reload IWDG counter with value defined in the reload register */
690- __HAL_IWDG_RELOAD_COUNTER(hiwdg);
691- }
692-
693- /* Return function status */
694- return HAL_OK;
695-}
696-
697-/**
698- * @}
699- */
700-
701-
702-/** @addtogroup IWDG_Exported_Functions_Group2
703- * @brief IO operation functions
704- *
705-@verbatim
706- ===============================================================================
707- ##### IO operation functions #####
708- ===============================================================================
709- [..] This section provides functions allowing to:
710- (+) Refresh the IWDG.
711-
712-@endverbatim
713- * @{
714- */
715-
716-
717-/**
718- * @brief Refresh the IWDG.
719- * @param hiwdg pointer to a IWDG_HandleTypeDef structure that contains
720- * the configuration information for the specified IWDG module.
721- * @retval HAL status
722- */
723-HAL_StatusTypeDef
724-HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg)
725-{
726- /* Reload IWDG counter with value defined in the reload register */
727- __HAL_IWDG_RELOAD_COUNTER(hiwdg);
728-
729- /* Return function status */
730- return HAL_OK;
731-}
732-
733-/**
734- * @}
735- */
736-
737-/**
738- * @}
739- */
740-
741-#endif /* HAL_IWDG_MODULE_ENABLED */
742-/**
743- * @}
744- */
745-
746-/**
747- * @}
748- */
749-
750-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
751+/**^M
752+ ******************************************************************************^M
753+ * @file stm32l4xx_hal_iwdg.c^M
754+ * @author MCD Application Team^M
755+ * @brief IWDG HAL module driver.^M
756+ * This file provides firmware functions to manage the following^M
757+ * functionalities of the Independent Watchdog (IWDG) peripheral:^M
758+ * + Initialization and Start functions^M
759+ * + IO operation functions^M
760+ *^M
761+ @verbatim^M
762+ ==============================================================================^M
763+ ##### IWDG Generic features #####^M
764+ ==============================================================================^M
765+ [..]^M
766+ (+) The IWDG can be started by either software or hardware (configurable^M
767+ through option byte).^M
768+^M
769+ (+) The IWDG is clocked by Low-Speed clock (LSI) and thus stays active even^M
770+ if the main clock fails.^M
771+^M
772+ (+) Once the IWDG is started, the LSI is forced ON and both can not be^M
773+ disabled. The counter starts counting down from the reset value (0xFFF).^M
774+ When it reaches the end of count value (0x000) a reset signal is^M
775+ generated (IWDG reset).^M
776+^M
777+ (+) Whenever the key value 0x0000 AAAA is written in the IWDG_KR register,^M
778+ the IWDG_RLR value is reloaded in the counter and the watchdog reset is^M
779+ prevented.^M
780+^M
781+ (+) The IWDG is implemented in the VDD voltage domain that is still functional^M
782+ in STOP and STANDBY mode (IWDG reset can wake-up from STANDBY).^M
783+ IWDGRST flag in RCC_CSR register can be used to inform when an IWDG^M
784+ reset occurs.^M
785+^M
786+ (+) Debug mode : When the microcontroller enters debug mode (core halted),^M
787+ the IWDG counter either continues to work normally or stops, depending^M
788+ on DBG_IWDG_STOP configuration bit in DBG module, accessible through^M
789+ __HAL_DBGMCU_FREEZE_IWDG() and __HAL_DBGMCU_UNFREEZE_IWDG() macros^M
790+^M
791+ [..] Min-max timeout value @32KHz (LSI): ~125us / ~32.7s^M
792+ The IWDG timeout may vary due to LSI frequency dispersion. STM32L4xx^M
793+ devices provide the capability to measure the LSI frequency (LSI clock^M
794+ connected internally to TIM16 CH1 input capture). The measured value^M
795+ can be used to have an IWDG timeout with an acceptable accuracy.^M
796+^M
797+ ##### How to use this driver #####^M
798+ ==============================================================================^M
799+ [..]^M
800+ (#) Use IWDG using HAL_IWDG_Init() function to :^M
801+ (+) Enable instance by writing Start keyword in IWDG_KEY register. LSI^M
802+ clock is forced ON and IWDG counter starts downcounting.^M
803+ (+) Enable write access to configuration register: IWDG_PR, IWDG_RLR &^M
804+ IWDG_WINR.^M
805+ (+) Configure the IWDG prescaler and counter reload value. This reload^M
806+ value will be loaded in the IWDG counter each time the watchdog is^M
807+ reloaded, then the IWDG will start counting down from this value.^M
808+ (+) wait for status flags to be reset^M
809+ (+) Depending on window parameter:^M
810+ (++) If Window Init parameter is same as Window register value,^M
811+ nothing more is done but reload counter value in order to exit^M
812+ function withy exact time base.^M
813+ (++) Else modify Window register. This will automatically reload^M
814+ watchdog counter.^M
815+^M
816+ (#) Then the application program must refresh the IWDG counter at regular^M
817+ intervals during normal operation to prevent an MCU reset, using^M
818+ HAL_IWDG_Refresh() function.^M
819+^M
820+ *** IWDG HAL driver macros list ***^M
821+ ====================================^M
822+ [..]^M
823+ Below the list of most used macros in IWDG HAL driver:^M
824+ (+) __HAL_IWDG_START: Enable the IWDG peripheral^M
825+ (+) __HAL_IWDG_RELOAD_COUNTER: Reloads IWDG counter with value defined in^M
826+ the reload register^M
827+^M
828+ @endverbatim^M
829+ ******************************************************************************^M
830+ * @attention^M
831+ *^M
832+ * <h2><center>© Copyright (c) 2017 STMicroelectronics.^M
833+ * All rights reserved.</center></h2>^M
834+ *^M
835+ * This software component is licensed by ST under BSD 3-Clause license,^M
836+ * the "License"; You may not use this file except in compliance with the^M
837+ * License. You may obtain a copy of the License at:^M
838+ * opensource.org/licenses/BSD-3-Clause^M
839+ *^M
840+ ******************************************************************************^M
841+ */^M
842+^M
843+/* Includes ------------------------------------------------------------------*/^M
844+#include "stm32l4xx_hal.h"^M
845+^M
846+/** @addtogroup STM32L4xx_HAL_Driver^M
847+ * @{^M
848+ */^M
849+^M
850+#ifdef HAL_IWDG_MODULE_ENABLED^M
851+/** @addtogroup IWDG^M
852+ * @brief IWDG HAL module driver.^M
853+ * @{^M
854+ */^M
855+^M
856+/* Private typedef -----------------------------------------------------------*/^M
857+/* Private define ------------------------------------------------------------*/^M
858+/** @defgroup IWDG_Private_Defines IWDG Private Defines^M
859+ * @{^M
860+ */^M
861+/* Status register need 5 RC LSI divided by prescaler clock to be updated. With^M
862+ higher prescaler (256), and according to LSI variation, we need to wait at^M
863+ least 6 cycles so 48 ms. */^M
864+#define HAL_IWDG_DEFAULT_TIMEOUT 48u^M
865+/**^M
866+ * @}^M
867+ */^M
868+^M
869+/* Private macro -------------------------------------------------------------*/^M
870+/* Private variables ---------------------------------------------------------*/^M
871+/* Private function prototypes -----------------------------------------------*/^M
872+/* Exported functions --------------------------------------------------------*/^M
873+^M
874+/** @addtogroup IWDG_Exported_Functions^M
875+ * @{^M
876+ */^M
877+^M
878+/** @addtogroup IWDG_Exported_Functions_Group1^M
879+ * @brief Initialization and Start functions.^M
880+ *^M
881+@verbatim^M
882+ ===============================================================================^M
883+ ##### Initialization and Start functions #####^M
884+ ===============================================================================^M
885+ [..] This section provides functions allowing to:^M
886+ (+) Initialize the IWDG according to the specified parameters in the^M
887+ IWDG_InitTypeDef of associated handle.^M
888+ (+) Manage Window option.^M
889+ (+) Once initialization is performed in HAL_IWDG_Init function, Watchdog^M
890+ is reloaded in order to exit function with correct time base.^M
891+^M
892+@endverbatim^M
893+ * @{^M
894+ */^M
895+^M
896+/**^M
897+ * @brief Initialize the IWDG according to the specified parameters in the^M
898+ * IWDG_InitTypeDef and start watchdog. Before exiting function,^M
899+ * watchdog is refreshed in order to have correct time base.^M
900+ * @param hiwdg pointer to a IWDG_HandleTypeDef structure that contains^M
901+ * the configuration information for the specified IWDG module.^M
902+ * @retval HAL status^M
903+ */^M
904+HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg)^M
905+{^M
906+ uint32_t tickstart;^M
907+^M
908+ /* Check the IWDG handle allocation */^M
909+ if (hiwdg == NULL)^M
910+ {^M
911+ return HAL_ERROR;^M
912+ }^M
913+^M
914+ /* Check the parameters */^M
915+ assert_param(IS_IWDG_ALL_INSTANCE(hiwdg->Instance));^M
916+ assert_param(IS_IWDG_PRESCALER(hiwdg->Init.Prescaler));^M
917+ assert_param(IS_IWDG_RELOAD(hiwdg->Init.Reload));^M
918+ assert_param(IS_IWDG_WINDOW(hiwdg->Init.Window));^M
919+^M
920+ /* Enable IWDG. LSI is turned on automaticaly */^M
921+ __HAL_IWDG_START(hiwdg);^M
922+^M
923+ /* Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers by writing^M
924+ 0x5555 in KR */^M
925+ IWDG_ENABLE_WRITE_ACCESS(hiwdg);^M
926+^M
927+ /* Write to IWDG registers the Prescaler & Reload values to work with */^M
928+ hiwdg->Instance->PR = hiwdg->Init.Prescaler;^M
929+ hiwdg->Instance->RLR = hiwdg->Init.Reload;^M
930+^M
931+ /* Check pending flag, if previous update not done, return timeout */^M
932+ tickstart = HAL_GetTick();^M
933+^M
934+ /* Wait for register to be updated */^M
935+ while (hiwdg->Instance->SR != 0x00u)^M
936+ {^M
937+ if ((HAL_GetTick() - tickstart) > HAL_IWDG_DEFAULT_TIMEOUT)^M
938+ {^M
939+ return HAL_TIMEOUT;^M
940+ }^M
941+ }^M
942+^M
943+ /* If window parameter is different than current value, modify window^M
944+ register */^M
945+ if (hiwdg->Instance->WINR != hiwdg->Init.Window)^M
946+ {^M
947+ /* Write to IWDG WINR the IWDG_Window value to compare with. In any case,^M
948+ even if window feature is disabled, Watchdog will be reloaded by writing^M
949+ windows register */^M
950+ hiwdg->Instance->WINR = hiwdg->Init.Window;^M
951+ }^M
952+ else^M
953+ {^M
954+ /* Reload IWDG counter with value defined in the reload register */^M
955+ __HAL_IWDG_RELOAD_COUNTER(hiwdg);^M
956+ }^M
957+^M
958+ /* Return function status */^M
959+ return HAL_OK;^M
960+}^M
961+^M
962+/**^M
963+ * @}^M
964+ */^M
965+^M
966+^M
967+/** @addtogroup IWDG_Exported_Functions_Group2^M
968+ * @brief IO operation functions^M
969+ *^M
970+@verbatim^M
971+ ===============================================================================^M
972+ ##### IO operation functions #####^M
973+ ===============================================================================^M
974+ [..] This section provides functions allowing to:^M
975+ (+) Refresh the IWDG.^M
976+^M
977+@endverbatim^M
978+ * @{^M
979+ */^M
980+^M
981+^M
982+/**^M
983+ * @brief Refresh the IWDG.^M
984+ * @param hiwdg pointer to a IWDG_HandleTypeDef structure that contains^M
985+ * the configuration information for the specified IWDG module.^M
986+ * @retval HAL status^M
987+ */^M
988+HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg)^M
989+{^M
990+ /* Reload IWDG counter with value defined in the reload register */^M
991+ __HAL_IWDG_RELOAD_COUNTER(hiwdg);^M
992+^M
993+ /* Return function status */^M
994+ return HAL_OK;^M
995+}^M
996+^M
997+/**^M
998+ * @}^M
999+ */^M
1000+^M
1001+/**^M
1002+ * @}^M
1003+ */^M
1004+^M
1005+#endif /* HAL_IWDG_MODULE_ENABLED */^M
1006+/**^M
1007+ * @}^M
1008+ */^M
1009+^M
1010+/**^M
1011+ * @}^M
1012+ */^M
1013+^M
1014+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/^M
1015diff --git a/Inc/FreeRTOSConfig.h b/Inc/FreeRTOSConfig.h
1016index f86195a..7f2a1f0 100644
1017--- a/Inc/FreeRTOSConfig.h
1018+++ b/Inc/FreeRTOSConfig.h
1019@@ -1,129 +1,129 @@
1020-/* USER CODE BEGIN Header */
1021-/*
1022- * FreeRTOS Kernel V10.0.1
1023- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1024- *
1025- * Permission is hereby granted, free of charge, to any person obtaining a copy of
1026- * this software and associated documentation files (the "Software"), to deal in
1027- * the Software without restriction, including without limitation the rights to
1028- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1029- * the Software, and to permit persons to whom the Software is furnished to do so,
1030- * subject to the following conditions:
1031- *
1032- * The above copyright notice and this permission notice shall be included in all
1033- * copies or substantial portions of the Software.
1034- *
1035- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1036- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1037- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1038- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1039- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1040- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1041- *
1042- * http://www.FreeRTOS.org
1043- * http://aws.amazon.com/freertos
1044- *
1045- * 1 tab == 4 spaces!
1046- */
1047-/* USER CODE END Header */
1048-
1049-#ifndef FREERTOS_CONFIG_H
1050-#define FREERTOS_CONFIG_H
1051-
1052-/*-----------------------------------------------------------
1053- * Application specific definitions.
1054- *
1055- * These definitions should be adjusted for your particular hardware and
1056- * application requirements.
1057- *
1058- * These parameters and more are described within the 'configuration' section of the
1059- * FreeRTOS API documentation available on the FreeRTOS.org web site.
1060- *
1061- * See http://www.freertos.org/a00110.html
1062- *----------------------------------------------------------*/
1063-
1064-/* USER CODE BEGIN Includes */
1065-/* Section where include file can be added */
1066-/* USER CODE END Includes */
1067-
1068-/* Ensure definitions are only used by the compiler, and not by the assembler. */
1069-#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
1070-#include <stdint.h>
1071-extern uint32_t SystemCoreClock;
1072-#endif
1073-#define configUSE_PREEMPTION 1
1074-#define configSUPPORT_STATIC_ALLOCATION 1
1075-#define configSUPPORT_DYNAMIC_ALLOCATION 0
1076-#define configUSE_IDLE_HOOK 0
1077-#define configUSE_TICK_HOOK 0
1078-#define configCPU_CLOCK_HZ ( SystemCoreClock )
1079-#define configTICK_RATE_HZ ((TickType_t)1000)
1080-#define configMAX_PRIORITIES ( 7 )
1081-#define configMINIMAL_STACK_SIZE ((uint16_t)128)
1082-#define configMAX_TASK_NAME_LEN ( 16 )
1083-#define configUSE_16_BIT_TICKS 0
1084-#define configUSE_MUTEXES 1
1085-#define configQUEUE_REGISTRY_SIZE 8
1086-#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
1087-
1088-/* Co-routine definitions. */
1089-#define configUSE_CO_ROUTINES 0
1090-#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
1091-
1092-/* Set the following definitions to 1 to include the API function, or zero
1093-to exclude the API function. */
1094-#define INCLUDE_vTaskPrioritySet 1
1095-#define INCLUDE_uxTaskPriorityGet 1
1096-#define INCLUDE_vTaskDelete 1
1097-#define INCLUDE_vTaskCleanUpResources 0
1098-#define INCLUDE_vTaskSuspend 1
1099-#define INCLUDE_vTaskDelayUntil 0
1100-#define INCLUDE_vTaskDelay 1
1101-#define INCLUDE_xTaskGetSchedulerState 1
1102-
1103-/* Cortex-M specific definitions. */
1104-#ifdef __NVIC_PRIO_BITS
1105-/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
1106-#define configPRIO_BITS __NVIC_PRIO_BITS
1107-#else
1108-#define configPRIO_BITS 4
1109-#endif
1110-
1111-/* The lowest interrupt priority that can be used in a call to a "set priority"
1112-function. */
1113-#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
1114-
1115-/* The highest interrupt priority that can be used by any interrupt service
1116-routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
1117-INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
1118-PRIORITY THAN THIS! (higher priorities are lower numeric values. */
1119-#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
1120-
1121-/* Interrupt priorities used by the kernel port layer itself. These are generic
1122-to all Cortex-M ports, and do not rely on any particular library functions. */
1123-#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
1124-/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
1125-See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
1126-#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
1127-
1128-/* Normal assert() semantics without relying on the provision of an assert.h
1129-header file. */
1130-/* USER CODE BEGIN 1 */
1131-#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}
1132-/* USER CODE END 1 */
1133-
1134-/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
1135-standard names. */
1136-#define vPortSVCHandler SVC_Handler
1137-#define xPortPendSVHandler PendSV_Handler
1138-
1139-/* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick,
1140- to prevent overwriting SysTick_Handler defined within STM32Cube HAL */
1141-
1142-#define xPortSysTickHandler SysTick_Handler
1143-
1144-/* USER CODE BEGIN Defines */
1145-/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
1146-/* USER CODE END Defines */
1147-
1148-#endif /* FREERTOS_CONFIG_H */
1149+/* USER CODE BEGIN Header */^M
1150+/*^M
1151+ * FreeRTOS Kernel V10.0.1^M
1152+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.^M
1153+ *^M
1154+ * Permission is hereby granted, free of charge, to any person obtaining a copy of^M
1155+ * this software and associated documentation files (the "Software"), to deal in^M
1156+ * the Software without restriction, including without limitation the rights to^M
1157+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of^M
1158+ * the Software, and to permit persons to whom the Software is furnished to do so,^M
1159+ * subject to the following conditions:^M
1160+ *^M
1161+ * The above copyright notice and this permission notice shall be included in all^M
1162+ * copies or substantial portions of the Software.^M
1163+ *^M
1164+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR^M
1165+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS^M
1166+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR^M
1167+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER^M
1168+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN^M
1169+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.^M
1170+ *^M
1171+ * http://www.FreeRTOS.org^M
1172+ * http://aws.amazon.com/freertos^M
1173+ *^M
1174+ * 1 tab == 4 spaces!^M
1175+ */^M
1176+ /* USER CODE END Header */^M
1177+^M
1178+#ifndef FREERTOS_CONFIG_H^M
1179+#define FREERTOS_CONFIG_H^M
1180+^M
1181+/*-----------------------------------------------------------^M
1182+ * Application specific definitions.^M
1183+ *^M
1184+ * These definitions should be adjusted for your particular hardware and^M
1185+ * application requirements.^M
1186+ *^M
1187+ * These parameters and more are described within the 'configuration' section of the^M
1188+ * FreeRTOS API documentation available on the FreeRTOS.org web site.^M
1189+ *^M
1190+ * See http://www.freertos.org/a00110.html^M
1191+ *----------------------------------------------------------*/^M
1192+^M
1193+/* USER CODE BEGIN Includes */ ^M
1194+/* Section where include file can be added */^M
1195+/* USER CODE END Includes */ ^M
1196+^M
1197+/* Ensure definitions are only used by the compiler, and not by the assembler. */^M
1198+#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)^M
1199+ #include <stdint.h>^M
1200+ extern uint32_t SystemCoreClock;^M
1201+#endif^M
1202+#define configUSE_PREEMPTION 1^M
1203+#define configSUPPORT_STATIC_ALLOCATION 1^M
1204+#define configSUPPORT_DYNAMIC_ALLOCATION 0^M
1205+#define configUSE_IDLE_HOOK 0^M
1206+#define configUSE_TICK_HOOK 0^M
1207+#define configCPU_CLOCK_HZ ( SystemCoreClock )^M
1208+#define configTICK_RATE_HZ ((TickType_t)1000)^M
1209+#define configMAX_PRIORITIES ( 7 )^M
1210+#define configMINIMAL_STACK_SIZE ((uint16_t)128)^M
1211+#define configMAX_TASK_NAME_LEN ( 16 )^M
1212+#define configUSE_16_BIT_TICKS 0^M
1213+#define configUSE_MUTEXES 1^M
1214+#define configQUEUE_REGISTRY_SIZE 8^M
1215+#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1^M
1216+^M
1217+/* Co-routine definitions. */^M
1218+#define configUSE_CO_ROUTINES 0^M
1219+#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )^M
1220+^M
1221+/* Set the following definitions to 1 to include the API function, or zero^M
1222+to exclude the API function. */^M
1223+#define INCLUDE_vTaskPrioritySet 1^M
1224+#define INCLUDE_uxTaskPriorityGet 1^M
1225+#define INCLUDE_vTaskDelete 1^M
1226+#define INCLUDE_vTaskCleanUpResources 0^M
1227+#define INCLUDE_vTaskSuspend 1^M
1228+#define INCLUDE_vTaskDelayUntil 0^M
1229+#define INCLUDE_vTaskDelay 1^M
1230+#define INCLUDE_xTaskGetSchedulerState 1^M
1231+^M
1232+/* Cortex-M specific definitions. */^M
1233+#ifdef __NVIC_PRIO_BITS^M
1234+ /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */^M
1235+ #define configPRIO_BITS __NVIC_PRIO_BITS^M
1236+#else^M
1237+ #define configPRIO_BITS 4^M
1238+#endif^M
1239+^M
1240+/* The lowest interrupt priority that can be used in a call to a "set priority"^M
1241+function. */^M
1242+#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15^M
1243+^M
1244+/* The highest interrupt priority that can be used by any interrupt service^M
1245+routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL^M
1246+INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER^M
1247+PRIORITY THAN THIS! (higher priorities are lower numeric values. */^M
1248+#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5^M
1249+^M
1250+/* Interrupt priorities used by the kernel port layer itself. These are generic^M
1251+to all Cortex-M ports, and do not rely on any particular library functions. */^M
1252+#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )^M
1253+/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!^M
1254+See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */^M
1255+#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )^M
1256+^M
1257+/* Normal assert() semantics without relying on the provision of an assert.h^M
1258+header file. */^M
1259+/* USER CODE BEGIN 1 */^M
1260+#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}^M
1261+/* USER CODE END 1 */^M
1262+^M
1263+/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS^M
1264+standard names. */^M
1265+#define vPortSVCHandler SVC_Handler^M
1266+#define xPortPendSVHandler PendSV_Handler^M
1267+^M
1268+/* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick,^M
1269+ to prevent overwriting SysTick_Handler defined within STM32Cube HAL */^M
1270+ ^M
1271+#define xPortSysTickHandler SysTick_Handler^M
1272+^M
1273+/* USER CODE BEGIN Defines */ ^M
1274+/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */^M
1275+/* USER CODE END Defines */ ^M
1276+^M
1277+#endif /* FREERTOS_CONFIG_H */^M
1278diff --git a/Inc/bsp_driver_sd.h b/Inc/bsp_driver_sd.h
1279index bce88df..56fb593 100644
1280--- a/Inc/bsp_driver_sd.h
1281+++ b/Inc/bsp_driver_sd.h
1282@@ -1,98 +1,98 @@
1283-/**
1284- ******************************************************************************
1285- * @file bsp_driver_sd.h (based on stm32l4r9i_eval_sd.h)
1286- * @brief This file contains the common defines and functions prototypes for
1287- * the bsp_driver_sd.c driver.
1288- ******************************************************************************
1289- * @attention
1290- *
1291- * <h2><center>© Copyright (c) 2019 STMicroelectronics.
1292- * All rights reserved.</center></h2>
1293- *
1294- * This software component is licensed by ST under Ultimate Liberty license
1295- * SLA0044, the "License"; You may not use this file except in compliance with
1296- * the License. You may obtain a copy of the License at:
1297- * www.st.com/SLA0044
1298- *
1299- ******************************************************************************
1300- */
1301-
1302-/* Define to prevent recursive inclusion -------------------------------------*/
1303-#ifndef __STM32L4_SD_H
1304-#define __STM32L4_SD_H
1305-
1306-#ifdef __cplusplus
1307-extern "C" {
1308-#endif
1309-
1310-/* Includes ------------------------------------------------------------------*/
1311-#include "stm32l4xx_hal.h"
1312-#include "fatfs_platform.h"
1313-
1314-/* Exported types ------------------------------------------------------------*/
1315-
1316-/**
1317- * @brief SD Card information structure
1318- */
1319-#define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef
1320-
1321-/* Exported constants --------------------------------------------------------*/
1322-/**
1323- * @brief SD status structure definition
1324- */
1325-#define MSD_OK ((uint8_t)0x00)
1326-#define MSD_ERROR ((uint8_t)0x01)
1327-#define MSD_ERROR_SD_NOT_PRESENT ((uint8_t)0x02)
1328-
1329-/**
1330- * @brief SD transfer state definition
1331- */
1332-#define SD_TRANSFER_OK ((uint8_t)0x00)
1333-#define SD_TRANSFER_BUSY ((uint8_t)0x01)
1334-#define SD_TRANSFER_ERROR ((uint8_t)0x02)
1335-
1336-#define SD_DATATIMEOUT ((uint32_t)100000000)
1337-
1338-#define SD_PRESENT ((uint8_t)0x01)
1339-#define SD_NOT_PRESENT ((uint8_t)0x00)
1340-
1341-#ifdef OLD_API
1342-/* kept to avoid issue when migrating old projects. */
1343-/* USER CODE BEGIN 0 */
1344-
1345-/* USER CODE END 0 */
1346-#else
1347-/* USER CODE BEGIN BSP_H_CODE */
1348-/* Exported functions --------------------------------------------------------*/
1349-uint8_t BSP_SD_Init(void);
1350-uint8_t BSP_SD_ITConfig(void);
1351-void BSP_SD_DetectIT(void);
1352-void BSP_SD_DetectCallback(void);
1353-uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr,
1354- uint32_t NumOfBlocks, uint32_t Timeout);
1355-uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr,
1356- uint32_t NumOfBlocks, uint32_t Timeout);
1357-uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr,
1358- uint32_t NumOfBlocks);
1359-uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr,
1360- uint32_t NumOfBlocks);
1361-uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
1362-uint8_t BSP_SD_GetCardState(void);
1363-void BSP_SD_GetCardInfo(BSP_SD_CardInfo *CardInfo);
1364-uint8_t BSP_SD_IsDetected(void);
1365-/* USER CODE END BSP_H_CODE */
1366-#endif
1367-/* USER CODE BEGIN CallBacksSection_H */
1368-/* These __weak functions can be surcharged by application code in case the current settings
1369- (eg. interrupt priority, callbacks implementation) need to be changed for specific application needs */
1370-void BSP_SD_AbortCallback(void);
1371-void BSP_SD_WriteCpltCallback(void);
1372-void BSP_SD_ReadCpltCallback(void);
1373-/* USER CODE END CallBacksSection_H */
1374-#ifdef __cplusplus
1375-}
1376-#endif
1377-
1378-#endif /* __STM32L4_SD_H */
1379-
1380-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
1381+/**^M
1382+ ******************************************************************************^M
1383+ * @file bsp_driver_sd.h (based on stm32l4r9i_eval_sd.h)^M
1384+ * @brief This file contains the common defines and functions prototypes for ^M
1385+ * the bsp_driver_sd.c driver.^M
1386+ ******************************************************************************^M
1387+ * @attention^M
1388+ *^M
1389+ * <h2><center>© Copyright (c) 2019 STMicroelectronics.^M
1390+ * All rights reserved.</center></h2>^M
1391+ *^M
1392+ * This software component is licensed by ST under Ultimate Liberty license^M
1393+ * SLA0044, the "License"; You may not use this file except in compliance with^M
1394+ * the License. You may obtain a copy of the License at:^M
1395+ * www.st.com/SLA0044^M
1396+ *^M
1397+ ******************************************************************************^M
1398+ */^M
1399+^M
1400+/* Define to prevent recursive inclusion -------------------------------------*/^M
1401+#ifndef __STM32L4_SD_H^M
1402+#define __STM32L4_SD_H^M
1403+^M
1404+#ifdef __cplusplus^M
1405+ extern "C" {^M
1406+#endif ^M
1407+^M
1408+/* Includes ------------------------------------------------------------------*/^M
1409+#include "stm32l4xx_hal.h"^M
1410+#include "fatfs_platform.h"^M
1411+^M
1412+/* Exported types ------------------------------------------------------------*/^M
1413+^M
1414+/** ^M
1415+ * @brief SD Card information structure ^M
1416:
1417- (eg. interrupt priority, callbacks implementation) need to be changed for specific application needs */
1418-void BSP_SD_AbortCallback(void);
1419-void BSP_SD_WriteCpltCallback(void);
1420-void BSP_SD_ReadCpltCallback(void);
1421-/* USER CODE END CallBacksSection_H */
1422-#ifdef __cplusplus
1423-}
1424-#endif
1425-
1426-#endif /* __STM32L4_SD_H */
1427-
1428-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
1429+/**^M
1430+ ******************************************************************************^M
1431+ * @file bsp_driver_sd.h (based on stm32l4r9i_eval_sd.h)^M
1432+ * @brief This file contains the common defines and functions prototypes for ^M
1433+ * the bsp_driver_sd.c driver.^M
1434+ ******************************************************************************^M
1435+ * @attention^M
1436:
1437- (eg. interrupt priority, callbacks implementation) need to be changed for specific application needs */
1438-void BSP_SD_AbortCallback(void);
1439-void BSP_SD_WriteCpltCallback(void);
1440-void BSP_SD_ReadCpltCallback(void);
1441-/* USER CODE END CallBacksSection_H */
1442-#ifdef __cplusplus
1443-}
1444-#endif
1445-
1446-#endif /* __STM32L4_SD_H */
1447-
1448-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
1449+/**^M
1450+ ******************************************************************************^M
1451+ * @file bsp_driver_sd.h (based on stm32l4r9i_eval_sd.h)^M
1452+ * @brief This file contains the common defines and functions prototypes for ^M
1453+ * the bsp_driver_sd.c driver.^M
1454+ ******************************************************************************^M
1455+ * @attention^M
1456+ *^M
1457+ * <h2><center>© Copyright (c) 2019 STMicroelectronics.^M
1458+ * All rights reserved.</center></h2>^M
1459+ *^M
1460+ * This software component is licensed by ST under Ultimate Liberty license^M
1461+ * SLA0044, the "License"; You may not use this file except in compliance with^M
1462+ * the License. You may obtain a copy of the License at:^M
1463+ * www.st.com/SLA0044^M
1464+ *^M
1465+ ******************************************************************************^M
1466+ */^M
1467+^M
1468+/* Define to prevent recursive inclusion -------------------------------------*/^M
1469+#ifndef __STM32L4_SD_H^M
1470+#define __STM32L4_SD_H^M
1471+^M
1472+#ifdef __cplusplus^M
1473+ extern "C" {^M
1474+#endif ^M
1475+^M
1476+/* Includes ------------------------------------------------------------------*/^M
1477+#include "stm32l4xx_hal.h"^M
1478+#include "fatfs_platform.h"^M
1479+^M
1480+/* Exported types ------------------------------------------------------------*/^M
1481+^M
1482+/** ^M
1483+ * @brief SD Card information structure ^M
1484+ */^M
1485+#define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef^M
1486+^M
1487+/* Exported constants --------------------------------------------------------*/ ^M
1488+/**^M
1489+ * @brief SD status structure definition ^M
1490+ */ ^M
1491+#define MSD_OK ((uint8_t)0x00)^M
1492+#define MSD_ERROR ((uint8_t)0x01)^M
1493+#define MSD_ERROR_SD_NOT_PRESENT ((uint8_t)0x02)^M
1494+^M
1495+/** ^M
1496+ * @brief SD transfer state definition ^M
1497+ */ ^M
1498+#define SD_TRANSFER_OK ((uint8_t)0x00)^M
1499+#define SD_TRANSFER_BUSY ((uint8_t)0x01)^M
1500+#define SD_TRANSFER_ERROR ((uint8_t)0x02)^M
1501+^M
1502+#define SD_DATATIMEOUT ((uint32_t)100000000)^M
1503+^M
1504+#define SD_PRESENT ((uint8_t)0x01)^M
1505+#define SD_NOT_PRESENT ((uint8_t)0x00)^M
1506+^M
1507+#ifdef OLD_API^M
1508+/* kept to avoid issue when migrating old projects. */^M
1509+/* USER CODE BEGIN 0 */^M
1510+^M
1511+/* USER CODE END 0 */ ^M
1512+#else^M
1513+/* USER CODE BEGIN BSP_H_CODE */^M
1514+/* Exported functions --------------------------------------------------------*/^M
1515+uint8_t BSP_SD_Init(void);^M
1516+uint8_t BSP_SD_ITConfig(void);^M
1517+void BSP_SD_DetectIT(void);^M
1518+void BSP_SD_DetectCallback(void);^M
1519+uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr,^M
1520+ uint32_t NumOfBlocks, uint32_t Timeout);^M
1521+uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr,^M
1522+ uint32_t NumOfBlocks, uint32_t Timeout);^M
1523+uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr,^M
1524+ uint32_t NumOfBlocks);^M
1525+uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr,^M
1526+ uint32_t NumOfBlocks);^M
1527+uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);^M
1528+uint8_t BSP_SD_GetCardState(void);^M
1529+void BSP_SD_GetCardInfo(BSP_SD_CardInfo *CardInfo);^M
1530+uint8_t BSP_SD_IsDetected(void);^M
1531+/* USER CODE END BSP_H_CODE */^M
1532+#endif^M
1533+/* USER CODE BEGIN CallBacksSection_H */^M
1534+/* These __weak functions can be surcharged by application code in case the current settings^M
1535+ (eg. interrupt priority, callbacks implementation) need to be changed for specific application needs */^M
1536+void BSP_SD_AbortCallback(void);^M
1537+void BSP_SD_WriteCpltCallback(void);^M
1538+void BSP_SD_ReadCpltCallback(void);^M
1539+/* USER CODE END CallBacksSection_H */ ^M
1540+#ifdef __cplusplus^M
1541+}^M
1542+#endif^M
1543+^M
1544+#endif /* __STM32L4_SD_H */^M
1545+^M
1546+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/^M
1547diff --git a/Inc/fatfs.h b/Inc/fatfs.h
1548index a66cb24..cc4292b 100644
1549--- a/Inc/fatfs.h
1550+++ b/Inc/fatfs.h
1551@@ -1,49 +1,49 @@
1552-/**
1553- ******************************************************************************
1554- * @file fatfs.h
1555- * @brief Header for fatfs applications
1556- ******************************************************************************
1557- * @attention
1558- *
1559- * <h2><center>© Copyright (c) 2019 STMicroelectronics.
1560- * All rights reserved.</center></h2>
1561- *
1562- * This software component is licensed by ST under Ultimate Liberty license
1563- * SLA0044, the "License"; You may not use this file except in compliance with
1564- * the License. You may obtain a copy of the License at:
1565- * www.st.com/SLA0044
1566- *
1567- ******************************************************************************
1568- */
1569-
1570-/* Define to prevent recursive inclusion -------------------------------------*/
1571-#ifndef __fatfs_H
1572-#define __fatfs_H
1573-#ifdef __cplusplus
1574-extern "C" {
1575-#endif
1576-
1577-#include "ff.h"
1578-#include "ff_gen_drv.h"
1579-#include "sd_diskio.h" /* defines SD_Driver as external */
1580-
1581-/* USER CODE BEGIN Includes */
1582-
1583-/* USER CODE END Includes */
1584-
1585-extern uint8_t retSD; /* Return value for SD */
1586-extern char SDPath[4]; /* SD logical drive path */
1587-extern FATFS SDFatFS; /* File system object for SD logical drive */
1588-extern FIL SDFile; /* File object for SD */
1589-
1590-void MX_FATFS_Init(void);
1591-
1592-/* USER CODE BEGIN Prototypes */
1593-
1594-/* USER CODE END Prototypes */
1595-#ifdef __cplusplus
1596-}
1597-#endif
1598-#endif /*__fatfs_H */
1599-
1600-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
1601+/**^M
1602+ ******************************************************************************^M
1603+ * @file fatfs.h^M
1604+ * @brief Header for fatfs applications^M
1605+ ******************************************************************************^M
1606+ * @attention^M
1607+ *^M
1608+ * <h2><center>© Copyright (c) 2019 STMicroelectronics.^M
1609+ * All rights reserved.</center></h2>^M
1610+ *^M
1611+ * This software component is licensed by ST under Ultimate Liberty license^M
1612+ * SLA0044, the "License"; You may not use this file except in compliance with^M
1613+ * the License. You may obtain a copy of the License at:^M
1614+ * www.st.com/SLA0044^M
1615+ *^M
1616+ ******************************************************************************^M
1617+ */^M
1618+^M
1619+/* Define to prevent recursive inclusion -------------------------------------*/^M
1620+#ifndef __fatfs_H^M
1621+#define __fatfs_H^M
1622+#ifdef __cplusplus^M
1623+ extern "C" {^M
1624+#endif^M
1625+^M
1626+#include "ff.h"^M
1627+#include "ff_gen_drv.h"^M
1628+#include "sd_diskio.h" /* defines SD_Driver as external */^M
1629+^M
1630+/* USER CODE BEGIN Includes */^M
1631+^M
1632+/* USER CODE END Includes */^M
1633+^M
1634+extern uint8_t retSD; /* Return value for SD */^M
1635+extern char SDPath[4]; /* SD logical drive path */^M
1636+extern FATFS SDFatFS; /* File system object for SD logical drive */^M
1637+extern FIL SDFile; /* File object for SD */^M
1638+^M
1639+void MX_FATFS_Init(void);^M
1640+^M
1641+/* USER CODE BEGIN Prototypes */^M
1642+^M
1643+/* USER CODE END Prototypes */^M
1644+#ifdef __cplusplus^M
1645+}^M
1646+#endif^M
1647+#endif /*__fatfs_H */^M
1648+^M
1649+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/^M