summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-05-02 21:41:56 +1000
committerjacqueline <me@jacqueline.id.au>2024-05-02 21:41:56 +1000
commit7d7f7755d17e1e0a2348d75d797097f166b70471 (patch)
tree1129eef470a90fc954a0c6f281e8d94fe0339101 /src
parent1573a8c4cde1cd9528b422b2dcc598e37ffe94a7 (diff)
downloadtangara-fw-7d7f7755d17e1e0a2348d75d797097f166b70471.tar.gz
start moving include files into subdirs
Diffstat (limited to 'src')
-rw-r--r--src/main/main.cpp12
-rw-r--r--src/tangara/CMakeLists.txt3
-rw-r--r--src/tangara/app_console/app_console.hpp8
-rw-r--r--src/tangara/audio/audio_converter.cpp10
-rw-r--r--src/tangara/audio/audio_converter.hpp8
-rw-r--r--src/tangara/audio/audio_decoder.cpp20
-rw-r--r--src/tangara/audio/audio_decoder.hpp10
-rw-r--r--src/tangara/audio/audio_events.hpp4
-rw-r--r--src/tangara/audio/audio_fsm.cpp28
-rw-r--r--src/tangara/audio/audio_fsm.hpp28
-rw-r--r--src/tangara/audio/audio_source.cpp8
-rw-r--r--src/tangara/audio/audio_source.hpp5
-rw-r--r--src/tangara/audio/bt_audio_output.cpp2
-rw-r--r--src/tangara/audio/bt_audio_output.hpp2
-rw-r--r--src/tangara/audio/fatfs_audio_input.cpp28
-rw-r--r--src/tangara/audio/fatfs_audio_input.hpp10
-rw-r--r--src/tangara/audio/fatfs_source.cpp8
-rw-r--r--src/tangara/audio/fatfs_source.hpp2
-rw-r--r--src/tangara/audio/i2s_audio_output.cpp9
-rw-r--r--src/tangara/audio/i2s_audio_output.hpp2
-rw-r--r--src/tangara/audio/readahead_source.cpp4
-rw-r--r--src/tangara/audio/readahead_source.hpp2
-rw-r--r--src/tangara/audio/resample.cpp2
-rw-r--r--src/tangara/audio/track_queue.cpp14
-rw-r--r--src/tangara/audio/track_queue.hpp6
-rw-r--r--src/tangara/battery/battery.cpp6
-rw-r--r--src/tangara/database/database.cpp22
-rw-r--r--src/tangara/database/database.hpp10
-rw-r--r--src/tangara/database/env_esp.cpp4
-rw-r--r--src/tangara/database/file_gatherer.cpp2
-rw-r--r--src/tangara/database/file_gatherer.hpp12
-rw-r--r--src/tangara/database/future_fetcher.hpp2
-rw-r--r--src/tangara/database/index.cpp11
-rw-r--r--src/tangara/database/index.hpp7
-rw-r--r--src/tangara/database/records.cpp6
-rw-r--r--src/tangara/database/records.hpp4
-rw-r--r--src/tangara/database/tag_parser.cpp2
-rw-r--r--src/tangara/database/tag_parser.hpp2
-rw-r--r--src/tangara/database/test/test_database.cpp16
-rw-r--r--src/tangara/database/test/test_records.cpp2
-rw-r--r--src/tangara/database/track.cpp2
-rw-r--r--src/tangara/dev_console/console.cpp2
-rw-r--r--src/tangara/events/event_queue.cpp7
-rw-r--r--src/tangara/events/event_queue.hpp6
-rw-r--r--src/tangara/input/device_factory.cpp14
-rw-r--r--src/tangara/input/device_factory.hpp8
-rw-r--r--src/tangara/input/feedback_haptics.hpp2
-rw-r--r--src/tangara/input/input_device.hpp4
-rw-r--r--src/tangara/input/input_hook.hpp2
-rw-r--r--src/tangara/input/input_hook_actions.hpp2
-rw-r--r--src/tangara/input/input_nav_buttons.cpp6
-rw-r--r--src/tangara/input/input_nav_buttons.hpp6
-rw-r--r--src/tangara/input/input_touch_dpad.hpp6
-rw-r--r--src/tangara/input/input_touch_wheel.cpp10
-rw-r--r--src/tangara/input/input_touch_wheel.hpp8
-rw-r--r--src/tangara/input/input_volume_buttons.cpp6
-rw-r--r--src/tangara/input/input_volume_buttons.hpp4
-rw-r--r--src/tangara/input/lvgl_input_driver.hpp12
-rw-r--r--src/tangara/lua/bridge.cpp28
-rw-r--r--src/tangara/lua/bridge.hpp9
-rw-r--r--src/tangara/lua/lua_controls.cpp4
-rw-r--r--src/tangara/lua/lua_database.cpp36
-rw-r--r--src/tangara/lua/lua_database.hpp2
-rw-r--r--src/tangara/lua/lua_queue.cpp20
-rw-r--r--src/tangara/lua/lua_registry.hpp6
-rw-r--r--src/tangara/lua/lua_screen.cpp20
-rw-r--r--src/tangara/lua/lua_theme.cpp25
-rw-r--r--src/tangara/lua/lua_thread.cpp16
-rw-r--r--src/tangara/lua/lua_thread.hpp2
-rw-r--r--src/tangara/lua/lua_version.cpp6
-rw-r--r--src/tangara/lua/property.cpp8
-rw-r--r--src/tangara/lua/property.hpp4
-rw-r--r--src/tangara/lua/registry.cpp10
-rw-r--r--src/tangara/system_fsm/booting.cpp18
-rw-r--r--src/tangara/system_fsm/idle.cpp14
-rw-r--r--src/tangara/system_fsm/running.cpp20
-rw-r--r--src/tangara/system_fsm/service_locator.cpp2
-rw-r--r--src/tangara/system_fsm/service_locator.hpp8
-rw-r--r--src/tangara/system_fsm/system_events.hpp6
-rw-r--r--src/tangara/system_fsm/system_fsm.cpp14
-rw-r--r--src/tangara/system_fsm/system_fsm.hpp25
-rw-r--r--src/tangara/ui/lvgl_task.cpp10
-rw-r--r--src/tangara/ui/lvgl_task.hpp6
-rw-r--r--src/tangara/ui/modal.cpp14
-rw-r--r--src/tangara/ui/modal.hpp2
-rw-r--r--src/tangara/ui/screen.cpp2
-rw-r--r--src/tangara/ui/screen_lua.cpp8
-rw-r--r--src/tangara/ui/screen_lua.hpp4
-rw-r--r--src/tangara/ui/screen_splash.cpp2
-rw-r--r--src/tangara/ui/screen_splash.hpp2
-rw-r--r--src/tangara/ui/themes.cpp25
-rw-r--r--src/tangara/ui/themes.hpp3
-rw-r--r--src/tangara/ui/ui_events.hpp6
-rw-r--r--src/tangara/ui/ui_fsm.cpp50
-rw-r--r--src/tangara/ui/ui_fsm.hpp40
95 files changed, 465 insertions, 462 deletions
diff --git a/src/main/main.cpp b/src/main/main.cpp
index cf27b132..811f2709 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -7,14 +7,14 @@
#include "freertos/FreeRTOS.h"
#include "freertos/portmacro.h"
-#include "i2c.hpp"
-#include "system_events.hpp"
#include "tinyfsm.hpp"
-#include "audio_fsm.hpp"
-#include "event_queue.hpp"
-#include "system_fsm.hpp"
-#include "ui_fsm.hpp"
+#include "audio/audio_fsm.hpp"
+#include "events/event_queue.hpp"
+#include "i2c.hpp"
+#include "system_fsm/system_events.hpp"
+#include "system_fsm/system_fsm.hpp"
+#include "ui/ui_fsm.hpp"
extern "C" void app_main(void) {
ESP_ERROR_CHECK(drivers::init_i2c());
diff --git a/src/tangara/CMakeLists.txt b/src/tangara/CMakeLists.txt
index 6bd648eb..5f2dfca8 100644
--- a/src/tangara/CMakeLists.txt
+++ b/src/tangara/CMakeLists.txt
@@ -5,8 +5,7 @@
idf_component_register(
SRC_DIRS "app_console" "audio" "battery" "database" "dev_console" "events"
"input" "lua" "system_fsm" "ui"
- INCLUDE_DIRS "." "app_console" "audio" "battery" "database" "dev_console"
- "events" "input" "lua" "system_fsm" "ui"
+ INCLUDE_DIRS "."
REQUIRES "codecs" "drivers" "locale" "memory" "tasks" "util"
"tinyfsm" "lvgl" "esp_timer" "luavgl" "esp_app_format" "libcppbor" "libtags"
"komihash" "result" "esp_psram" "fatfs" "millershuffle" "speexdsp" "console"
diff --git a/src/tangara/app_console/app_console.hpp b/src/tangara/app_console/app_console.hpp
index 5981cc04..07f764f5 100644
--- a/src/tangara/app_console/app_console.hpp
+++ b/src/tangara/app_console/app_console.hpp
@@ -8,12 +8,12 @@
#include <memory>
+#include "audio/track_queue.hpp"
#include "bluetooth.hpp"
-#include "console.hpp"
-#include "database.hpp"
+#include "dev_console/console.hpp"
+#include "database/database.hpp"
#include "samd.hpp"
-#include "service_locator.hpp"
-#include "track_queue.hpp"
+#include "system_fsm/service_locator.hpp"
namespace console {
diff --git a/src/tangara/audio/audio_converter.cpp b/src/tangara/audio/audio_converter.cpp
index d2edb0b3..0690b8d3 100644
--- a/src/tangara/audio/audio_converter.cpp
+++ b/src/tangara/audio/audio_converter.cpp
@@ -4,23 +4,23 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "audio_converter.hpp"
+#include "audio/audio_converter.hpp"
#include <stdint.h>
#include <algorithm>
#include <cmath>
#include <cstdint>
-#include "audio_events.hpp"
-#include "audio_sink.hpp"
+#include "audio/audio_events.hpp"
+#include "audio/audio_sink.hpp"
#include "esp_heap_caps.h"
#include "esp_log.h"
-#include "event_queue.hpp"
+#include "events/event_queue.hpp"
#include "freertos/portmacro.h"
#include "freertos/projdefs.h"
#include "i2s_dac.hpp"
-#include "resample.hpp"
+#include "audio/resample.hpp"
#include "sample.hpp"
#include "tasks.hpp"
diff --git a/src/tangara/audio/audio_converter.hpp b/src/tangara/audio/audio_converter.hpp
index 163c6836..bf5edd43 100644
--- a/src/tangara/audio/audio_converter.hpp
+++ b/src/tangara/audio/audio_converter.hpp
@@ -10,11 +10,11 @@
#include <cstdint>
#include <memory>
-#include "audio_events.hpp"
-#include "audio_sink.hpp"
-#include "audio_source.hpp"
+#include "audio/audio_events.hpp"
+#include "audio/audio_sink.hpp"
+#include "audio/audio_source.hpp"
+#include "audio/resample.hpp"
#include "codec.hpp"
-#include "resample.hpp"
#include "sample.hpp"
namespace audio {
diff --git a/src/tangara/audio/audio_decoder.cpp b/src/tangara/audio/audio_decoder.cpp
index bf2d3fbe..1ef30b2c 100644
--- a/src/tangara/audio/audio_decoder.cpp
+++ b/src/tangara/audio/audio_decoder.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "audio_decoder.hpp"
+#include "audio/audio_decoder.hpp"
#include <algorithm>
#include <cmath>
@@ -25,20 +25,20 @@
#include "freertos/queue.h"
#include "freertos/ringbuf.h"
-#include "audio_converter.hpp"
-#include "audio_events.hpp"
-#include "audio_fsm.hpp"
-#include "audio_sink.hpp"
-#include "audio_source.hpp"
+#include "audio/audio_converter.hpp"
+#include "audio/audio_events.hpp"
+#include "audio/audio_fsm.hpp"
+#include "audio/audio_sink.hpp"
+#include "audio/audio_source.hpp"
+#include "audio/fatfs_audio_input.hpp"
#include "codec.hpp"
-#include "event_queue.hpp"
-#include "fatfs_audio_input.hpp"
+#include "database/track.hpp"
+#include "events/event_queue.hpp"
#include "i2s_dac.hpp"
#include "sample.hpp"
#include "tasks.hpp"
-#include "track.hpp"
#include "types.hpp"
-#include "ui_fsm.hpp"
+#include "ui/ui_fsm.hpp"
namespace audio {
diff --git a/src/tangara/audio/audio_decoder.hpp b/src/tangara/audio/audio_decoder.hpp
index 8e955f74..dfd6f403 100644
--- a/src/tangara/audio/audio_decoder.hpp
+++ b/src/tangara/audio/audio_decoder.hpp
@@ -9,12 +9,12 @@
#include <cstdint>
#include <memory>
-#include "audio_converter.hpp"
-#include "audio_events.hpp"
-#include "audio_sink.hpp"
-#include "audio_source.hpp"
+#include "audio/audio_converter.hpp"
+#include "audio/audio_events.hpp"
+#include "audio/audio_sink.hpp"
+#include "audio/audio_source.hpp"
#include "codec.hpp"
-#include "track.hpp"
+#include "database/track.hpp"
#include "types.hpp"
namespace audio {
diff --git a/src/tangara/audio/audio_events.hpp b/src/tangara/audio/audio_events.hpp
index b8a0dba6..b2975cbc 100644
--- a/src/tangara/audio/audio_events.hpp
+++ b/src/tangara/audio/audio_events.hpp
@@ -12,10 +12,10 @@
#include <optional>
#include <string>
-#include "audio_sink.hpp"
+#include "audio/audio_sink.hpp"
#include "tinyfsm.hpp"
-#include "track.hpp"
+#include "database/track.hpp"
#include "types.hpp"
namespace audio {
diff --git a/src/tangara/audio/audio_fsm.cpp b/src/tangara/audio/audio_fsm.cpp
index ffb462f8..349f49b3 100644
--- a/src/tangara/audio/audio_fsm.cpp
+++ b/src/tangara/audio/audio_fsm.cpp
@@ -4,14 +4,14 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "audio_fsm.hpp"
+#include "audio/audio_fsm.hpp"
#include <stdint.h>
#include <future>
#include <memory>
#include <variant>
-#include "audio_sink.hpp"
+#include "audio/audio_sink.hpp"
#include "bluetooth_types.hpp"
#include "cppbor.h"
#include "cppbor_parse.h"
@@ -21,23 +21,23 @@
#include "freertos/portmacro.h"
#include "freertos/projdefs.h"
-#include "audio_converter.hpp"
-#include "audio_decoder.hpp"
-#include "audio_events.hpp"
+#include "audio/audio_converter.hpp"
+#include "audio/audio_decoder.hpp"
+#include "audio/audio_events.hpp"
+#include "audio/bt_audio_output.hpp"
+#include "audio/fatfs_audio_input.hpp"
+#include "audio/i2s_audio_output.hpp"
+#include "audio/track_queue.hpp"
#include "bluetooth.hpp"
-#include "bt_audio_output.hpp"
-#include "event_queue.hpp"
-#include "fatfs_audio_input.hpp"
-#include "future_fetcher.hpp"
-#include "i2s_audio_output.hpp"
+#include "database/future_fetcher.hpp"
+#include "database/track.hpp"
+#include "events/event_queue.hpp"
#include "i2s_dac.hpp"
#include "nvs.hpp"
#include "sample.hpp"
-#include "service_locator.hpp"
-#include "system_events.hpp"
+#include "system_fsm/service_locator.hpp"
+#include "system_fsm/system_events.hpp"
#include "tinyfsm.hpp"
-#include "track.hpp"
-#include "track_queue.hpp"
#include "wm8523.hpp"
namespace audio {
diff --git a/src/tangara/audio/audio_fsm.hpp b/src/tangara/audio/audio_fsm.hpp
index 60afb321..6f14d2d9 100644
--- a/src/tangara/audio/audio_fsm.hpp
+++ b/src/tangara/audio/audio_fsm.hpp
@@ -11,24 +11,24 @@
#include <memory>
#include <vector>
-#include "audio_sink.hpp"
-#include "service_locator.hpp"
+#include "audio/audio_sink.hpp"
+#include "system_fsm/service_locator.hpp"
#include "tinyfsm.hpp"
-#include "audio_decoder.hpp"
-#include "audio_events.hpp"
-#include "bt_audio_output.hpp"
-#include "database.hpp"
+#include "audio/audio_decoder.hpp"
+#include "audio/audio_events.hpp"
+#include "audio/bt_audio_output.hpp"
+#include "audio/fatfs_audio_input.hpp"
+#include "audio/i2s_audio_output.hpp"
+#include "audio/track_queue.hpp"
+#include "database/database.hpp"
+#include "database/tag_parser.hpp"
+#include "database/track.hpp"
#include "display.hpp"
-#include "fatfs_audio_input.hpp"
#include "gpios.hpp"
-#include "i2s_audio_output.hpp"
#include "i2s_dac.hpp"
#include "storage.hpp"
-#include "system_events.hpp"
-#include "tag_parser.hpp"
-#include "track.hpp"
-#include "track_queue.hpp"
+#include "system_fsm/system_events.hpp"
namespace audio {
@@ -61,7 +61,7 @@ class AudioState : public tinyfsm::Fsm<AudioState> {
void react(const OutputModeChanged&);
virtual void react(const system_fsm::BootComplete&) {}
- virtual void react(const system_fsm::KeyLockChanged&){};
+ virtual void react(const system_fsm::KeyLockChanged&) {};
virtual void react(const system_fsm::StorageMounted&) {}
virtual void react(const system_fsm::BluetoothEvent&);
@@ -103,7 +103,7 @@ namespace states {
class Uninitialised : public AudioState {
public:
void react(const system_fsm::BootComplete&) override;
- void react(const system_fsm::BluetoothEvent&) override{};
+ void react(const system_fsm::BluetoothEvent&) override {};
using AudioState::react;
};
diff --git a/src/tangara/audio/audio_source.cpp b/src/tangara/audio/audio_source.cpp
index ee2f617f..4989c470 100644
--- a/src/tangara/audio/audio_source.cpp
+++ b/src/tangara/audio/audio_source.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "audio_source.hpp"
+#include "audio/audio_source.hpp"
#include "codec.hpp"
#include "types.hpp"
@@ -14,7 +14,11 @@ TaggedStream::TaggedStream(std::shared_ptr<database::TrackTags> t,
std::unique_ptr<codecs::IStream> w,
std::string filepath,
uint32_t offset)
- : codecs::IStream(w->type()), tags_(t), wrapped_(std::move(w)), filepath_(filepath), offset_(offset) {}
+ : codecs::IStream(w->type()),
+ tags_(t),
+ wrapped_(std::move(w)),
+ filepath_(filepath),
+ offset_(offset) {}
auto TaggedStream::tags() -> std::shared_ptr<database::TrackTags> {
return tags_;
diff --git a/src/tangara/audio/audio_source.hpp b/src/tangara/audio/audio_source.hpp
index f6a34300..2433da46 100644
--- a/src/tangara/audio/audio_source.hpp
+++ b/src/tangara/audio/audio_source.hpp
@@ -8,7 +8,7 @@
#include <memory>
#include "codec.hpp"
-#include "track.hpp"
+#include "database/track.hpp"
#include "types.hpp"
namespace audio {
@@ -18,8 +18,7 @@ class TaggedStream : public codecs::IStream {
TaggedStream(std::shared_ptr<database::TrackTags>,
std::unique_ptr<codecs::IStream> wrapped,
std::string path,
- uint32_t offset = 0
- );
+ uint32_t offset = 0);
auto tags() -> std::shared_ptr<database::TrackTags>;
diff --git a/src/tangara/audio/bt_audio_output.cpp b/src/tangara/audio/bt_audio_output.cpp
index 229a38bb..b4bcaae8 100644
--- a/src/tangara/audio/bt_audio_output.cpp
+++ b/src/tangara/audio/bt_audio_output.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "bt_audio_output.hpp"
+#include "audio/bt_audio_output.hpp"
#include <algorithm>
#include <cmath>
diff --git a/src/tangara/audio/bt_audio_output.hpp b/src/tangara/audio/bt_audio_output.hpp
index cc3b2462..0818d0d7 100644
--- a/src/tangara/audio/bt_audio_output.hpp
+++ b/src/tangara/audio/bt_audio_output.hpp
@@ -13,7 +13,7 @@
#include "result.hpp"
-#include "audio_sink.hpp"
+#include "audio/audio_sink.hpp"
#include "bluetooth.hpp"
#include "gpios.hpp"
#include "i2s_dac.hpp"
diff --git a/src/tangara/audio/fatfs_audio_input.cpp b/src/tangara/audio/fatfs_audio_input.cpp
index e5fb3b21..0868d71a 100644
--- a/src/tangara/audio/fatfs_audio_input.cpp
+++ b/src/tangara/audio/fatfs_audio_input.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "fatfs_audio_input.hpp"
+#include "audio/fatfs_audio_input.hpp"
#include <algorithm>
#include <climits>
@@ -18,24 +18,24 @@
#include <string>
#include <variant>
+#include "audio/readahead_source.hpp"
#include "esp_heap_caps.h"
#include "esp_log.h"
#include "ff.h"
#include "freertos/portmacro.h"
#include "freertos/projdefs.h"
-#include "readahead_source.hpp"
-#include "audio_events.hpp"
-#include "audio_fsm.hpp"
-#include "audio_source.hpp"
+#include "audio/audio_events.hpp"
+#include "audio/audio_fsm.hpp"
+#include "audio/audio_source.hpp"
+#include "audio/fatfs_source.hpp"
#include "codec.hpp"
-#include "event_queue.hpp"
-#include "fatfs_source.hpp"
-#include "future_fetcher.hpp"
+#include "database/future_fetcher.hpp"
+#include "database/tag_parser.hpp"
+#include "database/track.hpp"
+#include "events/event_queue.hpp"
#include "spi.hpp"
-#include "tag_parser.hpp"
#include "tasks.hpp"
-#include "track.hpp"
#include "types.hpp"
[[maybe_unused]] static const char* kTag = "SRC";
@@ -61,8 +61,8 @@ auto FatfsAudioInput::SetPath(std::optional<std::string> path) -> void {
}
}
-auto FatfsAudioInput::SetPath(const std::string& path, uint32_t offset)
- -> void {
+auto FatfsAudioInput::SetPath(const std::string& path,
+ uint32_t offset) -> void {
std::lock_guard<std::mutex> guard{new_stream_mutex_};
if (OpenFile(path, offset)) {
has_new_stream_ = true;
@@ -103,8 +103,8 @@ auto FatfsAudioInput::NextStream() -> std::shared_ptr<TaggedStream> {
}
}
-auto FatfsAudioInput::OpenFile(const std::string& path, uint32_t offset)
- -> bool {
+auto FatfsAudioInput::OpenFile(const std::string& path,
+ uint32_t offset) -> bool {
ESP_LOGI(kTag, "opening file %s", path.c_str());
auto tags = tag_parser_.ReadAndParseTags(path);
diff --git a/src/tangara/audio/fatfs_audio_input.hpp b/src/tangara/audio/fatfs_audio_input.hpp
index 10b7433e..deeeb094 100644
--- a/src/tangara/audio/fatfs_audio_input.hpp
+++ b/src/tangara/audio/fatfs_audio_input.hpp
@@ -15,10 +15,10 @@
#include "ff.h"
#include "freertos/portmacro.h"
-#include "audio_source.hpp"
+#include "audio/audio_source.hpp"
#include "codec.hpp"
-#include "future_fetcher.hpp"
-#include "tag_parser.hpp"
+#include "database/future_fetcher.hpp"
+#include "database/tag_parser.hpp"
#include "tasks.hpp"
#include "types.hpp"
@@ -39,7 +39,7 @@ class FatfsAudioInput : public IAudioSource {
* given file path.
*/
auto SetPath(std::optional<std::string>) -> void;
- auto SetPath(const std::string&,uint32_t offset = 0) -> void;
+ auto SetPath(const std::string&, uint32_t offset = 0) -> void;
auto SetPath() -> void;
auto HasNewStream() -> bool override;
@@ -49,7 +49,7 @@ class FatfsAudioInput : public IAudioSource {
FatfsAudioInput& operator=(const FatfsAudioInput&) = delete;
private:
- auto OpenFile(const std::string& path,uint32_t offset) -> bool;
+ auto OpenFile(const std::string& path, uint32_t offset) -> bool;
auto ContainerToStreamType(database::Container)
-> std::optional<codecs::StreamType>;
diff --git a/src/tangara/audio/fatfs_source.cpp b/src/tangara/audio/fatfs_source.cpp
index dccdd581..645e0a1e 100644
--- a/src/tangara/audio/fatfs_source.cpp
+++ b/src/tangara/audio/fatfs_source.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "fatfs_source.hpp"
+#include "audio/fatfs_source.hpp"
#include <sys/_stdint.h>
#include <cstddef>
@@ -12,13 +12,13 @@
#include <memory>
#include "esp_log.h"
-#include "event_queue.hpp"
+#include "events/event_queue.hpp"
#include "ff.h"
-#include "audio_source.hpp"
+#include "audio/audio_source.hpp"
#include "codec.hpp"
#include "spi.hpp"
-#include "system_events.hpp"
+#include "system_fsm/system_events.hpp"
#include "types.hpp"
namespace audio {
diff --git a/src/tangara/audio/fatfs_source.hpp b/src/tangara/audio/fatfs_source.hpp
index ce9b4db8..32650880 100644
--- a/src/tangara/audio/fatfs_source.hpp
+++ b/src/tangara/audio/fatfs_source.hpp
@@ -13,7 +13,7 @@
#include "codec.hpp"
#include "ff.h"
-#include "audio_source.hpp"
+#include "audio/audio_source.hpp"
namespace audio {
diff --git a/src/tangara/audio/i2s_audio_output.cpp b/src/tangara/audio/i2s_audio_output.cpp
index bf1c3e5e..4f03c1a5 100644
--- a/src/tangara/audio/i2s_audio_output.cpp
+++ b/src/tangara/audio/i2s_audio_output.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "i2s_audio_output.hpp"
+#include "audio/i2s_audio_output.hpp"
#include <stdint.h>
#include <algorithm>
@@ -18,7 +18,7 @@
#include "freertos/portmacro.h"
#include "freertos/projdefs.h"
-#include "audio_sink.hpp"
+#include "audio/audio_sink.hpp"
#include "gpios.hpp"
#include "i2c.hpp"
#include "i2s_dac.hpp"
@@ -120,7 +120,7 @@ auto I2SAudioOutput::SetVolumePct(uint_fast8_t val) -> bool {
if (val > 100) {
return false;
}
- uint16_t vol = (val * (max_volume_ - kMinVolume))/100 + kMinVolume;
+ uint16_t vol = (val * (max_volume_ - kMinVolume)) / 100 + kMinVolume;
SetVolume(vol);
return true;
}
@@ -133,7 +133,8 @@ auto I2SAudioOutput::GetVolumeDb() -> int_fast16_t {
}
auto I2SAudioOutput::SetVolumeDb(int_fast16_t val) -> bool {
- SetVolume(val * 4 + static_cast<int>(drivers::wm8523::kLineLevelReferenceVolume) - 2);
+ SetVolume(val * 4 +
+ static_cast<int>(drivers::wm8523::kLineLevelReferenceVolume) - 2);
return true;
}
diff --git a/src/tangara/audio/i2s_audio_output.hpp b/src/tangara/audio/i2s_audio_output.hpp
index 7954257a..13494a6c 100644
--- a/src/tangara/audio/i2s_audio_output.hpp
+++ b/src/tangara/audio/i2s_audio_output.hpp
@@ -11,7 +11,7 @@
#include <memory>
#include <vector>
-#include "audio_sink.hpp"
+#include "audio/audio_sink.hpp"
#include "gpios.hpp"
#include "i2s_dac.hpp"
#include "result.hpp"
diff --git a/src/tangara/audio/readahead_source.cpp b/src/tangara/audio/readahead_source.cpp
index 6276907a..71684ddb 100644
--- a/src/tangara/audio/readahead_source.cpp
+++ b/src/tangara/audio/readahead_source.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "readahead_source.hpp"
+#include "audio/readahead_source.hpp"
#include <cstddef>
#include <cstdint>
@@ -14,7 +14,7 @@
#include "esp_log.h"
#include "ff.h"
-#include "audio_source.hpp"
+#include "audio/audio_source.hpp"
#include "codec.hpp"
#include "freertos/portmacro.h"
#include "spi.hpp"
diff --git a/src/tangara/audio/readahead_source.hpp b/src/tangara/audio/readahead_source.hpp
index 74a30e1b..bbaf9f75 100644
--- a/src/tangara/audio/readahead_source.hpp
+++ b/src/tangara/audio/readahead_source.hpp
@@ -15,7 +15,7 @@
#include "ff.h"
#include "freertos/stream_buffer.h"
-#include "audio_source.hpp"
+#include "audio/audio_source.hpp"
#include "codec.hpp"
#include "tasks.hpp"
diff --git a/src/tangara/audio/resample.cpp b/src/tangara/audio/resample.cpp
index 1e20392b..143ce230 100644
--- a/src/tangara/audio/resample.cpp
+++ b/src/tangara/audio/resample.cpp
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "resample.hpp"
+#include "audio/resample.hpp"
#include <algorithm>
#include <cmath>
diff --git a/src/tangara/audio/track_queue.cpp b/src/tangara/audio/track_queue.cpp
index dbe283c4..603b0de1 100644
--- a/src/tangara/audio/track_queue.cpp
+++ b/src/tangara/audio/track_queue.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "track_queue.hpp"
+#include "audio/track_queue.hpp"
#include <stdint.h>
#include <algorithm>
@@ -18,16 +18,16 @@
#include "MillerShuffle.h"
#include "esp_random.h"
-#include "audio_events.hpp"
-#include "audio_fsm.hpp"
+#include "audio/audio_events.hpp"
+#include "audio/audio_fsm.hpp"
#include "cppbor.h"
#include "cppbor_parse.h"
-#include "database.hpp"
-#include "event_queue.hpp"
+#include "database/database.hpp"
+#include "database/track.hpp"
+#include "events/event_queue.hpp"
#include "memory_resource.hpp"
#include "tasks.hpp"
-#include "track.hpp"
-#include "ui_fsm.hpp"
+#include "ui/ui_fsm.hpp"
namespace audio {
diff --git a/src/tangara/audio/track_queue.hpp b/src/tangara/audio/track_queue.hpp
index 5b7c9448..427d5f75 100644
--- a/src/tangara/audio/track_queue.hpp
+++ b/src/tangara/audio/track_queue.hpp
@@ -12,11 +12,11 @@
#include <shared_mutex>
#include <vector>
-#include "audio_events.hpp"
+#include "audio/audio_events.hpp"
#include "cppbor_parse.h"
-#include "database.hpp"
+#include "database/database.hpp"
+#include "database/track.hpp"
#include "tasks.hpp"
-#include "track.hpp"
namespace audio {
diff --git a/src/tangara/battery/battery.cpp b/src/tangara/battery/battery.cpp
index debef9e6..f75914ba 100644
--- a/src/tangara/battery/battery.cpp
+++ b/src/tangara/battery/battery.cpp
@@ -4,15 +4,15 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "battery.hpp"
+#include "battery/battery.hpp"
#include <cstdint>
#include "adc.hpp"
-#include "event_queue.hpp"
+#include "events/event_queue.hpp"
#include "freertos/portmacro.h"
#include "samd.hpp"
-#include "system_events.hpp"
+#include "system_fsm/system_events.hpp"
namespace battery {
diff --git a/src/tangara/database/database.cpp b/src/tangara/database/database.cpp
index 48fb0c63..ddb63907 100644
--- a/src/tangara/database/database.cpp
+++ b/src/tangara/database/database.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "database.hpp"
+#include "database/database.hpp"
#include <stdint.h>
#include <sys/_stdint.h>
@@ -23,10 +23,10 @@
#include "collation.hpp"
#include "cppbor.h"
#include "cppbor_parse.h"
+#include "database/index.hpp"
#include "esp_log.h"
#include "ff.h"
#include "freertos/projdefs.h"
-#include "index.hpp"
#include "komihash.h"
#include "leveldb/cache.h"
#include "leveldb/db.h"
@@ -36,17 +36,17 @@
#include "leveldb/status.h"
#include "leveldb/write_batch.h"
-#include "db_events.hpp"
-#include "env_esp.hpp"
-#include "event_queue.hpp"
-#include "file_gatherer.hpp"
+#include "database/db_events.hpp"
+#include "database/env_esp.hpp"
+#include "database/file_gatherer.hpp"
+#include "database/records.hpp"
+#include "database/tag_parser.hpp"
+#include "database/track.hpp"
+#include "events/event_queue.hpp"
#include "memory_resource.hpp"
-#include "records.hpp"
#include "result.hpp"
#include "spi.hpp"
-#include "tag_parser.hpp"
#include "tasks.hpp"
-#include "track.hpp"
namespace database {
@@ -63,8 +63,8 @@ static const char kKeyTrackId[] = "next_track_id";
static std::atomic<bool> sIsDbOpen(false);
-static auto CreateNewDatabase(leveldb::Options& options, locale::ICollator& col)
- -> leveldb::DB* {
+static auto CreateNewDatabase(leveldb::Options& options,
+ locale::ICollator& col) -> leveldb::DB* {
Database::Destroy();
leveldb::DB* db;
options.create_if_missing = true;
diff --git a/src/tangara/database/database.hpp b/src/tangara/database/database.hpp
index 35b76a13..d2de7c72 100644
--- a/src/tangara/database/database.hpp
+++ b/src/tangara/database/database.hpp
@@ -19,19 +19,19 @@
#include "collation.hpp"
#include "cppbor.h"
-#include "file_gatherer.hpp"
-#include "index.hpp"
+#include "database/file_gatherer.hpp"
+#include "database/index.hpp"
+#include "database/records.hpp"
+#include "database/tag_parser.hpp"
+#include "database/track.hpp"
#include "leveldb/cache.h"
#include "leveldb/db.h"
#include "leveldb/iterator.h"
#include "leveldb/options.h"
#include "leveldb/slice.h"
#include "memory_resource.hpp"
-#include "records.hpp"
#include "result.hpp"
-#include "tag_parser.hpp"
#include "tasks.hpp"
-#include "track.hpp"
namespace database {
diff --git a/src/tangara/database/env_esp.cpp b/src/tangara/database/env_esp.cpp
index f7a5637a..2cf74c3e 100644
--- a/src/tangara/database/env_esp.cpp
+++ b/src/tangara/database/env_esp.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "env_esp.hpp"
+#include "database/env_esp.hpp"
#include <atomic>
#include <cerrno>
@@ -41,7 +41,7 @@
namespace leveldb {
-tasks::WorkerPool *sBackgroundThread = nullptr;
+tasks::WorkerPool* sBackgroundThread = nullptr;
std::string ErrToStr(FRESULT err) {
switch (err) {
diff --git a/src/tangara/database/file_gatherer.cpp b/src/tangara/database/file_gatherer.cpp
index b7b7271e..141259c2 100644
--- a/src/tangara/database/file_gatherer.cpp
+++ b/src/tangara/database/file_gatherer.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "file_gatherer.hpp"
+#include "database/file_gatherer.hpp"
#include <deque>
#include <functional>
diff --git a/src/tangara/database/file_gatherer.hpp b/src/tangara/database/file_gatherer.hpp
index 685bdb2c..38558b9e 100644
--- a/src/tangara/database/file_gatherer.hpp
+++ b/src/tangara/database/file_gatherer.hpp
@@ -17,20 +17,18 @@ namespace database {
class IFileGatherer {
public:
- virtual ~IFileGatherer(){};
+ virtual ~IFileGatherer() {};
virtual auto FindFiles(
const std::string& root,
- std::function<void(std::string_view, const FILINFO&)> cb)
- -> void = 0;
+ std::function<void(std::string_view, const FILINFO&)> cb) -> void = 0;
};
class FileGathererImpl : public IFileGatherer {
public:
- virtual auto FindFiles(
- const std::string& root,
- std::function<void(std::string_view, const FILINFO&)> cb)
- -> void override;
+ virtual auto FindFiles(const std::string& root,
+ std::function<void(std::string_view, const FILINFO&)>
+ cb) -> void override;
};
} // namespace database
diff --git a/src/tangara/database/future_fetcher.hpp b/src/tangara/database/future_fetcher.hpp
index e8ce9729..a27101f1 100644
--- a/src/tangara/database/future_fetcher.hpp
+++ b/src/tangara/database/future_fetcher.hpp
@@ -9,7 +9,7 @@
#include <memory>
#include <utility>
-#include "database.hpp"
+#include "database/database.hpp"
namespace database {
diff --git a/src/tangara/database/index.cpp b/src/tangara/database/index.cpp
index 328c3b43..93a2b1c2 100644
--- a/src/tangara/database/index.cpp
+++ b/src/tangara/database/index.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "index.hpp"
+#include "database/index.hpp"
#include <sys/_stdint.h>
#include <cstdint>
@@ -21,8 +21,8 @@
#include "komihash.h"
#include "leveldb/write_batch.h"
-#include "records.hpp"
-#include "track.hpp"
+#include "database/records.hpp"
+#include "database/track.hpp"
namespace database {
@@ -183,8 +183,9 @@ auto Indexer::handleItem(const IndexKey::Header& header,
}
}
-auto Index(locale::ICollator& c, const IndexInfo& i, const Track& t)
- -> std::vector<std::pair<IndexKey, std::string>> {
+auto Index(locale::ICollator& c,
+ const IndexInfo& i,
+ const Track& t) -> std::vector<std::pair<IndexKey, std::string>> {
Indexer indexer{c, t, i};
return indexer.index();
}
diff --git a/src/tangara/database/index.hpp b/src/tangara/database/index.hpp
index 45dae464..8f78439b 100644
--- a/src/tangara/database/index.hpp
+++ b/src/tangara/database/index.hpp
@@ -17,9 +17,9 @@
#include "leveldb/db.h"
#include "leveldb/slice.h"
+#include "database/track.hpp"
#include "leveldb/write_batch.h"
#include "memory_resource.hpp"
-#include "track.hpp"
namespace database {
@@ -61,8 +61,9 @@ struct IndexKey {
std::optional<TrackId> track;
};
-auto Index(locale::ICollator&, const IndexInfo&, const Track&)
- -> std::vector<std::pair<IndexKey, std::string>>;
+auto Index(locale::ICollator&,
+ const IndexInfo&,
+ const Track&) -> std::vector<std::pair<IndexKey, std::string>>;
auto ExpandHeader(const IndexKey::Header&,
const std::optional<std::pmr::string>&) -> IndexKey::Header;
diff --git a/src/tangara/database/records.cpp b/src/tangara/database/records.cpp
index b086be3b..88ddbd91 100644
--- a/src/tangara/database/records.cpp
+++ b/src/tangara/database/records.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "records.hpp"
+#include "database/records.hpp"
#include <stdint.h>
#include <sys/_stdint.h>
@@ -21,10 +21,10 @@
#include "cppbor_parse.h"
#include "esp_log.h"
-#include "index.hpp"
+#include "database/index.hpp"
+#include "database/track.hpp"
#include "komihash.h"
#include "memory_resource.hpp"
-#include "track.hpp"
// As LevelDB is a key-value store, each record in the database consists of a
// key and an optional value.
diff --git a/src/tangara/database/records.hpp b/src/tangara/database/records.hpp
index 3ca68fea..db18fe2f 100644
--- a/src/tangara/database/records.hpp
+++ b/src/tangara/database/records.hpp
@@ -15,9 +15,9 @@
#include "leveldb/db.h"
#include "leveldb/slice.h"
-#include "index.hpp"
+#include "database/index.hpp"
+#include "database/track.hpp"
#include "memory_resource.hpp"
-#include "track.hpp"
namespace database {
diff --git a/src/tangara/database/tag_parser.cpp b/src/tangara/database/tag_parser.cpp
index cbcbdcb5..86bd6443 100644
--- a/src/tangara/database/tag_parser.cpp
+++ b/src/tangara/database/tag_parser.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "tag_parser.hpp"
+#include "database/tag_parser.hpp"
#include <cstdint>
#include <cstdlib>
diff --git a/src/tangara/database/tag_parser.hpp b/src/tangara/database/tag_parser.hpp
index 966258b5..ccbc0ea9 100644
--- a/src/tangara/database/tag_parser.hpp
+++ b/src/tangara/database/tag_parser.hpp
@@ -8,8 +8,8 @@
#include <string>
+#include "database/track.hpp"
#include "lru_cache.hpp"
-#include "track.hpp"
namespace database {
diff --git a/src/tangara/database/test/test_database.cpp b/src/tangara/database/test/test_database.cpp
index 6aec9bfb..09e19a43 100644
--- a/src/tangara/database/test/test_database.cpp
+++ b/src/tangara/database/test/test_database.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "database.hpp"
+#include "database/database.hpp"
#include <stdint.h>
#include <iomanip>
@@ -13,14 +13,14 @@
#include <string>
#include "catch2/catch.hpp"
+#include "database/file_gatherer.hpp"
+#include "database/tag_parser.hpp"
+#include "database/track.hpp"
#include "driver_cache.hpp"
#include "esp_log.h"
-#include "file_gatherer.hpp"
#include "i2c_fixture.hpp"
#include "leveldb/db.h"
#include "spi_fixture.hpp"
-#include "tag_parser.hpp"
-#include "track.hpp"
namespace database {
@@ -28,8 +28,8 @@ class TestBackends : public IFileGatherer, public ITagParser {
public:
std::map<std::pmr::string, TrackTags> tracks;
- auto MakeTrack(const std::pmr::string& path, const std::pmr::string& title)
- -> void {
+ auto MakeTrack(const std::pmr::string& path,
+ const std::pmr::string& title) -> void {
TrackTags tags;
tags.encoding = Encoding::kMp3;
tags.title = title;
@@ -44,8 +44,8 @@ class TestBackends : public IFileGatherer, public ITagParser {
}
}
- auto ReadAndParseTags(const std::pmr::string& path, TrackTags* out)
- -> bool override {
+ auto ReadAndParseTags(const std::pmr::string& path,
+ TrackTags* out) -> bool override {
if (tracks.contains(path)) {
*out = tracks.at(path);
return true;
diff --git a/src/tangara/database/test/test_records.cpp b/src/tangara/database/test/test_records.cpp
index 2f59489c..f8eb980f 100644
--- a/src/tangara/database/test/test_records.cpp
+++ b/src/tangara/database/test/test_records.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "records.hpp"
+#include "database/records.hpp"
#include <stdint.h>
#include <iomanip>
diff --git a/src/tangara/database/track.cpp b/src/tangara/database/track.cpp
index 1b1442a1..5bf8c3e2 100644
--- a/src/tangara/database/track.cpp
+++ b/src/tangara/database/track.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "track.hpp"
+#include "database/track.hpp"
#include <iomanip>
#include <iostream>
diff --git a/src/tangara/dev_console/console.cpp b/src/tangara/dev_console/console.cpp
index f2b1efea..cee68b49 100644
--- a/src/tangara/dev_console/console.cpp
+++ b/src/tangara/dev_console/console.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "console.hpp"
+#include "dev_console/console.hpp"
#include <stdio.h>
#include <string.h>
diff --git a/src/tangara/events/event_queue.cpp b/src/tangara/events/event_queue.cpp
index f8f5b1ee..e4751398 100644
--- a/src/tangara/events/event_queue.cpp
+++ b/src/tangara/events/event_queue.cpp
@@ -6,12 +6,13 @@
#include "events/event_queue.hpp"
-#include "audio_fsm.hpp"
#include "freertos/FreeRTOS.h"
#include "freertos/portmacro.h"
#include "freertos/queue.h"
-#include "system_fsm.hpp"
-#include "ui_fsm.hpp"
+
+#include "audio/audio_fsm.hpp"
+#include "system_fsm/system_fsm.hpp"
+#include "ui/ui_fsm.hpp"
namespace events {
diff --git a/src/tangara/events/event_queue.hpp b/src/tangara/events/event_queue.hpp
index 78b21d53..aa7f472d 100644
--- a/src/tangara/events/event_queue.hpp
+++ b/src/tangara/events/event_queue.hpp
@@ -11,14 +11,14 @@
#include <queue>
#include <type_traits>
-#include "audio_fsm.hpp"
+#include "audio/audio_fsm.hpp"
#include "freertos/FreeRTOS.h"
#include "freertos/portmacro.h"
#include "freertos/queue.h"
-#include "system_fsm.hpp"
+#include "system_fsm/system_fsm.hpp"
#include "tinyfsm.hpp"
-#include "ui_fsm.hpp"
+#include "ui/ui_fsm.hpp"
namespace events {
diff --git a/src/tangara/input/device_factory.cpp b/src/tangara/input/device_factory.cpp
index 65f4d785..8e1c5155 100644
--- a/src/tangara/input/device_factory.cpp
+++ b/src/tangara/input/device_factory.cpp
@@ -4,16 +4,16 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "device_factory.hpp"
+#include "input/device_factory.hpp"
#include <memory>
-#include "feedback_haptics.hpp"
-#include "input_device.hpp"
-#include "input_nav_buttons.hpp"
-#include "input_touch_dpad.hpp"
-#include "input_touch_wheel.hpp"
-#include "input_volume_buttons.hpp"
+#include "input/feedback_haptics.hpp"
+#include "input/input_device.hpp"
+#include "input/input_nav_buttons.hpp"
+#include "input/input_touch_dpad.hpp"
+#include "input/input_touch_wheel.hpp"
+#include "input/input_volume_buttons.hpp"
namespace input {
diff --git a/src/tangara/input/device_factory.hpp b/src/tangara/input/device_factory.hpp
index dd9c7133..862c8728 100644
--- a/src/tangara/input/device_factory.hpp
+++ b/src/tangara/input/device_factory.hpp
@@ -9,11 +9,11 @@
#include <cstdint>
#include <memory>
-#include "feedback_device.hpp"
-#include "input_device.hpp"
-#include "input_touch_wheel.hpp"
+#include "input/feedback_device.hpp"
+#include "input/input_device.hpp"
+#include "input/input_touch_wheel.hpp"
#include "nvs.hpp"
-#include "service_locator.hpp"
+#include "system_fsm/service_locator.hpp"
namespace input {
diff --git a/src/tangara/input/feedback_haptics.hpp b/src/tangara/input/feedback_haptics.hpp
index a307a429..5727c0f3 100644
--- a/src/tangara/input/feedback_haptics.hpp
+++ b/src/tangara/input/feedback_haptics.hpp
@@ -8,8 +8,8 @@
#include <cstdint>
-#include "feedback_device.hpp"
#include "haptics.hpp"
+#include "input/feedback_device.hpp"
namespace input {
diff --git a/src/tangara/input/input_device.hpp b/src/tangara/input/input_device.hpp
index d944c3bf..e3d17c6c 100644
--- a/src/tangara/input/input_device.hpp
+++ b/src/tangara/input/input_device.hpp
@@ -11,8 +11,8 @@
#include <vector>
#include "hal/lv_hal_indev.h"
-#include "input_hook.hpp"
-#include "property.hpp"
+#include "input/input_hook.hpp"
+#include "lua/property.hpp"
namespace input {
diff --git a/src/tangara/input/input_hook.hpp b/src/tangara/input/input_hook.hpp
index a8705210..3dc8a2c8 100644
--- a/src/tangara/input/input_hook.hpp
+++ b/src/tangara/input/input_hook.hpp
@@ -13,7 +13,7 @@
#include "hal/lv_hal_indev.h"
#include "lua.hpp"
-#include "input_trigger.hpp"
+#include "input/input_trigger.hpp"
namespace input {
diff --git a/src/tangara/input/input_hook_actions.hpp b/src/tangara/input/input_hook_actions.hpp
index 105bd10d..71a560bc 100644
--- a/src/tangara/input/input_hook_actions.hpp
+++ b/src/tangara/input/input_hook_actions.hpp
@@ -7,7 +7,7 @@
#pragma once
#include "hal/lv_hal_indev.h"
-#include "input_hook.hpp"
+#include "input/input_hook.hpp"
namespace input {
namespace actions {
diff --git a/src/tangara/input/input_nav_buttons.cpp b/src/tangara/input/input_nav_buttons.cpp
index 61d80075..28711e4e 100644
--- a/src/tangara/input/input_nav_buttons.cpp
+++ b/src/tangara/input/input_nav_buttons.cpp
@@ -4,12 +4,12 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "input_nav_buttons.hpp"
+#include "input/input_nav_buttons.hpp"
-#include "event_queue.hpp"
+#include "events/event_queue.hpp"
#include "gpios.hpp"
#include "hal/lv_hal_indev.h"
-#include "input_hook_actions.hpp"
+#include "input/input_hook_actions.hpp"
namespace input {
diff --git a/src/tangara/input/input_nav_buttons.hpp b/src/tangara/input/input_nav_buttons.hpp
index 9feeb375..1349ff72 100644
--- a/src/tangara/input/input_nav_buttons.hpp
+++ b/src/tangara/input/input_nav_buttons.hpp
@@ -12,9 +12,9 @@
#include "hal/lv_hal_indev.h"
#include "haptics.hpp"
-#include "input_device.hpp"
-#include "input_hook.hpp"
-#include "input_trigger.hpp"
+#include "input/input_device.hpp"
+#include "input/input_hook.hpp"
+#include "input/input_trigger.hpp"
#include "touchwheel.hpp"
namespace input {
diff --git a/src/tangara/input/input_touch_dpad.hpp b/src/tangara/input/input_touch_dpad.hpp
index 0c45b2d9..a0406e2b 100644
--- a/src/tangara/input/input_touch_dpad.hpp
+++ b/src/tangara/input/input_touch_dpad.hpp
@@ -11,9 +11,9 @@
#include "hal/lv_hal_indev.h"
#include "haptics.hpp"
-#include "input_device.hpp"
-#include "input_hook.hpp"
-#include "input_trigger.hpp"
+#include "input/input_device.hpp"
+#include "input/input_hook.hpp"
+#include "input/input_trigger.hpp"
#include "touchwheel.hpp"
namespace input {
diff --git a/src/tangara/input/input_touch_wheel.cpp b/src/tangara/input/input_touch_wheel.cpp
index e6a3b880..a496e882 100644
--- a/src/tangara/input/input_touch_wheel.cpp
+++ b/src/tangara/input/input_touch_wheel.cpp
@@ -13,13 +13,13 @@
#include "events/event_queue.hpp"
#include "haptics.hpp"
-#include "input_device.hpp"
-#include "input_hook_actions.hpp"
-#include "input_trigger.hpp"
+#include "input/input_device.hpp"
+#include "input/input_hook_actions.hpp"
+#include "input/input_trigger.hpp"
+#include "lua/property.hpp"
#include "nvs.hpp"
-#include "property.hpp"
#include "touchwheel.hpp"
-#include "ui_events.hpp"
+#include "ui/ui_events.hpp"
namespace input {
diff --git a/src/tangara/input/input_touch_wheel.hpp b/src/tangara/input/input_touch_wheel.hpp
index 764cc68d..b45ba361 100644
--- a/src/tangara/input/input_touch_wheel.hpp
+++ b/src/tangara/input/input_touch_wheel.hpp
@@ -12,11 +12,11 @@
#include "hal/lv_hal_indev.h"
#include "haptics.hpp"
-#include "input_device.hpp"
-#include "input_hook.hpp"
-#include "input_trigger.hpp"
+#include "input/input_device.hpp"
+#include "input/input_hook.hpp"
+#include "input/input_trigger.hpp"
+#include "lua/property.hpp"
#include "nvs.hpp"
-#include "property.hpp"
#include "touchwheel.hpp"
namespace input {
diff --git a/src/tangara/input/input_volume_buttons.cpp b/src/tangara/input/input_volume_buttons.cpp
index 37cf90e5..16267ef6 100644
--- a/src/tangara/input/input_volume_buttons.cpp
+++ b/src/tangara/input/input_volume_buttons.cpp
@@ -4,10 +4,10 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "input_volume_buttons.hpp"
-#include "event_queue.hpp"
+#include "input/input_volume_buttons.hpp"
+#include "events/event_queue.hpp"
#include "gpios.hpp"
-#include "input_hook_actions.hpp"
+#include "input/input_hook_actions.hpp"
namespace input {
diff --git a/src/tangara/input/input_volume_buttons.hpp b/src/tangara/input/input_volume_buttons.hpp
index e3246df4..8a0ed18d 100644
--- a/src/tangara/input/input_volume_buttons.hpp
+++ b/src/tangara/input/input_volume_buttons.hpp
@@ -12,8 +12,8 @@
#include "hal/lv_hal_indev.h"
#include "haptics.hpp"
-#include "input_device.hpp"
-#include "input_hook.hpp"
+#include "input/input_device.hpp"
+#include "input/input_hook.hpp"
#include "touchwheel.hpp"
namespace input {
diff --git a/src/tangara/input/lvgl_input_driver.hpp b/src/tangara/input/lvgl_input_driver.hpp
index 9adaf143..6be24f7f 100644
--- a/src/tangara/input/lvgl_input_driver.hpp
+++ b/src/tangara/input/lvgl_input_driver.hpp
@@ -12,16 +12,16 @@
#include <set>
#include "core/lv_group.h"
-#include "device_factory.hpp"
-#include "feedback_device.hpp"
#include "gpios.hpp"
#include "hal/lv_hal_indev.h"
+#include "input/device_factory.hpp"
+#include "input/feedback_device.hpp"
-#include "input_device.hpp"
-#include "input_hook.hpp"
-#include "lua_thread.hpp"
+#include "input/input_device.hpp"
+#include "input/input_hook.hpp"
+#include "lua/lua_thread.hpp"
+#include "lua/property.hpp"
#include "nvs.hpp"
-#include "property.hpp"
#include "touchwheel.hpp"
namespace input {
diff --git a/src/tangara/lua/bridge.cpp b/src/tangara/lua/bridge.cpp
index cfa9d5f7..17dd41cc 100644
--- a/src/tangara/lua/bridge.cpp
+++ b/src/tangara/lua/bridge.cpp
@@ -4,33 +4,33 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "bridge.hpp"
-#include <sys/_stdint.h>
+#include "lua/bridge.hpp"
+#include <cstdint>
#include <memory>
#include <string>
-#include "database.hpp"
+#include "database/database.hpp"
+#include "database/index.hpp"
#include "esp_log.h"
-#include "index.hpp"
#include "lauxlib.h"
#include "lua.h"
#include "lua.hpp"
-#include "lua_controls.hpp"
-#include "lua_database.hpp"
-#include "lua_queue.hpp"
-#include "lua_screen.hpp"
-#include "lua_version.hpp"
-#include "lua_theme.hpp"
+#include "lua/lua_controls.hpp"
+#include "lua/lua_database.hpp"
+#include "lua/lua_queue.hpp"
+#include "lua/lua_screen.hpp"
+#include "lua/lua_theme.hpp"
+#include "lua/lua_version.hpp"
#include "lvgl.h"
#include "font/lv_font_loader.h"
#include "luavgl.h"
-#include "event_queue.hpp"
-#include "property.hpp"
-#include "service_locator.hpp"
-#include "ui_events.hpp"
+#include "events/event_queue.hpp"
+#include "lua/property.hpp"
+#include "system_fsm/service_locator.hpp"
+#include "ui/ui_events.hpp"
extern "C" {
int luaopen_linenoise(lua_State* L);
diff --git a/src/tangara/lua/bridge.hpp b/src/tangara/lua/bridge.hpp
index 64f14e0e..b4cfe503 100644
--- a/src/tangara/lua/bridge.hpp
+++ b/src/tangara/lua/bridge.hpp
@@ -10,9 +10,9 @@
#include <string>
#include "lua.hpp"
+#include "lua/property.hpp"
#include "lvgl.h"
-#include "property.hpp"
-#include "service_locator.hpp"
+#include "system_fsm/service_locator.hpp"
namespace lua {
@@ -39,9 +39,8 @@ class Bridge {
auto installPropertyModule(
lua_State* L,
const std::string&,
- std::vector<
- std::pair<std::string, std::variant<LuaFunction, Property*>>>&)
- -> void;
+ std::vector<std::pair<std::string,
+ std::variant<LuaFunction, Property*>>>&) -> void;
Bridge(const Bridge&) = delete;
Bridge& operator=(const Bridge&) = delete;
diff --git a/src/tangara/lua/lua_controls.cpp b/src/tangara/lua/lua_controls.cpp
index 2da0ed11..ab5b3c02 100644
--- a/src/tangara/lua/lua_controls.cpp
+++ b/src/tangara/lua/lua_controls.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "lua_controls.hpp"
+#include "lua/lua_controls.hpp"
#include <memory>
#include <string>
@@ -17,7 +17,7 @@
#include "lvgl.h"
#include "nvs.hpp"
-#include "ui_events.hpp"
+#include "ui/ui_events.hpp"
namespace lua {
diff --git a/src/tangara/lua/lua_database.cpp b/src/tangara/lua/lua_database.cpp
index d0612fdd..1afb01f0 100644
--- a/src/tangara/lua/lua_database.cpp
+++ b/src/tangara/lua/lua_database.cpp
@@ -4,30 +4,30 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "lua_database.hpp"
+#include "lua/lua_database.hpp"
#include <memory>
#include <string>
#include <type_traits>
#include <variant>
-#include "bridge.hpp"
#include "lua.hpp"
+#include "lua/bridge.hpp"
#include "esp_log.h"
#include "lauxlib.h"
#include "lua.h"
-#include "lua_thread.hpp"
+#include "lua/lua_thread.hpp"
#include "lvgl.h"
-#include "database.hpp"
-#include "event_queue.hpp"
-#include "index.hpp"
-#include "property.hpp"
-#include "records.hpp"
-#include "service_locator.hpp"
-#include "track.hpp"
-#include "ui_events.hpp"
+#include "database/database.hpp"
+#include "database/index.hpp"
+#include "database/records.hpp"
+#include "database/track.hpp"
+#include "events/event_queue.hpp"
+#include "lua/property.hpp"
+#include "system_fsm/service_locator.hpp"
+#include "ui/ui_events.hpp"
namespace lua {
@@ -152,8 +152,8 @@ auto db_check_iterator(lua_State* L, int stack_pos) -> database::Iterator* {
return it;
}
-static auto push_iterator(lua_State* state, const database::Iterator& it)
- -> void {
+static auto push_iterator(lua_State* state,
+ const database::Iterator& it) -> void {
database::Iterator** data = reinterpret_cast<database::Iterator**>(
lua_newuserdata(state, sizeof(uintptr_t)));
*data = new database::Iterator(it);
@@ -198,12 +198,10 @@ static auto db_iterator_gc(lua_State* state) -> int {
return 0;
}
-static const struct luaL_Reg kDbIteratorFuncs[] = {{"next", db_iterate},
- {"prev", db_iterate_prev},
- {"clone", db_iterator_clone},
- {"__call", db_iterate},
- {"__gc", db_iterator_gc},
- {NULL, NULL}};
+static const struct luaL_Reg kDbIteratorFuncs[] = {
+ {"next", db_iterate}, {"prev", db_iterate_prev},
+ {"clone", db_iterator_clone}, {"__call", db_iterate},
+ {"__gc", db_iterator_gc}, {NULL, NULL}};
static auto record_text(lua_State* state) -> int {
LuaRecord* data = reinterpret_cast<LuaRecord*>(
diff --git a/src/tangara/lua/lua_database.hpp b/src/tangara/lua/lua_database.hpp
index b0d2acbd..328004ef 100644
--- a/src/tangara/lua/lua_database.hpp
+++ b/src/tangara/lua/lua_database.hpp
@@ -8,7 +8,7 @@
#include "lua.hpp"
-#include "database.hpp"
+#include "database/database.hpp"
namespace lua {
diff --git a/src/tangara/lua/lua_queue.cpp b/src/tangara/lua/lua_queue.cpp
index dfb820c2..bc393aa5 100644
--- a/src/tangara/lua/lua_queue.cpp
+++ b/src/tangara/lua/lua_queue.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "lua_database.hpp"
+#include "lua/lua_database.hpp"
#include <memory>
#include <string>
@@ -16,15 +16,15 @@
#include "lua.h"
#include "lvgl.h"
-#include "bridge.hpp"
-#include "database.hpp"
-#include "event_queue.hpp"
-#include "index.hpp"
-#include "property.hpp"
-#include "service_locator.hpp"
-#include "track.hpp"
-#include "track_queue.hpp"
-#include "ui_events.hpp"
+#include "audio/track_queue.hpp"
+#include "database/database.hpp"
+#include "database/index.hpp"
+#include "database/track.hpp"
+#include "events/event_queue.hpp"
+#include "lua/bridge.hpp"
+#include "lua/property.hpp"
+#include "system_fsm/service_locator.hpp"
+#include "ui/ui_events.hpp"
namespace lua {
diff --git a/src/tangara/lua/lua_registry.hpp b/src/tangara/lua/lua_registry.hpp
index abc5063e..e556b6eb 100644
--- a/src/tangara/lua/lua_registry.hpp
+++ b/src/tangara/lua/lua_registry.hpp
@@ -11,9 +11,9 @@
#include "lua.hpp"
-#include "bridge.hpp"
-#include "lua_thread.hpp"
-#include "service_locator.hpp"
+#include "lua/bridge.hpp"
+#include "lua/lua_thread.hpp"
+#include "system_fsm/service_locator.hpp"
namespace lua {
diff --git a/src/tangara/lua/lua_screen.cpp b/src/tangara/lua/lua_screen.cpp
index f17f6b1a..8d87eebd 100644
--- a/src/tangara/lua/lua_screen.cpp
+++ b/src/tangara/lua/lua_screen.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "lua_screen.hpp"
+#include "lua/lua_screen.hpp"
#include <memory>
#include <string>
@@ -16,15 +16,15 @@
#include "lua.h"
#include "lvgl.h"
-#include "bridge.hpp"
-#include "database.hpp"
-#include "event_queue.hpp"
-#include "index.hpp"
-#include "property.hpp"
-#include "service_locator.hpp"
-#include "track.hpp"
-#include "track_queue.hpp"
-#include "ui_events.hpp"
+#include "audio/track_queue.hpp"
+#include "database/database.hpp"
+#include "database/index.hpp"
+#include "database/track.hpp"
+#include "events/event_queue.hpp"
+#include "lua/bridge.hpp"
+#include "lua/property.hpp"
+#include "system_fsm/service_locator.hpp"
+#include "ui/ui_events.hpp"
namespace lua {
diff --git a/src/tangara/lua/lua_theme.cpp b/src/tangara/lua/lua_theme.cpp
index 72434d97..5edde104 100644
--- a/src/tangara/lua/lua_theme.cpp
+++ b/src/tangara/lua/lua_theme.cpp
@@ -5,20 +5,20 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "lua_version.hpp"
+#include "lua/lua_version.hpp"
#include <string>
-#include "bridge.hpp"
#include "lua.hpp"
+#include "lua/bridge.hpp"
#include "esp_app_desc.h"
#include "esp_log.h"
#include "lauxlib.h"
#include "lua.h"
-#include "lua_thread.hpp"
+#include "lua/lua_thread.hpp"
#include "luavgl.h"
-#include "themes.hpp"
+#include "ui/themes.hpp"
namespace lua {
@@ -35,7 +35,7 @@ static auto set_style(lua_State* L) -> int {
static auto set_theme(lua_State* L) -> int {
std::string class_name;
luaL_checktype(L, -1, LUA_TTABLE);
- lua_pushnil(L); /* first key */
+ lua_pushnil(L); /* first key */
while (lua_next(L, -2) != 0) {
/* uses 'key' (at index -2) and 'value' (at index -1) */
if (lua_type(L, -2) == LUA_TSTRING) {
@@ -43,11 +43,11 @@ static auto set_theme(lua_State* L) -> int {
}
if (lua_type(L, -1) == LUA_TTABLE) {
// Nesting
- lua_pushnil(L); // First key
+ lua_pushnil(L); // First key
while (lua_next(L, -2) != 0) {
// Nesting the second
int selector = -1;
- lua_pushnil(L); // First key
+ lua_pushnil(L); // First key
while (lua_next(L, -2) != 0) {
int idx = lua_tointeger(L, -2);
if (idx == 1) {
@@ -60,12 +60,13 @@ static auto set_theme(lua_State* L) -> int {
ESP_LOGI("lua_theme", "Style was null or malformed");
return 0;
} else {
- ui::themes::Theme::instance()->AddStyle(class_name, selector, style);
+ ui::themes::Theme::instance()->AddStyle(class_name, selector,
+ style);
}
}
- lua_pop(L, 1);
+ lua_pop(L, 1);
}
- lua_pop(L, 1);
+ lua_pop(L, 1);
}
}
/* removes 'value'; keeps 'key' for next iteration */
@@ -74,7 +75,9 @@ static auto set_theme(lua_State* L) -> int {
return 0;
}
-static const struct luaL_Reg kThemeFuncs[] = {{"set", set_theme}, {"set_style", set_style}, {NULL, NULL}};
+static const struct luaL_Reg kThemeFuncs[] = {{"set", set_theme},
+ {"set_style", set_style},
+ {NULL, NULL}};
static auto lua_theme(lua_State* L) -> int {
luaL_newlib(L, kThemeFuncs);
diff --git a/src/tangara/lua/lua_thread.cpp b/src/tangara/lua/lua_thread.cpp
index dd72e41d..77a46b45 100644
--- a/src/tangara/lua/lua_thread.cpp
+++ b/src/tangara/lua/lua_thread.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "lua_thread.hpp"
+#include "lua/lua_thread.hpp"
#include <iostream>
#include <memory>
@@ -13,11 +13,11 @@
#include "esp_log.h"
#include "lua.hpp"
-#include "bridge.hpp"
-#include "event_queue.hpp"
+#include "events/event_queue.hpp"
+#include "lua/bridge.hpp"
#include "memory_resource.hpp"
-#include "service_locator.hpp"
-#include "ui_events.hpp"
+#include "system_fsm/service_locator.hpp"
+#include "ui/ui_events.hpp"
namespace lua {
@@ -42,8 +42,10 @@ class Allocator {
size_t total_allocated_;
};
-static auto lua_alloc(void* ud, void* ptr, size_t osize, size_t nsize)
- -> void* {
+static auto lua_alloc(void* ud,
+ void* ptr,
+ size_t osize,
+ size_t nsize) -> void* {
Allocator* instance = reinterpret_cast<Allocator*>(ud);
return instance->alloc(ptr, osize, nsize);
}
diff --git a/src/tangara/lua/lua_thread.hpp b/src/tangara/lua/lua_thread.hpp
index 384de61d..d7602c1e 100644
--- a/src/tangara/lua/lua_thread.hpp
+++ b/src/tangara/lua/lua_thread.hpp
@@ -11,7 +11,7 @@
#include "lua.hpp"
-#include "service_locator.hpp"
+#include "system_fsm/service_locator.hpp"
namespace lua {
diff --git a/src/tangara/lua/lua_version.cpp b/src/tangara/lua/lua_version.cpp
index e5f06bb5..b85a30a5 100644
--- a/src/tangara/lua/lua_version.cpp
+++ b/src/tangara/lua/lua_version.cpp
@@ -5,18 +5,18 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "lua_version.hpp"
+#include "lua/lua_version.hpp"
#include <string>
-#include "bridge.hpp"
#include "lua.hpp"
+#include "lua/bridge.hpp"
#include "esp_app_desc.h"
#include "esp_log.h"
#include "lauxlib.h"
#include "lua.h"
-#include "lua_thread.hpp"
+#include "lua/lua_thread.hpp"
namespace lua {
diff --git a/src/tangara/lua/property.cpp b/src/tangara/lua/property.cpp
index 9f4a1908..951c225f 100644
--- a/src/tangara/lua/property.cpp
+++ b/src/tangara/lua/property.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "property.hpp"
+#include "lua/property.hpp"
#include <sys/_stdint.h>
#include <cmath>
@@ -15,14 +15,14 @@
#include <variant>
#include "bluetooth_types.hpp"
+#include "database/track.hpp"
#include "lauxlib.h"
#include "lua.h"
#include "lua.hpp"
-#include "lua_thread.hpp"
+#include "lua/lua_thread.hpp"
#include "lvgl.h"
#include "memory_resource.hpp"
-#include "service_locator.hpp"
-#include "track.hpp"
+#include "system_fsm/service_locator.hpp"
#include "types.hpp"
namespace lua {
diff --git a/src/tangara/lua/property.hpp b/src/tangara/lua/property.hpp
index 724261be..2df61bad 100644
--- a/src/tangara/lua/property.hpp
+++ b/src/tangara/lua/property.hpp
@@ -10,11 +10,11 @@
#include <memory>
#include <string>
-#include "audio_events.hpp"
+#include "audio/audio_events.hpp"
#include "bluetooth_types.hpp"
#include "lua.hpp"
#include "lvgl.h"
-#include "service_locator.hpp"
+#include "system_fsm/service_locator.hpp"
namespace lua {
diff --git a/src/tangara/lua/registry.cpp b/src/tangara/lua/registry.cpp
index a6487858..d33594a3 100644
--- a/src/tangara/lua/registry.cpp
+++ b/src/tangara/lua/registry.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "lua_registry.hpp"
+#include "lua/lua_registry.hpp"
#include <iostream>
#include <memory>
@@ -13,11 +13,11 @@
#include "esp_log.h"
#include "lua.hpp"
-#include "bridge.hpp"
-#include "event_queue.hpp"
+#include "events/event_queue.hpp"
+#include "lua/bridge.hpp"
#include "memory_resource.hpp"
-#include "service_locator.hpp"
-#include "ui_events.hpp"
+#include "system_fsm/service_locator.hpp"
+#include "ui/ui_events.hpp"
namespace lua {
diff --git a/src/tangara/system_fsm/booting.cpp b/src/tangara/system_fsm/booting.cpp
index 44700cc4..d9e05c39 100644
--- a/src/tangara/system_fsm/booting.cpp
+++ b/src/tangara/system_fsm/booting.cpp
@@ -7,7 +7,7 @@
#include "collation.hpp"
#include "haptics.hpp"
#include "spiffs.hpp"
-#include "system_fsm.hpp"
+#include "system_fsm/system_fsm.hpp"
#include <stdint.h>
#include <memory>
@@ -21,24 +21,24 @@
#include "freertos/timers.h"
#include "adc.hpp"
-#include "audio_fsm.hpp"
-#include "battery.hpp"
+#include "audio/audio_fsm.hpp"
+#include "audio/track_queue.hpp"
+#include "battery/battery.hpp"
#include "bluetooth.hpp"
#include "bluetooth_types.hpp"
+#include "database/tag_parser.hpp"
#include "display_init.hpp"
-#include "event_queue.hpp"
+#include "events/event_queue.hpp"
#include "gpios.hpp"
#include "i2c.hpp"
#include "nvs.hpp"
#include "samd.hpp"
-#include "service_locator.hpp"
#include "spi.hpp"
-#include "system_events.hpp"
-#include "tag_parser.hpp"
+#include "system_fsm/service_locator.hpp"
+#include "system_fsm/system_events.hpp"
#include "tasks.hpp"
#include "touchwheel.hpp"
-#include "track_queue.hpp"
-#include "ui_fsm.hpp"
+#include "ui/ui_fsm.hpp"
namespace system_fsm {
namespace states {
diff --git a/src/tangara/system_fsm/idle.cpp b/src/tangara/system_fsm/idle.cpp
index e28864b3..243faa5b 100644
--- a/src/tangara/system_fsm/idle.cpp
+++ b/src/tangara/system_fsm/idle.cpp
@@ -4,20 +4,20 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "app_console.hpp"
-#include "file_gatherer.hpp"
+#include "app_console/app_console.hpp"
+#include "database/file_gatherer.hpp"
#include "freertos/portmacro.h"
#include "freertos/projdefs.h"
#include "gpios.hpp"
#include "result.hpp"
-#include "audio_fsm.hpp"
-#include "event_queue.hpp"
+#include "audio/audio_fsm.hpp"
+#include "events/event_queue.hpp"
#include "samd.hpp"
#include "storage.hpp"
-#include "system_events.hpp"
-#include "system_fsm.hpp"
-#include "ui_fsm.hpp"
+#include "system_fsm/system_events.hpp"
+#include "system_fsm/system_fsm.hpp"
+#include "ui/ui_fsm.hpp"
namespace system_fsm {
namespace states {
diff --git a/src/tangara/system_fsm/running.cpp b/src/tangara/system_fsm/running.cpp
index 796c96dc..a19abdaf 100644
--- a/src/tangara/system_fsm/running.cpp
+++ b/src/tangara/system_fsm/running.cpp
@@ -4,23 +4,23 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "app_console.hpp"
-#include "audio_events.hpp"
-#include "database.hpp"
-#include "db_events.hpp"
+#include "app_console/app_console.hpp"
+#include "audio/audio_events.hpp"
+#include "database/database.hpp"
+#include "database/db_events.hpp"
+#include "database/file_gatherer.hpp"
#include "ff.h"
-#include "file_gatherer.hpp"
#include "freertos/portmacro.h"
#include "freertos/projdefs.h"
#include "gpios.hpp"
#include "result.hpp"
-#include "audio_fsm.hpp"
-#include "event_queue.hpp"
+#include "audio/audio_fsm.hpp"
+#include "events/event_queue.hpp"
#include "storage.hpp"
-#include "system_events.hpp"
-#include "system_fsm.hpp"
-#include "ui_fsm.hpp"
+#include "system_fsm/system_events.hpp"
+#include "system_fsm/system_fsm.hpp"
+#include "ui/ui_fsm.hpp"
namespace system_fsm {
namespace states {
diff --git a/src/tangara/system_fsm/service_locator.cpp b/src/tangara/system_fsm/service_locator.cpp
index d8dcf44a..610406f9 100644
--- a/src/tangara/system_fsm/service_locator.cpp
+++ b/src/tangara/system_fsm/service_locator.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "service_locator.hpp"
+#include "system_fsm/service_locator.hpp"
#include <memory>
diff --git a/src/tangara/system_fsm/service_locator.hpp b/src/tangara/system_fsm/service_locator.hpp
index 5978578c..a76488ab 100644
--- a/src/tangara/system_fsm/service_locator.hpp
+++ b/src/tangara/system_fsm/service_locator.hpp
@@ -8,19 +8,19 @@
#include <memory>
-#include "battery.hpp"
+#include "audio/track_queue.hpp"
+#include "battery/battery.hpp"
#include "bluetooth.hpp"
#include "collation.hpp"
-#include "database.hpp"
+#include "database/database.hpp"
+#include "database/tag_parser.hpp"
#include "gpios.hpp"
#include "haptics.hpp"
#include "nvs.hpp"
#include "samd.hpp"
#include "storage.hpp"
-#include "tag_parser.hpp"
#include "tasks.hpp"
#include "touchwheel.hpp"
-#include "track_queue.hpp"
namespace system_fsm {
diff --git a/src/tangara/system_fsm/system_events.hpp b/src/tangara/system_fsm/system_events.hpp
index 22e3b6bd..4f1614bf 100644
--- a/src/tangara/system_fsm/system_events.hpp
+++ b/src/tangara/system_fsm/system_events.hpp
@@ -8,13 +8,13 @@
#include <memory>
-#include "battery.hpp"
+#include "battery/battery.hpp"
#include "bluetooth_types.hpp"
-#include "database.hpp"
+#include "database/database.hpp"
#include "ff.h"
#include "haptics.hpp"
#include "samd.hpp"
-#include "service_locator.hpp"
+#include "system_fsm/service_locator.hpp"
#include "tinyfsm.hpp"
namespace system_fsm {
diff --git a/src/tangara/system_fsm/system_fsm.cpp b/src/tangara/system_fsm/system_fsm.cpp
index 59d41c73..7b5e2234 100644
--- a/src/tangara/system_fsm/system_fsm.cpp
+++ b/src/tangara/system_fsm/system_fsm.cpp
@@ -4,15 +4,15 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "system_fsm.hpp"
-#include "audio_fsm.hpp"
+#include "system_fsm/system_fsm.hpp"
+#include "audio/audio_fsm.hpp"
+#include "audio/track_queue.hpp"
+#include "database/tag_parser.hpp"
#include "driver/gpio.h"
-#include "event_queue.hpp"
+#include "events/event_queue.hpp"
#include "gpios.hpp"
-#include "service_locator.hpp"
-#include "system_events.hpp"
-#include "tag_parser.hpp"
-#include "track_queue.hpp"
+#include "system_fsm/service_locator.hpp"
+#include "system_fsm/system_events.hpp"
[[maybe_unused]] static const char kTag[] = "system";
diff --git a/src/tangara/system_fsm/system_fsm.hpp b/src/tangara/system_fsm/system_fsm.hpp
index f01afb3f..d2971734 100644
--- a/src/tangara/system_fsm/system_fsm.hpp
+++ b/src/tangara/system_fsm/system_fsm.hpp
@@ -8,28 +8,27 @@
#include <memory>
-#include "app_console.hpp"
-#include "audio_events.hpp"
-#include "battery.hpp"
+#include "freertos/FreeRTOS.h"
+#include "freertos/timers.h"
+
+#include "app_console/app_console.hpp"
+#include "audio/audio_events.hpp"
+#include "audio/track_queue.hpp"
+#include "battery/battery.hpp"
#include "bluetooth.hpp"
-#include "database.hpp"
-#include "db_events.hpp"
+#include "database/database.hpp"
+#include "database/db_events.hpp"
+#include "database/tag_parser.hpp"
#include "display.hpp"
#include "gpios.hpp"
#include "nvs.hpp"
#include "samd.hpp"
-#include "service_locator.hpp"
#include "storage.hpp"
-#include "tag_parser.hpp"
+#include "system_fsm/service_locator.hpp"
+#include "system_fsm/system_events.hpp"
#include "tinyfsm.hpp"
#include "touchwheel.hpp"
-#include "freertos/FreeRTOS.h"
-#include "freertos/timers.h"
-
-#include "system_events.hpp"
-#include "track_queue.hpp"
-
namespace system_fsm {
void check_interrupts_cb(TimerHandle_t timer);
diff --git a/src/tangara/ui/lvgl_task.cpp b/src/tangara/ui/lvgl_task.cpp
index 51da0179..33c3667d 100644
--- a/src/tangara/ui/lvgl_task.cpp
+++ b/src/tangara/ui/lvgl_task.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "lvgl_task.hpp"
+#include "ui/lvgl_task.hpp"
#include <dirent.h>
#include <stdint.h>
@@ -21,7 +21,7 @@
#include "core/lv_obj_pos.h"
#include "core/lv_obj_tree.h"
#include "esp_log.h"
-#include "event_queue.hpp"
+#include "events/event_queue.hpp"
#include "extra/themes/basic/lv_theme_basic.h"
#include "font/lv_font.h"
#include "freertos/portmacro.h"
@@ -30,17 +30,17 @@
#include "hal/gpio_types.h"
#include "hal/lv_hal_indev.h"
#include "hal/spi_types.h"
+#include "input/lvgl_input_driver.hpp"
#include "lua.h"
#include "lv_api_map.h"
#include "lvgl/lvgl.h"
-#include "lvgl_input_driver.hpp"
#include "misc/lv_color.h"
#include "misc/lv_style.h"
#include "misc/lv_timer.h"
-#include "modal.hpp"
#include "tasks.hpp"
#include "touchwheel.hpp"
-#include "ui_fsm.hpp"
+#include "ui/modal.hpp"
+#include "ui/ui_fsm.hpp"
#include "widgets/lv_label.h"
#include "display.hpp"
diff --git a/src/tangara/ui/lvgl_task.hpp b/src/tangara/ui/lvgl_task.hpp
index 8efcbf35..dc611d75 100644
--- a/src/tangara/ui/lvgl_task.hpp
+++ b/src/tangara/ui/lvgl_task.hpp
@@ -15,10 +15,10 @@
#include "freertos/timers.h"
#include "display.hpp"
-#include "lvgl_input_driver.hpp"
-#include "screen.hpp"
-#include "themes.hpp"
+#include "input/lvgl_input_driver.hpp"
#include "touchwheel.hpp"
+#include "ui/screen.hpp"
+#include "ui/themes.hpp"
namespace ui {
diff --git a/src/tangara/ui/modal.cpp b/src/tangara/ui/modal.cpp
index ec541914..4f5a2432 100644
--- a/src/tangara/ui/modal.cpp
+++ b/src/tangara/ui/modal.cpp
@@ -5,7 +5,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "modal.hpp"
+#include "ui/modal.hpp"
#include "misc/lv_color.h"
@@ -14,17 +14,17 @@
#include "core/lv_group.h"
#include "core/lv_obj_pos.h"
-#include "event_queue.hpp"
+#include "database/index.hpp"
+#include "events/event_queue.hpp"
#include "extra/widgets/list/lv_list.h"
#include "extra/widgets/menu/lv_menu.h"
#include "extra/widgets/spinner/lv_spinner.h"
#include "hal/lv_hal_disp.h"
-#include "index.hpp"
#include "misc/lv_area.h"
-#include "screen.hpp"
-#include "themes.hpp"
-#include "ui_events.hpp"
-#include "ui_fsm.hpp"
+#include "ui/screen.hpp"
+#include "ui/themes.hpp"
+#include "ui/ui_events.hpp"
+#include "ui/ui_fsm.hpp"
#include "widgets/lv_label.h"
namespace ui {
diff --git a/src/tangara/ui/modal.hpp b/src/tangara/ui/modal.hpp
index 6b7e792e..bd5209a7 100644
--- a/src/tangara/ui/modal.hpp
+++ b/src/tangara/ui/modal.hpp
@@ -13,7 +13,7 @@
#include "core/lv_obj_tree.h"
#include "lvgl.h"
-#include "screen.hpp"
+#include "ui/screen.hpp"
namespace ui {
diff --git a/src/tangara/ui/screen.cpp b/src/tangara/ui/screen.cpp
index a39aaf7e..8357cfbd 100644
--- a/src/tangara/ui/screen.cpp
+++ b/src/tangara/ui/screen.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "screen.hpp"
+#include "ui/screen.hpp"
#include <memory>
diff --git a/src/tangara/ui/screen_lua.cpp b/src/tangara/ui/screen_lua.cpp
index 685e43cb..c6cda7ae 100644
--- a/src/tangara/ui/screen_lua.cpp
+++ b/src/tangara/ui/screen_lua.cpp
@@ -4,15 +4,15 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "screen_lua.hpp"
+#include "ui/screen_lua.hpp"
#include "core/lv_obj_tree.h"
#include "lua.h"
#include "lua.hpp"
-#include "property.hpp"
-#include "themes.hpp"
+#include "lua/property.hpp"
+#include "ui/themes.hpp"
-#include "lua_thread.hpp"
+#include "lua/lua_thread.hpp"
#include "luavgl.h"
namespace ui {
diff --git a/src/tangara/ui/screen_lua.hpp b/src/tangara/ui/screen_lua.hpp
index 8a463bad..d6bc20a2 100644
--- a/src/tangara/ui/screen_lua.hpp
+++ b/src/tangara/ui/screen_lua.hpp
@@ -8,8 +8,8 @@
#include "lua.hpp"
-#include "property.hpp"
-#include "screen.hpp"
+#include "lua/property.hpp"
+#include "ui/screen.hpp"
namespace ui {
namespace screens {
diff --git a/src/tangara/ui/screen_splash.cpp b/src/tangara/ui/screen_splash.cpp
index 48cfef88..651f00dd 100644
--- a/src/tangara/ui/screen_splash.cpp
+++ b/src/tangara/ui/screen_splash.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "screen_splash.hpp"
+#include "ui/screen_splash.hpp"
#include "core/lv_obj.h"
#include "core/lv_obj_style.h"
diff --git a/src/tangara/ui/screen_splash.hpp b/src/tangara/ui/screen_splash.hpp
index 6e746345..e56c915f 100644
--- a/src/tangara/ui/screen_splash.hpp
+++ b/src/tangara/ui/screen_splash.hpp
@@ -10,7 +10,7 @@
#include "lvgl.h"
-#include "screen.hpp"
+#include "ui/screen.hpp"
namespace ui {
namespace screens {
diff --git a/src/tangara/ui/themes.cpp b/src/tangara/ui/themes.cpp
index b13f226a..44638c55 100644
--- a/src/tangara/ui/themes.cpp
+++ b/src/tangara/ui/themes.cpp
@@ -1,4 +1,4 @@
-#include "themes.hpp"
+#include "ui/themes.hpp"
#include "core/lv_obj.h"
#include "core/lv_obj_style.h"
#include "core/lv_obj_tree.h"
@@ -35,9 +35,9 @@ void Theme::Apply(void) {
void Theme::Callback(lv_obj_t* obj) {
// Find and apply base styles
if (auto search = style_map.find("base"); search != style_map.end()) {
- for (const auto& pair : search->second) {
- lv_obj_add_style(obj, pair.second, pair.first);
- }
+ for (const auto& pair : search->second) {
+ lv_obj_add_style(obj, pair.second, pair.first);
+ }
}
// Determine class name
@@ -60,19 +60,18 @@ void Theme::Callback(lv_obj_t* obj) {
// Apply all styles from class
if (auto search = style_map.find(class_name); search != style_map.end()) {
- for (const auto& pair : search->second) {
- lv_obj_add_style(obj, pair.second, pair.first);
- }
+ for (const auto& pair : search->second) {
+ lv_obj_add_style(obj, pair.second, pair.first);
+ }
}
-
}
void Theme::ApplyStyle(lv_obj_t* obj, std::string style_key) {
if (auto search = style_map.find(style_key); search != style_map.end()) {
- for (const auto& pair : search->second) {
- lv_obj_remove_style(obj, pair.second, pair.first);
- lv_obj_add_style(obj, pair.second, pair.first);
- }
+ for (const auto& pair : search->second) {
+ lv_obj_remove_style(obj, pair.second, pair.first);
+ lv_obj_add_style(obj, pair.second, pair.first);
+ }
}
}
@@ -85,7 +84,7 @@ void Theme::AddStyle(std::string key, int selector, lv_style_t* style) {
style_map.try_emplace(key, std::vector<std::pair<int, lv_style_t*>>{});
if (auto search = style_map.find(key); search != style_map.end()) {
// Key exists
- auto &vec = search->second;
+ auto& vec = search->second;
// Add it to the list
vec.push_back(std::make_pair(selector, style));
}
diff --git a/src/tangara/ui/themes.hpp b/src/tangara/ui/themes.hpp
index 09b9cdce..fd576478 100644
--- a/src/tangara/ui/themes.hpp
+++ b/src/tangara/ui/themes.hpp
@@ -1,7 +1,7 @@
#pragma once
-#include <string>
#include <map>
+#include <string>
#include <vector>
#include "lvgl.h"
@@ -32,7 +32,6 @@ class Theme {
Theme();
std::map<std::string, std::vector<std::pair<int, lv_style_t*>>> style_map;
lv_theme_t theme_;
-
};
} // namespace themes
} // namespace ui
diff --git a/src/tangara/ui/ui_events.hpp b/src/tangara/ui/ui_events.hpp
index 3d794edc..613b9629 100644
--- a/src/tangara/ui/ui_events.hpp
+++ b/src/tangara/ui/ui_events.hpp
@@ -7,12 +7,12 @@
#pragma once
#include <memory>
-#include "database.hpp"
+#include "database/database.hpp"
+#include "database/index.hpp"
#include "gpios.hpp"
-#include "index.hpp"
#include "nvs.hpp"
-#include "screen.hpp"
#include "tinyfsm.hpp"
+#include "ui/screen.hpp"
namespace ui {
diff --git a/src/tangara/ui/ui_fsm.cpp b/src/tangara/ui/ui_fsm.cpp
index 1cbf1be4..614d5216 100644
--- a/src/tangara/ui/ui_fsm.cpp
+++ b/src/tangara/ui/ui_fsm.cpp
@@ -4,61 +4,61 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "ui_fsm.hpp"
+#include "ui/ui_fsm.hpp"
#include <memory>
#include <memory_resource>
#include <variant>
#include "bluetooth_types.hpp"
-#include "db_events.hpp"
-#include "device_factory.hpp"
+#include "database/db_events.hpp"
#include "display_init.hpp"
#include "esp_spp_api.h"
-#include "feedback_haptics.hpp"
#include "freertos/portmacro.h"
#include "freertos/projdefs.h"
-#include "input_device.hpp"
-#include "input_touch_wheel.hpp"
-#include "input_volume_buttons.hpp"
+#include "input/device_factory.hpp"
+#include "input/feedback_haptics.hpp"
+#include "input/input_device.hpp"
+#include "input/input_touch_wheel.hpp"
+#include "input/input_volume_buttons.hpp"
#include "lua.h"
#include "lua.hpp"
-#include "audio_fsm.hpp"
-#include "battery.hpp"
+#include "audio/audio_fsm.hpp"
+#include "battery/battery.hpp"
#include "core/lv_group.h"
#include "core/lv_obj.h"
#include "core/lv_obj_tree.h"
-#include "database.hpp"
+#include "database/database.hpp"
#include "esp_heap_caps.h"
#include "esp_timer.h"
#include "haptics.hpp"
+#include "input/lvgl_input_driver.hpp"
#include "lauxlib.h"
-#include "lua_thread.hpp"
+#include "lua/lua_thread.hpp"
#include "luavgl.h"
-#include "lvgl_input_driver.hpp"
#include "memory_resource.hpp"
#include "misc/lv_gc.h"
-#include "audio_events.hpp"
+#include "audio/audio_events.hpp"
+#include "audio/track_queue.hpp"
#include "display.hpp"
-#include "event_queue.hpp"
+#include "events/event_queue.hpp"
#include "gpios.hpp"
-#include "lua_registry.hpp"
-#include "lvgl_task.hpp"
+#include "lua/lua_registry.hpp"
+#include "lua/property.hpp"
#include "nvs.hpp"
-#include "property.hpp"
#include "samd.hpp"
-#include "screen.hpp"
-#include "screen_lua.hpp"
-#include "screen_splash.hpp"
#include "spiffs.hpp"
#include "storage.hpp"
-#include "system_events.hpp"
+#include "system_fsm/system_events.hpp"
#include "tinyfsm.hpp"
#include "touchwheel.hpp"
-#include "track_queue.hpp"
-#include "ui_events.hpp"
+#include "ui/lvgl_task.hpp"
+#include "ui/screen.hpp"
+#include "ui/screen_lua.hpp"
+#include "ui/screen_splash.hpp"
+#include "ui/ui_events.hpp"
#include "widgets/lv_label.h"
namespace ui {
@@ -266,8 +266,8 @@ lua::Property UiState::sUsbMassStorageEnabled{
lua::Property UiState::sUsbMassStorageBusy{false};
-auto UiState::InitBootSplash(drivers::IGpios& gpios, drivers::NvsStorage& nvs)
- -> bool {
+auto UiState::InitBootSplash(drivers::IGpios& gpios,
+ drivers::NvsStorage& nvs) -> bool {
events::Ui().Dispatch(internal::InitDisplay{
.gpios = gpios,
.nvs = nvs,
diff --git a/src/tangara/ui/ui_fsm.hpp b/src/tangara/ui/ui_fsm.hpp
index 325aea8f..e4f21ce0 100644
--- a/src/tangara/ui/ui_fsm.hpp
+++ b/src/tangara/ui/ui_fsm.hpp
@@ -10,30 +10,30 @@
#include <memory>
#include <stack>
-#include "audio_events.hpp"
-#include "battery.hpp"
-#include "db_events.hpp"
-#include "device_factory.hpp"
+#include "audio/audio_events.hpp"
+#include "audio/track_queue.hpp"
+#include "battery/battery.hpp"
+#include "database/db_events.hpp"
+#include "database/track.hpp"
#include "display.hpp"
-#include "feedback_haptics.hpp"
#include "gpios.hpp"
-#include "input_touch_wheel.hpp"
-#include "input_volume_buttons.hpp"
-#include "lua_thread.hpp"
-#include "lvgl_input_driver.hpp"
-#include "lvgl_task.hpp"
-#include "modal.hpp"
+#include "input/device_factory.hpp"
+#include "input/feedback_haptics.hpp"
+#include "input/input_touch_wheel.hpp"
+#include "input/input_volume_buttons.hpp"
+#include "input/lvgl_input_driver.hpp"
+#include "lua/lua_thread.hpp"
+#include "lua/property.hpp"
#include "nvs.hpp"
-#include "property.hpp"
-#include "screen.hpp"
-#include "service_locator.hpp"
#include "storage.hpp"
-#include "system_events.hpp"
+#include "system_fsm/service_locator.hpp"
+#include "system_fsm/system_events.hpp"
#include "tinyfsm.hpp"
#include "touchwheel.hpp"
-#include "track.hpp"
-#include "track_queue.hpp"
-#include "ui_events.hpp"
+#include "ui/lvgl_task.hpp"
+#include "ui/modal.hpp"
+#include "ui/screen.hpp"
+#include "ui/ui_events.hpp"
namespace ui {
@@ -74,7 +74,7 @@ class UiState : public tinyfsm::Fsm<UiState> {
void react(const internal::DismissAlerts&);
void react(const database::event::UpdateStarted&);
- void react(const database::event::UpdateProgress&){};
+ void react(const database::event::UpdateProgress&) {};
void react(const database::event::UpdateFinished&);
void react(const system_fsm::BluetoothEvent&);
@@ -86,7 +86,7 @@ class UiState : public tinyfsm::Fsm<UiState> {
sCurrentModal.reset();
}
- void react(const internal::ReindexDatabase&){};
+ void react(const internal::ReindexDatabase&) {};
protected:
void PushScreen(std::shared_ptr<Screen>);