annotate Small_CPU/Inc/RTE_FlashAccess.h @ 858:08ea8e9d6cfe Evo_2_23

Bugfix initialisation of surface pressure: A reset of the RTE less than one minute before a dive starts may cause problems in the depth calculation because the default pressure is not set yet. To avoid this the first measured pressure value will now be used as stable surface pressure to close the gap till the stable surface pressure is evaluated.
author Ideenmodellierer
date Tue, 07 May 2024 21:12:37 +0200
parents 91a8f9893e68
children
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 RTE_FLashAccess.h based on BonexFLashAccess.h based on firmwareEraseProgram.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 20-July-2016
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 * @since 20-July-2016
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 * @brief erase and program the STM32F4xx internal FLASH memory for compasss calib etc.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 ##### How to use #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 * <h2><center>&copy; COPYRIGHT(c) 2016 heinrichs weikamp</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 /* Define to prevent recursive inclusion -------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 #ifndef RTE_FLASH_ACCESS_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 #define RTE_FLASH_ACCESS_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 extern "C" {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 /* Exported variables --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 /* Exported types ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 enum
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 BFA_OK = 0, //= HAL_OK
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 BFA_ERROR = (uint8_t)HAL_ERROR,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 BFA_BUSY = (uint8_t)HAL_BUSY,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 BFA_TIMEOUT = (uint8_t)HAL_TIMEOUT,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 BFA_EMPTY,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45
571
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
46 /// split word to 2 bytes
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
47 typedef struct{
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
48 uint8_t low; ///< split word to 2 bytes
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
49 uint8_t hi; ///< split word to 2 bytes
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
50 } two_byte;
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
51
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
52
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
53 /// split word to 2 bytes
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
54 typedef union{
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
55 two_byte Byte; ///< split word to 2 bytes
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
56 uint16_t Word; ///< split word to 2 bytes
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
57 } tword;
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
58
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
59
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
60 /// split signed word to 2 bytes
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
61 typedef union{
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
62 two_byte Byte; ///< split signed word to 2 bytes
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
63 int16_t Word; ///< split signed word to 2 bytes
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
64 } signed_tword;
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
65
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
66
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
67 /// split full32 to 2 words
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
68 typedef struct{
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
69 uint16_t low16; ///< split word to 2 bytes
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
70 uint16_t hi16; ///< split word to 2 bytes
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
71 } two_word;
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
72
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
73 typedef union{
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
74 two_word Word16; ///< split word to 2 bytes
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
75 uint32_t Full32; ///< split word to 2 bytes
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
76 } tfull32;
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
77
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79
571
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
80 uint8_t BFA_readLastDataBlock(tfull32 *dataArray4);
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
81 uint8_t BFA_writeDataBlock(const tfull32 *dataArray4);
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 38
diff changeset
82 uint16_t BFA_calc_Block_Checksum(const tfull32 *dataArray4);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 #endif /* RTE_FLASH_ACCESS_H */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/