Flipper Zero Firmware
Loading...
Searching...
No Matches
furi_hal_rtc.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <stdint.h>
9#include <stdbool.h>
10
11#include <datetime/datetime.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17typedef enum {
18 FuriHalRtcFlagDebug = (1 << 0),
19 FuriHalRtcFlagStorageFormatInternal = (1 << 1),
20 FuriHalRtcFlagLock = (1 << 2),
21 FuriHalRtcFlagC2Update = (1 << 3),
22 FuriHalRtcFlagHandOrient = (1 << 4),
23 FuriHalRtcFlagLegacySleep = (1 << 5),
24 FuriHalRtcFlagStealthMode = (1 << 6),
25 FuriHalRtcFlagDetailedFilename = (1 << 7),
26} FuriHalRtcFlag;
27
35
42
43typedef enum {
50 /* Index of FS directory entry corresponding to FW update to be applied */
51 FuriHalRtcRegisterUpdateFolderFSIndex,
52
55
60
65
71
78
89
92
95
97void furi_hal_rtc_init(void);
98
100void furi_hal_rtc_sync_shadow(void);
101
104
112
118void furi_hal_rtc_set_register(FuriHalRtcRegister reg, uint32_t value);
119
124void furi_hal_rtc_set_log_level(uint8_t level);
125
130uint8_t furi_hal_rtc_get_log_level(void);
131
137
143
149
155
160void furi_hal_rtc_set_flag(FuriHalRtcFlag flag);
161
166void furi_hal_rtc_reset_flag(FuriHalRtcFlag flag);
167
174bool furi_hal_rtc_is_flag_set(FuriHalRtcFlag flag);
175
181
187
193
199
205
211
217
223
229
235
240void furi_hal_rtc_set_datetime(DateTime* datetime);
241
246void furi_hal_rtc_get_datetime(DateTime* datetime);
247
252void furi_hal_rtc_set_fault_data(uint32_t value);
253
258uint32_t furi_hal_rtc_get_fault_data(void);
259
264void furi_hal_rtc_set_pin_fails(uint32_t value);
265
270uint32_t furi_hal_rtc_get_pin_fails(void);
271
276uint32_t furi_hal_rtc_get_timestamp(void);
277
278#ifdef __cplusplus
279}
280#endif
void furi_hal_rtc_set_log_baud_rate(FuriHalRtcLogBaudRate baud_rate)
Set logging baud rate.
Definition furi_hal_rtc.c:231
void furi_hal_rtc_set_locale_units(FuriHalRtcLocaleUnits value)
Set locale units.
Definition furi_hal_rtc.c:302
void furi_hal_rtc_reset_flag(FuriHalRtcFlag flag)
Reset RTC Flag.
Definition furi_hal_rtc.c:259
FuriHalRtcLocaleDateFormat
Definition furi_hal_rtc.h:66
@ FuriHalRtcLocaleDateFormatMDY
Month/Day/Year.
Definition furi_hal_rtc.h:68
@ FuriHalRtcLocaleDateFormatDMY
Day/Month/Year.
Definition furi_hal_rtc.h:67
@ FuriHalRtcLocaleDateFormatYMD
Year/Month/Day.
Definition furi_hal_rtc.h:69
FuriHalRtcHeapTrackMode furi_hal_rtc_get_heap_track_mode(void)
Get RTC Heap Track mode.
Definition furi_hal_rtc.c:296
void furi_hal_rtc_sync_shadow(void)
Force sync shadow registers.
Definition furi_hal_rtc.c:172
FuriHalRtcLocaleUnits
Definition furi_hal_rtc.h:56
@ FuriHalRtcLocaleUnitsMetric
Metric measurement units.
Definition furi_hal_rtc.h:57
@ FuriHalRtcLocaleUnitsImperial
Imperial measurement units.
Definition furi_hal_rtc.h:58
void furi_hal_rtc_set_pin_fails(uint32_t value)
Set Pin Fails count.
Definition furi_hal_rtc.c:406
FuriHalRtcLocaleTimeFormat
Definition furi_hal_rtc.h:61
@ FuriHalRtcLocaleTimeFormat24h
24-hour format
Definition furi_hal_rtc.h:62
@ FuriHalRtcLocaleTimeFormat12h
12-hour format
Definition furi_hal_rtc.h:63
void furi_hal_rtc_set_register(FuriHalRtcRegister reg, uint32_t value)
Set register content.
Definition furi_hal_rtc.c:196
FuriHalRtcHeapTrackMode
Definition furi_hal_rtc.h:36
@ FuriHalRtcHeapTrackModeAll
Enable allocation tracking for all threads.
Definition furi_hal_rtc.h:40
@ FuriHalRtcHeapTrackModeTree
Enable allocation tracking for main and children application threads.
Definition furi_hal_rtc.h:39
@ FuriHalRtcHeapTrackModeMain
Enable allocation tracking for main application thread.
Definition furi_hal_rtc.h:38
@ FuriHalRtcHeapTrackModeNone
Disable allocation tracking.
Definition furi_hal_rtc.h:37
FuriHalRtcLocaleDateFormat furi_hal_rtc_get_locale_dateformat(void)
Get RTC Locale Date Format.
Definition furi_hal_rtc.c:335
uint32_t furi_hal_rtc_get_register(FuriHalRtcRegister reg)
Get RTC register content.
Definition furi_hal_rtc.c:192
FuriHalRtcLogBaudRate
Definition furi_hal_rtc.h:79
@ FuriHalRtcLogBaudRate115200
115200 baud
Definition furi_hal_rtc.h:84
@ FuriHalRtcLogBaudRate460800
460800 baud
Definition furi_hal_rtc.h:85
@ FuriHalRtcLogBaudRate921600
921600 baud
Definition furi_hal_rtc.h:86
@ FuriHalRtcLogBaudRate38400
38400 baud
Definition furi_hal_rtc.h:82
@ FuriHalRtcLogBaudRate1843200
1843200 baud
Definition furi_hal_rtc.h:87
@ FuriHalRtcLogBaudRate230400
230400 baud
Definition furi_hal_rtc.h:80
@ FuriHalRtcLogBaudRate57600
57600 baud
Definition furi_hal_rtc.h:83
@ FuriHalRtcLogBaudRate9600
9600 baud
Definition furi_hal_rtc.h:81
uint32_t furi_hal_rtc_get_timestamp(void)
Get UNIX Timestamp.
Definition furi_hal_rtc.c:414
FuriHalRtcLocaleTimeFormat furi_hal_rtc_get_locale_timeformat(void)
Get RTC Locale Time Format.
Definition furi_hal_rtc.c:322
void furi_hal_rtc_set_boot_mode(FuriHalRtcBootMode mode)
Set RTC boot mode.
Definition furi_hal_rtc.c:276
void furi_hal_rtc_deinit_early(void)
Early de-initialization.
Definition furi_hal_rtc.c:154
FuriHalRtcRegister
Definition furi_hal_rtc.h:43
@ FuriHalRtcRegisterPinFails
Failed pins count.
Definition furi_hal_rtc.h:49
@ FuriHalRtcRegisterSystem
Various system bits.
Definition furi_hal_rtc.h:45
@ FuriHalRtcRegisterFaultData
Pointer to last fault message.
Definition furi_hal_rtc.h:48
@ FuriHalRtcRegisterVersion
Pointer to Version.
Definition furi_hal_rtc.h:46
@ FuriHalRtcRegisterHeader
RTC structure header.
Definition furi_hal_rtc.h:44
@ FuriHalRtcRegisterLfsFingerprint
LFS geometry fingerprint.
Definition furi_hal_rtc.h:47
@ FuriHalRtcRegisterMAX
Service value, do not use.
Definition furi_hal_rtc.h:53
uint8_t furi_hal_rtc_get_log_level(void)
Get Log Level value.
Definition furi_hal_rtc.c:208
void furi_hal_rtc_init(void)
Initialize RTC subsystem.
Definition furi_hal_rtc.c:157
FuriHalRtcBootMode furi_hal_rtc_get_boot_mode(void)
Get RTC boot mode.
Definition furi_hal_rtc.c:283
void furi_hal_rtc_set_flag(FuriHalRtcFlag flag)
Set RTC Flag.
Definition furi_hal_rtc.c:248
void furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackMode mode)
Set Heap Track mode.
Definition furi_hal_rtc.c:289
void furi_hal_rtc_set_fault_data(uint32_t value)
Set RTC Fault Data.
Definition furi_hal_rtc.c:398
void furi_hal_rtc_reset_registers(void)
Reset ALL RTC registers content.
Definition furi_hal_rtc.c:180
FuriHalRtcBootMode
Definition furi_hal_rtc.h:28
@ FuriHalRtcBootModeUpdate
Boot to Update, main.
Definition furi_hal_rtc.h:32
@ FuriHalRtcBootModePreUpdate
Boot to Update, pre update.
Definition furi_hal_rtc.h:31
@ FuriHalRtcBootModeDfu
Boot to DFU (MCU bootloader by ST)
Definition furi_hal_rtc.h:30
@ FuriHalRtcBootModeNormal
Normal boot mode, default value.
Definition furi_hal_rtc.h:29
@ FuriHalRtcBootModePostUpdate
Boot to Update, post update.
Definition furi_hal_rtc.h:33
FuriHalRtcLocaleUnits furi_hal_rtc_get_locale_units(void)
Get RTC Locale Units.
Definition furi_hal_rtc.c:309
void furi_hal_rtc_set_locale_dateformat(FuriHalRtcLocaleDateFormat value)
Set RTC Locale Date Format.
Definition furi_hal_rtc.c:328
void furi_hal_rtc_set_log_device(FuriHalRtcLogDevice device)
Set logging device.
Definition furi_hal_rtc.c:214
uint32_t furi_hal_rtc_get_pin_fails(void)
Get Pin Fails count.
Definition furi_hal_rtc.c:410
FuriHalRtcLogBaudRate furi_hal_rtc_get_log_baud_rate(void)
Get logging baud rate.
Definition furi_hal_rtc.c:242
void furi_hal_rtc_init_early(void)
Early initialization.
Definition furi_hal_rtc.c:130
void furi_hal_rtc_set_log_level(uint8_t level)
Set Log Level value.
Definition furi_hal_rtc.c:200
void furi_hal_rtc_get_datetime(DateTime *datetime)
Get RTC Date Time.
Definition furi_hal_rtc.c:380
void furi_hal_rtc_set_locale_timeformat(FuriHalRtcLocaleTimeFormat value)
Set RTC Locale Time Format.
Definition furi_hal_rtc.c:315
uint32_t furi_hal_rtc_get_fault_data(void)
Get RTC Fault Data.
Definition furi_hal_rtc.c:402
void furi_hal_rtc_set_datetime(DateTime *datetime)
Set RTC Date Time.
Definition furi_hal_rtc.c:341
bool furi_hal_rtc_is_flag_set(FuriHalRtcFlag flag)
Check if RTC Flag is set.
Definition furi_hal_rtc.c:270
FuriHalRtcLogDevice
Definition furi_hal_rtc.h:72
@ FuriHalRtcLogDeviceReserved
Reserved for future use.
Definition furi_hal_rtc.h:75
@ FuriHalRtcLogDeviceLpuart
Default: LPUART.
Definition furi_hal_rtc.h:74
@ FuriHalRtcLogDeviceNone
None, disable serial logging.
Definition furi_hal_rtc.h:76
@ FuriHalRtcLogDeviceUsart
Default: USART.
Definition furi_hal_rtc.h:73
FuriHalRtcLogDevice furi_hal_rtc_get_log_device(void)
Get logging device.
Definition furi_hal_rtc.c:225
Definition datetime.h:10