Add PSRAM music playback and coordinated device widgets

This commit is contained in:
liu weikai committed 2026-10-16 11:58:53 +08:00
1 parent 5056e07cb0
commit 3df8082d2c
154 files changed
+10857 -55

No files matched your search

@@ -16,6 +16,8 @@ enum class WidgetKind : uint8_t
Recent,
Compass,
Agenda,
Music,
Controls,
Count
};
struct WidgetHandle
@@ -25,6 +27,7 @@ struct WidgetHandle
void (*refresh)(void*) = nullptr;
uint32_t period_ms = 1000;
uint32_t next_refresh_ms = 0;
bool (*key)(void*, uint32_t) = nullptr;
};
inline void* widget_allocate(std::size_t bytes)
{
@@ -5,6 +5,14 @@ namespace ui::agenda
{
class IAgendaSource;
}
namespace ui::controls
{
class IQuickControls;
}
namespace music
{
class IService;
}
namespace ui::menu::dashboard
{
WidgetHandle create_mesh_widget(lv_obj_t* parent, lv_coord_t width, lv_coord_t height);
@@ -12,4 +20,6 @@ WidgetHandle create_gps_widget(lv_obj_t* parent, lv_coord_t width, lv_coord_t he
WidgetHandle create_recent_widget(lv_obj_t* parent, lv_coord_t width, lv_coord_t height);
WidgetHandle create_compass_widget(lv_obj_t* parent, lv_coord_t width, lv_coord_t height);
WidgetHandle create_agenda_widget(lv_obj_t* parent, lv_coord_t width, lv_coord_t height, ui::agenda::IAgendaSource* source);
WidgetHandle create_controls_widget(lv_obj_t* parent, lv_coord_t width, lv_coord_t height, ui::controls::IQuickControls* source);
WidgetHandle create_music_widget(lv_obj_t* parent, lv_coord_t width, lv_coord_t height, ::music::IService* source);
} // namespace ui::menu::dashboard
@@ -2,12 +2,23 @@
#include "lvgl.h"
#include "ui/menu/menu_layout.h"
namespace ui::menu_layout
{
struct InitOptions;
}
namespace ui::agenda
{
class IAgendaSource;
}
namespace ui::controls
{
class IQuickControls;
}
namespace music
{
class IService;
}
namespace ui::menu::dashboard
{
@@ -19,6 +30,8 @@ void refresh_localized_text();
void setActive(bool active);
// Target-owned read port; its lifetime must exceed the menu's lifetime.
void bindAgendaSource(ui::agenda::IAgendaSource* source);
void bindControlsSource(ui::controls::IQuickControls* source);
void bindMusicSource(::music::IService* source);
bool isFeedOpen();
bool handleKey(uint32_t key, bool at_left_edge = false);
bool handleEncoder(int delta);
@@ -43,6 +56,8 @@ inline void setActive(bool active)
(void)active;
}
inline void bindAgendaSource(ui::agenda::IAgendaSource*) {}
inline void bindControlsSource(ui::controls::IQuickControls*) {}
inline void bindMusicSource(::music::IService*) {}
inline bool isFeedOpen() { return false; }
inline bool handleKey(uint32_t, bool = false) { return false; }
inline bool handleEncoder(int) { return false; }
@@ -0,0 +1,12 @@
#pragma once
#include "lvgl.h"
namespace music
{
class IService;
}
namespace ui::music_page
{
void bind_service(::music::IService* service);
void enter(void* host, lv_obj_t* parent);
void exit(void* host, lv_obj_t* parent);
} // namespace ui::music_page