[4.4.2] Remove 15 m/s limit on estimated vario (#12788)
[betaflight.git] / src / main / drivers / persistent.h
blob8dddfe1754c23977db1ced10c879ceeb80206c55
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
23 // Available RTC backup registers (4-byte words) per MCU type
24 // F4: 20 words
25 // F7: 32 words
26 // H7: 32 words
28 typedef enum {
29 PERSISTENT_OBJECT_MAGIC = 0,
30 PERSISTENT_OBJECT_HSE_VALUE,
31 PERSISTENT_OBJECT_OVERCLOCK_LEVEL,
32 #ifdef USE_SPRACING_PERSISTENT_RTC_WORKAROUND
33 // SPRACING H7 firmware always leaves this value reset so only use this location to invoke DFU
34 PERSISTENT_OBJECT_RESET_REASON_FWONLY,
35 #else
36 PERSISTENT_OBJECT_RESET_REASON,
37 #endif
38 PERSISTENT_OBJECT_RTC_HIGH, // high 32 bits of rtcTime_t
39 PERSISTENT_OBJECT_RTC_LOW, // low 32 bits of rtcTime_t
40 PERSISTENT_OBJECT_SERIALRX_BAUD, // serial rx baudrate
41 PERSISTENT_OBJECT_COUNT,
42 #ifdef USE_SPRACING_PERSISTENT_RTC_WORKAROUND
43 // On SPRACING H7 firmware use this alternate location for all reset reasons interpreted by this firmware
44 PERSISTENT_OBJECT_RESET_REASON,
45 #endif
46 } persistentObjectId_e;
48 // Values for PERSISTENT_OBJECT_RESET_REASON
49 #define RESET_NONE 0
50 #define RESET_BOOTLOADER_REQUEST_ROM 1 // Boot loader invocation was requested
51 #define RESET_BOOTLOADER_POST 2 // Reset after boot loader activity
52 #define RESET_MSC_REQUEST 3 // MSC invocation was requested
53 #define RESET_FORCED 4 // Reset due to unknown reset reason
54 #define RESET_BOOTLOADER_REQUEST_FLASH 5
56 void persistentObjectInit(void);
57 uint32_t persistentObjectRead(persistentObjectId_e id);
58 void persistentObjectWrite(persistentObjectId_e id, uint32_t value);