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
+ − 46 /// split word to 2 bytes
+ − 47 typedef struct{
+ − 48 uint8_t low; ///< split word to 2 bytes
+ − 49 uint8_t hi; ///< split word to 2 bytes
+ − 50 } two_byte;
+ − 51
+ − 52
+ − 53 /// split word to 2 bytes
+ − 54 typedef union{
+ − 55 two_byte Byte; ///< split word to 2 bytes
+ − 56 uint16_t Word; ///< split word to 2 bytes
+ − 57 } tword;
+ − 58
+ − 59
+ − 60 /// split signed word to 2 bytes
+ − 61 typedef union{
+ − 62 two_byte Byte; ///< split signed word to 2 bytes
+ − 63 int16_t Word; ///< split signed word to 2 bytes
+ − 64 } signed_tword;
+ − 65
+ − 66
+ − 67 /// split full32 to 2 words
+ − 68 typedef struct{
+ − 69 uint16_t low16; ///< split word to 2 bytes
+ − 70 uint16_t hi16; ///< split word to 2 bytes
+ − 71 } two_word;
+ − 72
+ − 73 typedef union{
+ − 74 two_word Word16; ///< split word to 2 bytes
+ − 75 uint32_t Full32; ///< split word to 2 bytes
+ − 76 } tfull32;
+ − 77
38
+ − 78 /* Exported functions --------------------------------------------------------*/
+ − 79
571
+ − 80 uint8_t BFA_readLastDataBlock(tfull32 *dataArray4);
+ − 81 uint8_t BFA_writeDataBlock(const tfull32 *dataArray4);
+ − 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****/