comparison Discovery/Inc/externLogbookFlash.h @ 1027:158100a84ebd GasConsumption

New profile feature: In the past the OSTC provide just one instance for settings. If for example a diver switched from OC to CCR configuration several settings had to be modified. To improve this and to be more flexible in adapting the OSTC to differend dive scenarions the usage of up to 4 profiles has beem introduced. The profiles are copies of the common settings but stored in a separate, previously not used, flash section => no impact to existings settings handling. For access to the profiles the existing setting flash functions are reused. To enable this a parameter war introduced which defines the target of the operation (common settings or profiles).
author Ideenmodellierer
date Sun, 07 Sep 2025 19:03:44 +0200
parents eb2060caca7d
children
comparison
equal deleted inserted replaced
1026:5fedf7ba2392 1027:158100a84ebd
39 * after that two or more 0for settings (less than one necessary as of 26. March 2015) 39 * after that two or more 0for settings (less than one necessary as of 26. March 2015)
40 * 40 *
41 */ 41 */
42 #define DDSTART 0x00000000 42 #define DDSTART 0x00000000
43 #define DDSTOP 0x00000FFF 43 #define DDSTOP 0x00000FFF
44 #define unused1START 0x00001000 44
45 #define PROFILE0_START 0x00001000 /* store profiles within one 4k sector because they are always read / written as one block */
46 #define PROFILE0_STOP 0x000013FF /* no ring functionality is implemented because changes are not expected very often */
47 #define PROFILE1_START 0x00001400
48 #define PROFILE1_STOP 0x000017FF
49 #define PROFILE2_START 0x00001800
50 #define PROFILE2_STOP 0x00001BFF
51 #define PROFILE3_START 0x00001C00
52 #define PROFILE3_STOP 0x00001FFF
53
54 #define unused1START 0x00002000
45 #define unused1STOP 0x00007FFF 55 #define unused1STOP 0x00007FFF
46 56
47 /* 32 KB */ 57 /* 32 KB */
48 #define unused2START 0x00008000 58 #define unused2START 0x00008000
49 #define unused2STOP 0x0000FFFF 59 #define unused2STOP 0x0000FFFF
82 #define SECTOR_CLOSED (0) 92 #define SECTOR_CLOSED (0)
83 #define SECTOR_NOTUSED (1) 93 #define SECTOR_NOTUSED (1)
84 #define SECTOR_INUSE (4) 94 #define SECTOR_INUSE (4)
85 #define SECTOR_EMPTY (5) 95 #define SECTOR_EMPTY (5)
86 96
97
98 typedef enum{
99 EF_HEADER,
100 EF_SAMPLE,
101 EF_DEVICEDATA,
102 EF_VPMDATA,
103 EF_SETTINGS,
104 EF_FIRMWARE,
105 EF_FIRMWARE2,
106 EF_PROFILE0,
107 EF_PROFILE1,
108 EF_PROFILE2,
109 EF_PROFILE3,
110 }which_ring_enum;
111
112
87 /* Exported types ------------------------------------------------------------*/ 113 /* Exported types ------------------------------------------------------------*/
88 typedef struct{ 114 typedef struct{
89 uint8_t byteLow; 115 uint8_t byteLow;
90 uint8_t byteMidLow; 116 uint8_t byteMidLow;
91 uint8_t byteMidHigh; 117 uint8_t byteMidHigh;
106 WordToByte_t u8bit; 132 WordToByte_t u8bit;
107 uint16_t u16bit; 133 uint16_t u16bit;
108 } convert16_Type; 134 } convert16_Type;
109 135
110 /* Exported functions --------------------------------------------------------*/ 136 /* Exported functions --------------------------------------------------------*/
111 void ext_flash_write_settings(uint8_t resetRing); 137 void ext_flash_write_settings(uint8_t whichSettings, uint8_t resetRing);
112 uint8_t ext_flash_read_settings(void); 138 uint8_t ext_flash_read_settings(uint8_t whichSettings);
113 139
114 void ext_flash_write_devicedata(uint8_t resetRing); 140 void ext_flash_write_devicedata(uint8_t resetRing);
115 uint16_t ext_flash_read_devicedata(uint8_t *buffer, uint16_t max_length); 141 uint16_t ext_flash_read_devicedata(uint8_t *buffer, uint16_t max_length);
116 void ext_flash_read_fixed_16_devicedata_blocks_formated_128byte_total(uint8_t *buffer); 142 void ext_flash_read_fixed_16_devicedata_blocks_formated_128byte_total(uint8_t *buffer);
117 143