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)
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/>.
23 // Available RTC backup registers (4-byte words) per MCU type
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
,
36 PERSISTENT_OBJECT_RESET_REASON
,
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
,
46 } persistentObjectId_e
;
48 // Values for PERSISTENT_OBJECT_RESET_REASON
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
);