Mercurial > public > ostc4
annotate Small_CPU/Inc/RTE_FlashAccess.h @ 821:d50fcab7a3ce
1.6.5 release
author | heinrichsweikamp |
---|---|
date | Mon, 25 Sep 2023 10:56:32 +0200 |
parents | 91a8f9893e68 |
children |
rev | line source |
---|---|
38 | 1 /** |
2 ****************************************************************************** | |
3 * @file RTE_FLashAccess.h based on BonexFLashAccess.h based on firmwareEraseProgram.h | |
4 * @author heinrichs weikamp gmbh | |
5 * @version V0.0.1 | |
6 * @date 20-July-2016 | |
7 * @version V0.0.1 | |
8 * @since 20-July-2016 | |
9 * @brief erase and program the STM32F4xx internal FLASH memory for compasss calib etc. | |
10 * | |
11 @verbatim | |
12 ============================================================================== | |
13 ##### How to use ##### | |
14 ============================================================================== | |
15 @endverbatim | |
16 ****************************************************************************** | |
17 * @attention | |
18 * | |
19 * <h2><center>© COPYRIGHT(c) 2016 heinrichs weikamp</center></h2> | |
20 * | |
21 ****************************************************************************** | |
22 */ | |
23 | |
24 /* Define to prevent recursive inclusion -------------------------------------*/ | |
25 #ifndef RTE_FLASH_ACCESS_H | |
26 #define RTE_FLASH_ACCESS_H | |
27 | |
28 #ifdef __cplusplus | |
29 extern "C" { | |
30 #endif | |
31 | |
32 /* Includes ------------------------------------------------------------------*/ | |
33 #include "stm32f4xx_hal.h" | |
34 | |
35 /* Exported variables --------------------------------------------------------*/ | |
36 /* Exported types ------------------------------------------------------------*/ | |
37 enum | |
38 { | |
39 BFA_OK = 0, //= HAL_OK | |
40 BFA_ERROR = (uint8_t)HAL_ERROR, | |
41 BFA_BUSY = (uint8_t)HAL_BUSY, | |
42 BFA_TIMEOUT = (uint8_t)HAL_TIMEOUT, | |
43 BFA_EMPTY, | |
44 }; | |
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 | 78 /* Exported functions --------------------------------------------------------*/ |
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 | 83 |
84 #ifdef __cplusplus | |
85 } | |
86 #endif | |
87 | |
88 #endif /* RTE_FLASH_ACCESS_H */ | |
89 | |
90 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/ |