mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-23 13:21:44 +03:00
561b4e947a
* FuriHal: add RTC alarm support * FuriHal: RTC alarm API. Alarm settings app. Alarm app. * FuriHal: remove unnecessery init mode enters in RTC * Update targets/f7/furi_hal/furi_hal_rtc.h Co-authored-by: Silent <CookiePLMonster@users.noreply.github.com> * Update targets/f7/furi_hal/furi_hal_rtc.c Co-authored-by: Silent <CookiePLMonster@users.noreply.github.com> * Update targets/f7/furi_hal/furi_hal_rtc.h Co-authored-by: Silent <CookiePLMonster@users.noreply.github.com> * FuriHal: add seconds in rtc alarm getter * Alarm & Clock: redesign and cleanup setting and alarm apps, cleanup API * Spelling and time separator in alarm * Api Symbols: hide rtc alarm related methods * Clock alarm: new thread cleanup routine, hour/minute separator in alarm * Clock: move clock_settings_start into clock_settings fam * Seettings: update clock and alarm UI according to figma * Format icons --------- Co-authored-by: Silent <CookiePLMonster@users.noreply.github.com>
72 lines
2.1 KiB
C
72 lines
2.1 KiB
C
#include "clock_settings.h"
|
|
|
|
#include <furi.h>
|
|
#include <furi_hal.h>
|
|
|
|
static bool clock_settings_custom_event_callback(void* context, uint32_t event) {
|
|
furi_assert(context);
|
|
ClockSettings* app = context;
|
|
return scene_manager_handle_custom_event(app->scene_manager, event);
|
|
}
|
|
|
|
static bool clock_settings_back_event_callback(void* context) {
|
|
furi_assert(context);
|
|
ClockSettings* app = context;
|
|
return scene_manager_handle_back_event(app->scene_manager);
|
|
}
|
|
|
|
ClockSettings* clock_settings_alloc() {
|
|
ClockSettings* app = malloc(sizeof(ClockSettings));
|
|
|
|
app->gui = furi_record_open(RECORD_GUI);
|
|
|
|
app->view_dispatcher = view_dispatcher_alloc();
|
|
app->scene_manager = scene_manager_alloc(&clock_settings_scene_handlers, app);
|
|
view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
|
|
|
|
view_dispatcher_set_custom_event_callback(
|
|
app->view_dispatcher, clock_settings_custom_event_callback);
|
|
view_dispatcher_set_navigation_event_callback(
|
|
app->view_dispatcher, clock_settings_back_event_callback);
|
|
|
|
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
|
|
|
|
app->pwm_view =
|
|
clock_settings_module_alloc(view_dispatcher_get_event_loop(app->view_dispatcher));
|
|
view_dispatcher_add_view(
|
|
app->view_dispatcher, ClockSettingsViewPwm, clock_settings_module_get_view(app->pwm_view));
|
|
|
|
scene_manager_next_scene(app->scene_manager, ClockSettingsSceneStart);
|
|
|
|
return app;
|
|
}
|
|
|
|
void clock_settings_free(ClockSettings* app) {
|
|
furi_assert(app);
|
|
|
|
// Views
|
|
view_dispatcher_remove_view(app->view_dispatcher, ClockSettingsViewPwm);
|
|
|
|
clock_settings_module_free(app->pwm_view);
|
|
|
|
// View dispatcher
|
|
view_dispatcher_free(app->view_dispatcher);
|
|
scene_manager_free(app->scene_manager);
|
|
|
|
// Close records
|
|
furi_record_close(RECORD_GUI);
|
|
|
|
free(app);
|
|
}
|
|
|
|
int32_t clock_settings(void* p) {
|
|
UNUSED(p);
|
|
ClockSettings* clock_settings = clock_settings_alloc();
|
|
|
|
view_dispatcher_run(clock_settings->view_dispatcher);
|
|
|
|
clock_settings_free(clock_settings);
|
|
|
|
return 0;
|
|
}
|