annotate Small_CPU/Inc/RTE_FlashAccess.h @ 805:dd7ce655db26

Adds a simple countdown timer, available as a custom view in surface and dive mode. This can be used to time safety stops, or to prebreathe a CCR (or to boil your breakfast eggs if you are so inclined). The duration of the timer is configurable from 1 second to 9:59 minutes in the System menu. The timer is started by switching to the custom view, and remaining on it until a 10 second delay has elapsed. Once the timer has started the custom view can be changed and the timer will continue running in the background. After the timer has run out 'Finished' will be shown for 10 seconds in the timer custom view, and then automatic switching of custom views (if configured) resumes. In surface mode the dive computer will not go to sleep while the timer is running, and a mini timer will be shown when the timer custom view is not showing. (mikeller)
author heinrichsweikamp
date Mon, 21 Aug 2023 17:20:07 +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****/