diff --git a/lib/lvgl/env_support/cmake/esp.cmake b/lib/lvgl/env_support/cmake/esp.cmake index 443fb514..4b4b91da 100644 --- a/lib/lvgl/env_support/cmake/esp.cmake +++ b/lib/lvgl/env_support/cmake/esp.cmake @@ -27,7 +27,6 @@ else() ${LVGL_ROOT_DIR} ${LVGL_ROOT_DIR}/src ${LVGL_ROOT_DIR}/../ - $ENV{PROJ_PATH}/src/ui/include/ REQUIRES esp_timer) target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_CONF_INCLUDE_SIMPLE") diff --git a/lib/lvgl/lv_conf.h b/lib/lvgl/lv_conf.h index fdaeb390..9617d253 100644 --- a/lib/lvgl/lv_conf.h +++ b/lib/lvgl/lv_conf.h @@ -87,7 +87,8 @@ *It removes the need to manually update the tick with `lv_tick_inc()`)*/ #define LV_TICK_CUSTOM 1 #if LV_TICK_CUSTOM - #define LV_TICK_CUSTOM_INCLUDE "ui_tick.hpp" /*Header for the system time function*/ + #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h" + #define LV_TICK_CUSTOM_SYS_TIME_EXPR (esp_timer_get_time() / 1000) #endif /*LV_TICK_CUSTOM*/ /*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. diff --git a/src/app_console/CMakeLists.txt b/src/app_console/CMakeLists.txt deleted file mode 100644 index 1a2ae8d6..00000000 --- a/src/app_console/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2023 jacqueline -# -# SPDX-License-Identifier: GPL-3.0-only - -idf_component_register( - SRCS "app_console.cpp" - INCLUDE_DIRS "include" - REQUIRES "dev_console" "events" "database") -target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS}) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt deleted file mode 100644 index 635320f4..00000000 --- a/src/audio/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2023 jacqueline -# -# SPDX-License-Identifier: GPL-3.0-only - -idf_component_register( - SRCS "audio_decoder.cpp" "fatfs_audio_input.cpp" "i2s_audio_output.cpp" - "track_queue.cpp" "audio_fsm.cpp" "audio_converter.cpp" "resample.cpp" - "fatfs_source.cpp" "bt_audio_output.cpp" "readahead_source.cpp" - "audio_source.cpp" - INCLUDE_DIRS "include" - REQUIRES "codecs" "drivers" "cbor" "result" "tasks" "memory" "tinyfsm" - "database" "system_fsm" "speexdsp" "millershuffle" "libcppbor") - -target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS}) diff --git a/src/battery/CMakeLists.txt b/src/battery/CMakeLists.txt deleted file mode 100644 index 313a3731..00000000 --- a/src/battery/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright 2023 jacqueline -# -# SPDX-License-Identifier: GPL-3.0-only - -idf_component_register( - SRCS "battery.cpp" - INCLUDE_DIRS "include" - REQUIRES "drivers" "events") - -target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS}) diff --git a/src/codecs/codec.cpp b/src/codecs/codec.cpp index a51c40d6..c8e1a72c 100644 --- a/src/codecs/codec.cpp +++ b/src/codecs/codec.cpp @@ -9,8 +9,8 @@ #include #include -#include "mad.hpp" #include "dr_flac.hpp" +#include "mad.hpp" #include "opus.hpp" #include "types.hpp" #include "vorbis.hpp" diff --git a/src/codecs/source_buffer.cpp b/src/codecs/source_buffer.cpp index 538d7f47..9cd648cd 100644 --- a/src/codecs/source_buffer.cpp +++ b/src/codecs/source_buffer.cpp @@ -62,8 +62,8 @@ auto SourceBuffer::AddBytes(std::function)> writer) auto SourceBuffer::ConsumeBytes( std::function)> reader) -> void { - size_t bytes_consumed = std::invoke( - reader, buffer_.subspan(offset_of_bytes_, bytes_in_buffer_)); + size_t bytes_consumed = + std::invoke(reader, buffer_.subspan(offset_of_bytes_, bytes_in_buffer_)); assert(bytes_consumed <= bytes_in_buffer_); bytes_in_buffer_ -= bytes_consumed; diff --git a/src/database/CMakeLists.txt b/src/database/CMakeLists.txt deleted file mode 100644 index 248ca3d7..00000000 --- a/src/database/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2023 jacqueline -# -# SPDX-License-Identifier: GPL-3.0-only - -idf_component_register( - SRCS "env_esp.cpp" "database.cpp" "track.cpp" "records.cpp" - "file_gatherer.cpp" "tag_parser.cpp" "index.cpp" - INCLUDE_DIRS "include" - REQUIRES "result" "esp_psram" "fatfs" "libtags" "komihash" "cbor" - "tasks" "memory" "util" "tinyfsm" "events" "opusfile" "libcppbor") - -target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS}) - -set(LEVELDB_BUILD_TESTS OFF) -set(LEVELDB_BUILD_BENCHMARKS OFF) -set(LEVELDB_INSTALL OFF) - -set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) - -add_subdirectory($ENV{PROJ_PATH}/lib/leveldb ${CMAKE_CURRENT_BINARY_DIR}/leveldb) - -target_link_libraries(${COMPONENT_LIB} PUBLIC leveldb) diff --git a/src/dev_console/CMakeLists.txt b/src/dev_console/CMakeLists.txt deleted file mode 100644 index 5555bf61..00000000 --- a/src/dev_console/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2023 jacqueline -# -# SPDX-License-Identifier: GPL-3.0-only - -idf_component_register( - SRCS "console.cpp" - INCLUDE_DIRS "include" - REQUIRES "console" "memory") -target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS}) diff --git a/src/drivers/CMakeLists.txt b/src/drivers/CMakeLists.txt index c2018d3f..91534edb 100644 --- a/src/drivers/CMakeLists.txt +++ b/src/drivers/CMakeLists.txt @@ -7,6 +7,6 @@ idf_component_register( "i2c.cpp" "bluetooth.cpp" "spi.cpp" "display.cpp" "display_init.cpp" "samd.cpp" "wm8523.cpp" "nvs.cpp" "haptics.cpp" "spiffs.cpp" INCLUDE_DIRS "include" - REQUIRES "esp_adc" "fatfs" "result" "lvgl" "tasks" "nvs_flash" "spiffs" - "bt" "tinyfsm" "util") + REQUIRES "esp_adc" "fatfs" "result" "lvgl" "nvs_flash" "spiffs" "bt" + "tasks" "tinyfsm" "util" "libcppbor") target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS}) diff --git a/src/drivers/adc.cpp b/src/drivers/adc.cpp index 3379a1ae..3038f7f6 100644 --- a/src/drivers/adc.cpp +++ b/src/drivers/adc.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "adc.hpp" +#include "drivers/adc.hpp" #include #include "esp_adc/adc_cali.h" diff --git a/src/drivers/bluetooth.cpp b/src/drivers/bluetooth.cpp index 5d1b35fa..4caffae7 100644 --- a/src/drivers/bluetooth.cpp +++ b/src/drivers/bluetooth.cpp @@ -1,4 +1,4 @@ -#include "bluetooth.hpp" +#include "drivers/bluetooth.hpp" #include @@ -25,12 +25,11 @@ #include "freertos/portmacro.h" #include "freertos/projdefs.h" #include "freertos/timers.h" -#include "sample.hpp" #include "tinyfsm/include/tinyfsm.hpp" -#include "bluetooth_types.hpp" +#include "drivers/bluetooth_types.hpp" +#include "drivers/nvs.hpp" #include "memory_resource.hpp" -#include "nvs.hpp" #include "tasks.hpp" namespace drivers { @@ -48,8 +47,8 @@ auto gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t* param) -> void { bluetooth::events::internal::Gap{.type = event, .param = param}); } -auto avrcp_cb(esp_avrc_ct_cb_event_t event, esp_avrc_ct_cb_param_t* param) - -> void { +auto avrcp_cb(esp_avrc_ct_cb_event_t event, + esp_avrc_ct_cb_param_t* param) -> void { esp_avrc_ct_cb_param_t copy = *param; sBgWorker->Dispatch([=]() { auto lock = bluetooth::BluetoothState::lock(); diff --git a/src/drivers/display.cpp b/src/drivers/display.cpp index 5c686811..b0a97b30 100644 --- a/src/drivers/display.cpp +++ b/src/drivers/display.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "display.hpp" +#include "drivers/display.hpp" #include #include @@ -31,11 +31,11 @@ #include "hal/spi_types.h" #include "lvgl/lvgl.h" -#include "display_init.hpp" -#include "gpios.hpp" +#include "drivers/display_init.hpp" +#include "drivers/gpios.hpp" +#include "drivers/spi.hpp" #include "misc/lv_color.h" #include "soc/soc.h" -#include "spi.hpp" #include "tasks.hpp" [[maybe_unused]] static const char* kTag = "DISPLAY"; diff --git a/src/drivers/display_init.cpp b/src/drivers/display_init.cpp index a69826fa..edd36a8d 100644 --- a/src/drivers/display_init.cpp +++ b/src/drivers/display_init.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "display_init.hpp" +#include "drivers/display_init.hpp" namespace drivers { namespace displays { diff --git a/src/drivers/gpios.cpp b/src/drivers/gpios.cpp index aab932a7..64ba26a7 100644 --- a/src/drivers/gpios.cpp +++ b/src/drivers/gpios.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "gpios.hpp" +#include "drivers/gpios.hpp" #include @@ -15,7 +15,7 @@ #include "esp_intr_alloc.h" #include "hal/gpio_types.h" -#include "i2c.hpp" +#include "drivers/i2c.hpp" namespace drivers { diff --git a/src/drivers/haptics.cpp b/src/drivers/haptics.cpp index f7b18086..55fa9ad8 100644 --- a/src/drivers/haptics.cpp +++ b/src/drivers/haptics.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "haptics.hpp" +#include "drivers/haptics.hpp" #include #include @@ -21,7 +21,7 @@ #include "hal/gpio_types.h" #include "hal/i2c_types.h" -#include "i2c.hpp" +#include "drivers/i2c.hpp" namespace drivers { @@ -54,7 +54,8 @@ Haptics::Haptics(const std::variant& motor) { // Set library // TODO(robin): try the other libraries and test response. C is marginal, D // too much? - WriteRegister(Register::kWaveformLibrary, static_cast(kDefaultErmLibrary)); + WriteRegister(Register::kWaveformLibrary, + static_cast(kDefaultErmLibrary)); } else if (std::holds_alternative(motor)) { ESP_LOGI(kTag, "Setting up LRA motor..."); @@ -75,7 +76,8 @@ Haptics::Haptics(const std::variant& motor) { ControlMask::kLraOpenLoop); // Set library; only option is the LRA one for, well, LRA motors. - WriteRegister(Register::kWaveformLibrary, static_cast(Library::LRA)); + WriteRegister(Register::kWaveformLibrary, + static_cast(Library::LRA)); } // Set mode (internal trigger, on writing 1 to Go register) @@ -123,7 +125,6 @@ auto Haptics::SetWaveformEffect(Effect effect) -> void { current_effect_ = effect; } - auto Haptics::TourEffects() -> void { TourEffects(Effect::kFirst, Effect::kLast, kDefaultErmLibrary); } @@ -174,7 +175,6 @@ auto Haptics::TourLibraries(Effect from, Effect to) -> void { } } - auto Haptics::PowerDown() -> void { WriteRegister(Register::kMode, static_cast(Mode::kInternalTrigger) | ModeMask::kStandby); diff --git a/src/drivers/i2c.cpp b/src/drivers/i2c.cpp index 7d25717a..793ce9f9 100644 --- a/src/drivers/i2c.cpp +++ b/src/drivers/i2c.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "i2c.hpp" +#include "drivers/i2c.hpp" #include diff --git a/src/drivers/i2s_dac.cpp b/src/drivers/i2s_dac.cpp index 7fe5547d..a271fce0 100644 --- a/src/drivers/i2s_dac.cpp +++ b/src/drivers/i2s_dac.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "i2s_dac.hpp" +#include "drivers/i2s_dac.hpp" #include #include @@ -25,11 +25,11 @@ #include "hal/gpio_types.h" #include "hal/i2c_types.h" -#include "gpios.hpp" +#include "drivers/gpios.hpp" +#include "drivers/i2c.hpp" +#include "drivers/wm8523.hpp" #include "hal/i2s_types.h" -#include "i2c.hpp" #include "soc/clk_tree_defs.h" -#include "wm8523.hpp" namespace drivers { @@ -142,8 +142,9 @@ auto I2SDac::SetPaused(bool paused) -> void { static volatile bool sSwapWords = false; -auto I2SDac::Reconfigure(Channels ch, BitsPerSample bps, SampleRate rate) - -> void { +auto I2SDac::Reconfigure(Channels ch, + BitsPerSample bps, + SampleRate rate) -> void { std::lock_guard lock(configure_mutex_); if (i2s_active_) { diff --git a/src/drivers/include/a2dp_audio_output.hpp b/src/drivers/include/drivers/a2dp_audio_output.hpp similarity index 100% rename from src/drivers/include/a2dp_audio_output.hpp rename to src/drivers/include/drivers/a2dp_audio_output.hpp diff --git a/src/drivers/include/adc.hpp b/src/drivers/include/drivers/adc.hpp similarity index 100% rename from src/drivers/include/adc.hpp rename to src/drivers/include/drivers/adc.hpp diff --git a/src/drivers/include/bluetooth.hpp b/src/drivers/include/drivers/bluetooth.hpp similarity index 98% rename from src/drivers/include/bluetooth.hpp rename to src/drivers/include/drivers/bluetooth.hpp index 8da5ce2e..5960de7e 100644 --- a/src/drivers/include/bluetooth.hpp +++ b/src/drivers/include/drivers/bluetooth.hpp @@ -12,11 +12,11 @@ #include #include #include -#include "bluetooth_types.hpp" +#include "drivers/bluetooth_types.hpp" #include "esp_a2dp_api.h" #include "esp_avrc_api.h" #include "esp_gap_bt_api.h" -#include "nvs.hpp" +#include "drivers/nvs.hpp" #include "tasks.hpp" #include "tinyfsm.hpp" #include "tinyfsm/include/tinyfsm.hpp" diff --git a/src/drivers/include/bluetooth_types.hpp b/src/drivers/include/drivers/bluetooth_types.hpp similarity index 100% rename from src/drivers/include/bluetooth_types.hpp rename to src/drivers/include/drivers/bluetooth_types.hpp diff --git a/src/drivers/include/display.hpp b/src/drivers/include/drivers/display.hpp similarity index 96% rename from src/drivers/include/display.hpp rename to src/drivers/include/drivers/display.hpp index d2e18a5c..6dc78e01 100644 --- a/src/drivers/include/display.hpp +++ b/src/drivers/include/drivers/display.hpp @@ -15,8 +15,8 @@ #include "result.hpp" #include "tasks.hpp" -#include "display_init.hpp" -#include "gpios.hpp" +#include "drivers/display_init.hpp" +#include "drivers/gpios.hpp" namespace drivers { diff --git a/src/drivers/include/display_init.hpp b/src/drivers/include/drivers/display_init.hpp similarity index 100% rename from src/drivers/include/display_init.hpp rename to src/drivers/include/drivers/display_init.hpp diff --git a/src/drivers/include/fatfs_audio_input.hpp b/src/drivers/include/drivers/fatfs_audio_input.hpp similarity index 100% rename from src/drivers/include/fatfs_audio_input.hpp rename to src/drivers/include/drivers/fatfs_audio_input.hpp diff --git a/src/drivers/include/gpios.hpp b/src/drivers/include/drivers/gpios.hpp similarity index 100% rename from src/drivers/include/gpios.hpp rename to src/drivers/include/drivers/gpios.hpp diff --git a/src/drivers/include/haptics.hpp b/src/drivers/include/drivers/haptics.hpp similarity index 100% rename from src/drivers/include/haptics.hpp rename to src/drivers/include/drivers/haptics.hpp diff --git a/src/drivers/include/i2c.hpp b/src/drivers/include/drivers/i2c.hpp similarity index 100% rename from src/drivers/include/i2c.hpp rename to src/drivers/include/drivers/i2c.hpp diff --git a/src/drivers/include/i2s_dac.hpp b/src/drivers/include/drivers/i2s_dac.hpp similarity index 98% rename from src/drivers/include/i2s_dac.hpp rename to src/drivers/include/drivers/i2s_dac.hpp index 569f0a9a..5e81f875 100644 --- a/src/drivers/include/i2s_dac.hpp +++ b/src/drivers/include/drivers/i2s_dac.hpp @@ -22,7 +22,7 @@ #include "freertos/stream_buffer.h" #include "result.hpp" -#include "gpios.hpp" +#include "drivers/gpios.hpp" #include "sys/_stdint.h" namespace drivers { diff --git a/src/drivers/include/nvs.hpp b/src/drivers/include/drivers/nvs.hpp similarity index 98% rename from src/drivers/include/nvs.hpp rename to src/drivers/include/drivers/nvs.hpp index 7c74ceb0..83bb8097 100644 --- a/src/drivers/include/nvs.hpp +++ b/src/drivers/include/drivers/nvs.hpp @@ -13,9 +13,8 @@ #include "esp_err.h" #include "nvs.h" -#include "bluetooth_types.hpp" +#include "drivers/bluetooth_types.hpp" #include "lru_cache.hpp" -#include "tasks.hpp" namespace drivers { diff --git a/src/drivers/include/samd.hpp b/src/drivers/include/drivers/samd.hpp similarity index 100% rename from src/drivers/include/samd.hpp rename to src/drivers/include/drivers/samd.hpp diff --git a/src/drivers/include/spi.hpp b/src/drivers/include/drivers/spi.hpp similarity index 100% rename from src/drivers/include/spi.hpp rename to src/drivers/include/drivers/spi.hpp diff --git a/src/drivers/include/spiffs.hpp b/src/drivers/include/drivers/spiffs.hpp similarity index 100% rename from src/drivers/include/spiffs.hpp rename to src/drivers/include/drivers/spiffs.hpp diff --git a/src/drivers/include/storage.hpp b/src/drivers/include/drivers/storage.hpp similarity index 98% rename from src/drivers/include/storage.hpp rename to src/drivers/include/drivers/storage.hpp index 836bbbdc..3aefff2d 100644 --- a/src/drivers/include/storage.hpp +++ b/src/drivers/include/drivers/storage.hpp @@ -15,7 +15,7 @@ #include "ff.h" #include "result.hpp" -#include "gpios.hpp" +#include "drivers/gpios.hpp" namespace drivers { diff --git a/src/drivers/include/touchwheel.hpp b/src/drivers/include/drivers/touchwheel.hpp similarity index 97% rename from src/drivers/include/touchwheel.hpp rename to src/drivers/include/drivers/touchwheel.hpp index 18ace2b4..60902087 100644 --- a/src/drivers/include/touchwheel.hpp +++ b/src/drivers/include/drivers/touchwheel.hpp @@ -12,7 +12,7 @@ #include "esp_err.h" #include "result.hpp" -#include "gpios.hpp" +#include "drivers/gpios.hpp" namespace drivers { diff --git a/src/drivers/include/wm8523.hpp b/src/drivers/include/drivers/wm8523.hpp similarity index 100% rename from src/drivers/include/wm8523.hpp rename to src/drivers/include/drivers/wm8523.hpp diff --git a/src/drivers/nvs.cpp b/src/drivers/nvs.cpp index c8befe48..1389fd0d 100644 --- a/src/drivers/nvs.cpp +++ b/src/drivers/nvs.cpp @@ -4,22 +4,19 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "nvs.hpp" -#include -#include +#include "drivers/nvs.hpp" #include #include -#include "bluetooth.hpp" -#include "bluetooth_types.hpp" #include "cppbor.h" #include "cppbor_parse.h" +#include "drivers/bluetooth.hpp" +#include "drivers/bluetooth_types.hpp" +#include "drivers/wm8523.hpp" #include "esp_log.h" #include "nvs.h" #include "nvs_flash.h" -#include "tasks.hpp" -#include "wm8523.hpp" namespace drivers { @@ -42,8 +39,8 @@ static constexpr char kKeyDisplayRows[] = "disprows"; static constexpr char kKeyHapticMotorType[] = "hapticmtype"; static constexpr char kKeyDbAutoIndex[] = "dbautoindex"; -static auto nvs_get_string(nvs_handle_t nvs, const char* key) - -> std::optional { +static auto nvs_get_string(nvs_handle_t nvs, + const char* key) -> std::optional { size_t len = 0; if (nvs_get_blob(nvs, key, NULL, &len) != ESP_OK) { return {}; @@ -190,8 +187,7 @@ auto NvsStorage::Read() -> void { lock_polarity_.read(handle_); display_cols_.read(handle_); display_rows_.read(handle_); - haptic_motor_type_.read(handle_), - brightness_.read(handle_); + haptic_motor_type_.read(handle_), brightness_.read(handle_); sensitivity_.read(handle_); amp_max_vol_.read(handle_); amp_cur_vol_.read(handle_); @@ -208,8 +204,7 @@ auto NvsStorage::Write() -> bool { lock_polarity_.write(handle_); display_cols_.write(handle_); display_rows_.write(handle_); - haptic_motor_type_.write(handle_), - brightness_.write(handle_); + haptic_motor_type_.write(handle_), brightness_.write(handle_); sensitivity_.write(handle_); amp_max_vol_.write(handle_); amp_cur_vol_.write(handle_); @@ -290,8 +285,8 @@ auto NvsStorage::BluetoothVolume(const bluetooth::mac_addr_t& mac) -> uint8_t { return bt_volumes_.Get(mac).value_or(50); } -auto NvsStorage::BluetoothVolume(const bluetooth::mac_addr_t& mac, uint8_t vol) - -> void { +auto NvsStorage::BluetoothVolume(const bluetooth::mac_addr_t& mac, + uint8_t vol) -> void { std::lock_guard lock{mutex_}; bt_volumes_dirty_ = true; bt_volumes_.Put(mac, vol); diff --git a/src/drivers/samd.cpp b/src/drivers/samd.cpp index e47d9cfe..c5e8c08a 100644 --- a/src/drivers/samd.cpp +++ b/src/drivers/samd.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "samd.hpp" +#include "drivers/samd.hpp" #include #include @@ -15,7 +15,7 @@ #include "hal/gpio_types.h" #include "hal/i2c_types.h" -#include "i2c.hpp" +#include "drivers/i2c.hpp" enum Registers : uint8_t { kSamdFirmwareVersion = 0, diff --git a/src/drivers/spi.cpp b/src/drivers/spi.cpp index ae6f83a2..f4d3ea6e 100644 --- a/src/drivers/spi.cpp +++ b/src/drivers/spi.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "spi.hpp" +#include "drivers/spi.hpp" #include "driver/sdspi_host.h" #include "driver/spi_common.h" diff --git a/src/drivers/spiffs.cpp b/src/drivers/spiffs.cpp index f03d2f68..30a2db33 100644 --- a/src/drivers/spiffs.cpp +++ b/src/drivers/spiffs.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "spiffs.hpp" +#include "drivers/spiffs.hpp" #include "esp_err.h" #include "esp_log.h" diff --git a/src/drivers/storage.cpp b/src/drivers/storage.cpp index b3588130..b2b7174e 100644 --- a/src/drivers/storage.cpp +++ b/src/drivers/storage.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "storage.hpp" +#include "drivers/storage.hpp" #include #include @@ -23,7 +23,7 @@ #include "hal/spi_types.h" #include "sdmmc_cmd.h" -#include "gpios.hpp" +#include "drivers/gpios.hpp" #include "memory_resource.hpp" [[maybe_unused]] static const char* kTag = "SDSTORAGE"; diff --git a/src/drivers/test/test_dac.cpp b/src/drivers/test/test_dac.cpp index e8d8dd94..2269f280 100644 --- a/src/drivers/test/test_dac.cpp +++ b/src/drivers/test/test_dac.cpp @@ -10,8 +10,8 @@ #include "catch2/catch.hpp" -#include "gpios.hpp" -#include "i2c.hpp" +#include "drivers/gpios.hpp" +#include "drivers/i2c.hpp" #include "i2c_fixture.hpp" namespace drivers { diff --git a/src/drivers/test/test_gpio_expander.cpp b/src/drivers/test/test_gpio_expander.cpp index 972bcf09..7c323313 100644 --- a/src/drivers/test/test_gpio_expander.cpp +++ b/src/drivers/test/test_gpio_expander.cpp @@ -4,11 +4,11 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "gpios.hpp" +#include "drivers/gpios.hpp" #include "catch2/catch.hpp" -#include "i2c.hpp" +#include "drivers/i2c.hpp" #include "i2c_fixture.hpp" namespace drivers { diff --git a/src/drivers/test/test_storage.cpp b/src/drivers/test/test_storage.cpp index 062de3af..f97a0a85 100644 --- a/src/drivers/test/test_storage.cpp +++ b/src/drivers/test/test_storage.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "storage.hpp" +#include "drivers/storage.hpp" #include @@ -14,10 +14,10 @@ #include "catch2/catch.hpp" -#include "gpios.hpp" -#include "i2c.hpp" +#include "drivers/gpios.hpp" +#include "drivers/i2c.hpp" +#include "drivers/spi.hpp" #include "i2c_fixture.hpp" -#include "spi.hpp" #include "spi_fixture.hpp" namespace drivers { diff --git a/src/drivers/touchwheel.cpp b/src/drivers/touchwheel.cpp index 41b9a6af..5d55c6f2 100644 --- a/src/drivers/touchwheel.cpp +++ b/src/drivers/touchwheel.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "touchwheel.hpp" +#include "drivers/touchwheel.hpp" #include #include @@ -18,7 +18,7 @@ #include "hal/gpio_types.h" #include "hal/i2c_types.h" -#include "i2c.hpp" +#include "drivers/i2c.hpp" namespace drivers { diff --git a/src/drivers/wm8523.cpp b/src/drivers/wm8523.cpp index 9fe3e001..26316387 100644 --- a/src/drivers/wm8523.cpp +++ b/src/drivers/wm8523.cpp @@ -3,14 +3,14 @@ * * SPDX-License-Identifier: GPL-3.0-only */ -#include "wm8523.hpp" +#include "drivers/wm8523.hpp" #include #include "esp_err.h" +#include "drivers/i2c.hpp" #include "hal/i2c_types.h" -#include "i2c.hpp" namespace drivers { namespace wm8523 { diff --git a/src/events/CMakeLists.txt b/src/events/CMakeLists.txt deleted file mode 100644 index 132c39c7..00000000 --- a/src/events/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2023 jacqueline -# -# SPDX-License-Identifier: GPL-3.0-only - -idf_component_register( - SRCS "event_queue.cpp" - INCLUDE_DIRS "include" - REQUIRES "tinyfsm" "ui") -target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS}) diff --git a/src/graphics/CMakeLists.txt b/src/graphics/CMakeLists.txt new file mode 100644 index 00000000..5b2c5d58 --- /dev/null +++ b/src/graphics/CMakeLists.txt @@ -0,0 +1,7 @@ +# Copyright 2024 jacqueline +# +# SPDX-License-Identifier: GPL-3.0-only + +idf_component_register( + SRCS "font_fusion_10.c" "font_fusion_12.c" "splash.c" + REQUIRES "lvgl") diff --git a/src/ui/font_fusion_10.c b/src/graphics/font_fusion_10.c similarity index 100% rename from src/ui/font_fusion_10.c rename to src/graphics/font_fusion_10.c diff --git a/src/ui/font_fusion_12.c b/src/graphics/font_fusion_12.c similarity index 100% rename from src/ui/font_fusion_12.c rename to src/graphics/font_fusion_12.c diff --git a/src/ui/splash.c b/src/graphics/splash.c similarity index 100% rename from src/ui/splash.c rename to src/graphics/splash.c diff --git a/src/input/CMakeLists.txt b/src/input/CMakeLists.txt deleted file mode 100644 index 4754ba47..00000000 --- a/src/input/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2023 jacqueline -# -# SPDX-License-Identifier: GPL-3.0-only - -idf_component_register( - SRCS "input_touch_wheel.cpp" "input_touch_dpad.cpp" "input_trigger.cpp" - "input_volume_buttons.cpp" "lvgl_input_driver.cpp" "feedback_haptics.cpp" - "device_factory.cpp" "input_nav_buttons.cpp" "input_hook.cpp" - "input_hook_actions.cpp" - INCLUDE_DIRS "include" - REQUIRES "drivers" "lvgl" "events" "system_fsm") - -target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS}) diff --git a/src/lua/CMakeLists.txt b/src/lua/CMakeLists.txt deleted file mode 100644 index 0240a50c..00000000 --- a/src/lua/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2023 jacqueline -# -# SPDX-License-Identifier: GPL-3.0-only - -idf_component_register( - SRCS "lua_theme.cpp" "lua_thread.cpp" "bridge.cpp" "property.cpp" "lua_database.cpp" - "lua_queue.cpp" "lua_version.cpp" "lua_theme.cpp" "lua_controls.cpp" "registry.cpp" - "lua_screen.cpp" - INCLUDE_DIRS "include" - REQUIRES "drivers" "lvgl" "tinyfsm" "events" "system_fsm" "database" - "esp_timer" "battery" "esp-idf-lua" "luavgl" "lua-linenoise" "lua-term" - "esp_app_format") -target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS}) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 3ae92ac2..9019c254 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -2,8 +2,5 @@ # # SPDX-License-Identifier: GPL-3.0-only -idf_component_register( - SRCS "main.cpp" - INCLUDE_DIRS "." - REQUIRES "audio" "ui" "system_fsm" "events") +idf_component_register(SRCS "main.cpp" INCLUDE_DIRS "." REQUIRES "tangara") target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS}) diff --git a/src/main/main.cpp b/src/main/main.cpp index cf27b132..8c7565f3 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 "drivers/i2c.hpp" +#include "events/event_queue.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/system_fsm/CMakeLists.txt b/src/system_fsm/CMakeLists.txt deleted file mode 100644 index e98d4653..00000000 --- a/src/system_fsm/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2023 jacqueline -# -# SPDX-License-Identifier: GPL-3.0-only - -idf_component_register( - SRCS "system_fsm.cpp" "running.cpp" "booting.cpp" "idle.cpp" - "service_locator.cpp" - INCLUDE_DIRS "include" - REQUIRES "tinyfsm" "drivers" "database" "ui" "result" "events" "audio" - "app_console" "battery" "locale") -target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS}) diff --git a/src/tangara/CMakeLists.txt b/src/tangara/CMakeLists.txt new file mode 100644 index 00000000..fb8d1041 --- /dev/null +++ b/src/tangara/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright 2024 jacqueline +# +# SPDX-License-Identifier: GPL-3.0-only + +idf_component_register( + SRC_DIRS "app_console" "audio" "battery" "database" "dev_console" "events" + "input" "lua" "system_fsm" "ui" + INCLUDE_DIRS "." + REQUIRES "codecs" "drivers" "locale" "memory" "tasks" "util" "graphics" + "tinyfsm" "lvgl" "esp_timer" "luavgl" "esp_app_format" "libcppbor" "libtags" + "komihash" "result" "esp_psram" "fatfs" "millershuffle" "speexdsp" "console" + "esp-idf-lua" "lua-linenoise" "lua-term") +target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS}) + +set(LEVELDB_BUILD_TESTS OFF) +set(LEVELDB_BUILD_BENCHMARKS OFF) +set(LEVELDB_INSTALL OFF) + +set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) + +add_subdirectory($ENV{PROJ_PATH}/lib/leveldb ${CMAKE_CURRENT_BINARY_DIR}/leveldb) +target_link_libraries(${COMPONENT_LIB} PUBLIC leveldb) diff --git a/src/app_console/app_console.cpp b/src/tangara/app_console/app_console.cpp similarity index 97% rename from src/app_console/app_console.cpp rename to src/tangara/app_console/app_console.cpp index 7c7c1abc..e3048ba2 100644 --- a/src/app_console/app_console.cpp +++ b/src/tangara/app_console/app_console.cpp @@ -4,11 +4,9 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "app_console.hpp" +#include "app_console/app_console.hpp" #include -#include -#include #include #include @@ -21,11 +19,7 @@ #include #include "FreeRTOSConfig.h" -#include "audio_events.hpp" -#include "audio_fsm.hpp" -#include "bluetooth.hpp" -#include "bluetooth_types.hpp" -#include "database.hpp" + #include "esp_app_desc.h" #include "esp_console.h" #include "esp_err.h" @@ -34,19 +28,25 @@ #include "esp_intr_alloc.h" #include "esp_log.h" #include "esp_system.h" -#include "event_queue.hpp" #include "ff.h" -#include "freertos/FreeRTOSConfig_arch.h" #include "freertos/projdefs.h" -#include "haptics.hpp" -#include "index.hpp" -#include "lua_registry.hpp" + +#include "drivers/bluetooth.hpp" +#include "drivers/bluetooth_types.hpp" +#include "drivers/haptics.hpp" +#include "drivers/samd.hpp" #include "memory_resource.hpp" -#include "samd.hpp" -#include "service_locator.hpp" -#include "system_events.hpp" -#include "track.hpp" -#include "ui_events.hpp" + +#include "audio/audio_events.hpp" +#include "audio/audio_fsm.hpp" +#include "database/database.hpp" +#include "database/index.hpp" +#include "database/track.hpp" +#include "events/event_queue.hpp" +#include "lua/lua_registry.hpp" +#include "system_fsm/service_locator.hpp" +#include "system_fsm/system_events.hpp" +#include "ui/ui_events.hpp" namespace console { diff --git a/src/app_console/include/app_console.hpp b/src/tangara/app_console/app_console.hpp similarity index 63% rename from src/app_console/include/app_console.hpp rename to src/tangara/app_console/app_console.hpp index 5981cc04..b88b1330 100644 --- a/src/app_console/include/app_console.hpp +++ b/src/tangara/app_console/app_console.hpp @@ -8,12 +8,12 @@ #include -#include "bluetooth.hpp" -#include "console.hpp" -#include "database.hpp" -#include "samd.hpp" -#include "service_locator.hpp" -#include "track_queue.hpp" +#include "audio/track_queue.hpp" +#include "drivers/bluetooth.hpp" +#include "dev_console/console.hpp" +#include "database/database.hpp" +#include "drivers/samd.hpp" +#include "system_fsm/service_locator.hpp" namespace console { diff --git a/src/audio/README.md b/src/tangara/audio/README.md similarity index 100% rename from src/audio/README.md rename to src/tangara/audio/README.md diff --git a/src/audio/audio_converter.cpp b/src/tangara/audio/audio_converter.cpp similarity index 97% rename from src/audio/audio_converter.cpp rename to src/tangara/audio/audio_converter.cpp index d2edb0b3..da8e3916 100644 --- a/src/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 #include #include #include -#include "audio_events.hpp" -#include "audio_sink.hpp" +#include "audio/audio_events.hpp" +#include "audio/audio_sink.hpp" +#include "drivers/i2s_dac.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/audio/include/audio_converter.hpp b/src/tangara/audio/audio_converter.hpp similarity index 92% rename from src/audio/include/audio_converter.hpp rename to src/tangara/audio/audio_converter.hpp index 163c6836..bf5edd43 100644 --- a/src/audio/include/audio_converter.hpp +++ b/src/tangara/audio/audio_converter.hpp @@ -10,11 +10,11 @@ #include #include -#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/audio/audio_decoder.cpp b/src/tangara/audio/audio_decoder.cpp similarity index 90% rename from src/audio/audio_decoder.cpp rename to src/tangara/audio/audio_decoder.cpp index baf17e7a..ae54a11c 100644 --- a/src/audio/audio_decoder.cpp +++ b/src/tangara/audio/audio_decoder.cpp @@ -4,22 +4,19 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "audio_decoder.hpp" - -#include -#include +#include "audio/audio_decoder.hpp" #include #include #include #include +#include #include #include #include #include #include -#include "cbor.h" #include "esp_err.h" #include "esp_heap_caps.h" #include "esp_log.h" @@ -27,21 +24,21 @@ #include "freertos/projdefs.h" #include "freertos/queue.h" #include "freertos/ringbuf.h" -#include "i2s_dac.hpp" -#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 "drivers/i2s_dac.hpp" +#include "events/event_queue.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/audio/include/audio_decoder.hpp b/src/tangara/audio/audio_decoder.hpp similarity index 88% rename from src/audio/include/audio_decoder.hpp rename to src/tangara/audio/audio_decoder.hpp index 8e955f74..dfd6f403 100644 --- a/src/audio/include/audio_decoder.hpp +++ b/src/tangara/audio/audio_decoder.hpp @@ -9,12 +9,12 @@ #include #include -#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/audio/include/audio_events.hpp b/src/tangara/audio/audio_events.hpp similarity index 98% rename from src/audio/include/audio_events.hpp rename to src/tangara/audio/audio_events.hpp index b8a0dba6..b2975cbc 100644 --- a/src/audio/include/audio_events.hpp +++ b/src/tangara/audio/audio_events.hpp @@ -12,10 +12,10 @@ #include #include -#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/audio/audio_fsm.cpp b/src/tangara/audio/audio_fsm.cpp similarity index 96% rename from src/audio/audio_fsm.cpp rename to src/tangara/audio/audio_fsm.cpp index ffb462f8..f504da2e 100644 --- a/src/audio/audio_fsm.cpp +++ b/src/tangara/audio/audio_fsm.cpp @@ -4,41 +4,41 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "audio_fsm.hpp" +#include "audio/audio_fsm.hpp" #include #include #include #include -#include "audio_sink.hpp" -#include "bluetooth_types.hpp" +#include "audio/audio_sink.hpp" #include "cppbor.h" #include "cppbor_parse.h" +#include "drivers/bluetooth_types.hpp" #include "esp_heap_caps.h" #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/portmacro.h" #include "freertos/projdefs.h" -#include "audio_converter.hpp" -#include "audio_decoder.hpp" -#include "audio_events.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 "i2s_dac.hpp" -#include "nvs.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 "database/future_fetcher.hpp" +#include "database/track.hpp" +#include "drivers/bluetooth.hpp" +#include "drivers/i2s_dac.hpp" +#include "drivers/nvs.hpp" +#include "drivers/wm8523.hpp" +#include "events/event_queue.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/audio/include/audio_fsm.hpp b/src/tangara/audio/audio_fsm.hpp similarity index 80% rename from src/audio/include/audio_fsm.hpp rename to src/tangara/audio/audio_fsm.hpp index 60afb321..b3d64719 100644 --- a/src/audio/include/audio_fsm.hpp +++ b/src/tangara/audio/audio_fsm.hpp @@ -11,24 +11,24 @@ #include #include -#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 "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 "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 "drivers/display.hpp" +#include "drivers/gpios.hpp" +#include "drivers/i2s_dac.hpp" +#include "drivers/storage.hpp" +#include "system_fsm/system_events.hpp" namespace audio { @@ -61,7 +61,7 @@ class AudioState : public tinyfsm::Fsm { 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/audio/include/audio_sink.hpp b/src/tangara/audio/audio_sink.hpp similarity index 100% rename from src/audio/include/audio_sink.hpp rename to src/tangara/audio/audio_sink.hpp diff --git a/src/audio/audio_source.cpp b/src/tangara/audio/audio_source.cpp similarity index 87% rename from src/audio/audio_source.cpp rename to src/tangara/audio/audio_source.cpp index ee2f617f..4989c470 100644 --- a/src/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 t, std::unique_ptr 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 { return tags_; diff --git a/src/audio/include/audio_source.hpp b/src/tangara/audio/audio_source.hpp similarity index 94% rename from src/audio/include/audio_source.hpp rename to src/tangara/audio/audio_source.hpp index f6a34300..2433da46 100644 --- a/src/audio/include/audio_source.hpp +++ b/src/tangara/audio/audio_source.hpp @@ -8,7 +8,7 @@ #include #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, std::unique_ptr wrapped, std::string path, - uint32_t offset = 0 - ); + uint32_t offset = 0); auto tags() -> std::shared_ptr; diff --git a/src/audio/bt_audio_output.cpp b/src/tangara/audio/bt_audio_output.cpp similarity index 95% rename from src/audio/bt_audio_output.cpp rename to src/tangara/audio/bt_audio_output.cpp index 229a38bb..637c0c9a 100644 --- a/src/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 #include @@ -18,12 +18,12 @@ #include "freertos/portmacro.h" #include "freertos/projdefs.h" -#include "gpios.hpp" -#include "i2c.hpp" -#include "i2s_dac.hpp" +#include "drivers/gpios.hpp" +#include "drivers/i2c.hpp" +#include "drivers/i2s_dac.hpp" +#include "drivers/wm8523.hpp" #include "result.hpp" #include "tasks.hpp" -#include "wm8523.hpp" [[maybe_unused]] static const char* kTag = "BTOUT"; diff --git a/src/audio/include/bt_audio_output.hpp b/src/tangara/audio/bt_audio_output.hpp similarity index 91% rename from src/audio/include/bt_audio_output.hpp rename to src/tangara/audio/bt_audio_output.hpp index cc3b2462..942715b7 100644 --- a/src/audio/include/bt_audio_output.hpp +++ b/src/tangara/audio/bt_audio_output.hpp @@ -13,10 +13,10 @@ #include "result.hpp" -#include "audio_sink.hpp" -#include "bluetooth.hpp" -#include "gpios.hpp" -#include "i2s_dac.hpp" +#include "audio/audio_sink.hpp" +#include "drivers/bluetooth.hpp" +#include "drivers/gpios.hpp" +#include "drivers/i2s_dac.hpp" #include "tasks.hpp" namespace audio { diff --git a/src/audio/fatfs_audio_input.cpp b/src/tangara/audio/fatfs_audio_input.cpp similarity index 85% rename from src/audio/fatfs_audio_input.cpp rename to src/tangara/audio/fatfs_audio_input.cpp index e5fb3b21..dc9133ed 100644 --- a/src/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 #include @@ -18,24 +18,24 @@ #include #include +#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 "spi.hpp" -#include "tag_parser.hpp" +#include "database/future_fetcher.hpp" +#include "database/tag_parser.hpp" +#include "database/track.hpp" +#include "drivers/spi.hpp" +#include "events/event_queue.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 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 guard{new_stream_mutex_}; if (OpenFile(path, offset)) { has_new_stream_ = true; @@ -103,8 +103,8 @@ auto FatfsAudioInput::NextStream() -> std::shared_ptr { } } -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/audio/include/fatfs_audio_input.hpp b/src/tangara/audio/fatfs_audio_input.hpp similarity index 85% rename from src/audio/include/fatfs_audio_input.hpp rename to src/tangara/audio/fatfs_audio_input.hpp index 10b7433e..deeeb094 100644 --- a/src/audio/include/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) -> 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; diff --git a/src/audio/fatfs_source.cpp b/src/tangara/audio/fatfs_source.cpp similarity index 90% rename from src/audio/fatfs_source.cpp rename to src/tangara/audio/fatfs_source.cpp index dccdd581..fb6a684d 100644 --- a/src/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 #include @@ -12,13 +12,13 @@ #include #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 "drivers/spi.hpp" +#include "system_fsm/system_events.hpp" #include "types.hpp" namespace audio { diff --git a/src/audio/include/fatfs_source.hpp b/src/tangara/audio/fatfs_source.hpp similarity index 96% rename from src/audio/include/fatfs_source.hpp rename to src/tangara/audio/fatfs_source.hpp index ce9b4db8..32650880 100644 --- a/src/audio/include/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/audio/i2s_audio_output.cpp b/src/tangara/audio/i2s_audio_output.cpp similarity index 94% rename from src/audio/i2s_audio_output.cpp rename to src/tangara/audio/i2s_audio_output.cpp index bf1c3e5e..20297193 100644 --- a/src/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 #include @@ -18,12 +18,12 @@ #include "freertos/portmacro.h" #include "freertos/projdefs.h" -#include "audio_sink.hpp" -#include "gpios.hpp" -#include "i2c.hpp" -#include "i2s_dac.hpp" +#include "audio/audio_sink.hpp" +#include "drivers/gpios.hpp" +#include "drivers/i2c.hpp" +#include "drivers/i2s_dac.hpp" +#include "drivers/wm8523.hpp" #include "result.hpp" -#include "wm8523.hpp" [[maybe_unused]] static const char* kTag = "I2SOUT"; @@ -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(drivers::wm8523::kLineLevelReferenceVolume) - 2); + SetVolume(val * 4 + + static_cast(drivers::wm8523::kLineLevelReferenceVolume) - 2); return true; } diff --git a/src/audio/include/i2s_audio_output.hpp b/src/tangara/audio/i2s_audio_output.hpp similarity index 93% rename from src/audio/include/i2s_audio_output.hpp rename to src/tangara/audio/i2s_audio_output.hpp index 7954257a..f0ce2cf8 100644 --- a/src/audio/include/i2s_audio_output.hpp +++ b/src/tangara/audio/i2s_audio_output.hpp @@ -11,9 +11,9 @@ #include #include -#include "audio_sink.hpp" -#include "gpios.hpp" -#include "i2s_dac.hpp" +#include "audio/audio_sink.hpp" +#include "drivers/gpios.hpp" +#include "drivers/i2s_dac.hpp" #include "result.hpp" namespace audio { diff --git a/src/audio/readahead_source.cpp b/src/tangara/audio/readahead_source.cpp similarity index 97% rename from src/audio/readahead_source.cpp rename to src/tangara/audio/readahead_source.cpp index 6276907a..602ec0b1 100644 --- a/src/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 #include @@ -14,10 +14,10 @@ #include "esp_log.h" #include "ff.h" -#include "audio_source.hpp" +#include "audio/audio_source.hpp" #include "codec.hpp" +#include "drivers/spi.hpp" #include "freertos/portmacro.h" -#include "spi.hpp" #include "tasks.hpp" #include "types.hpp" diff --git a/src/audio/include/readahead_source.hpp b/src/tangara/audio/readahead_source.hpp similarity index 97% rename from src/audio/include/readahead_source.hpp rename to src/tangara/audio/readahead_source.hpp index 74a30e1b..bbaf9f75 100644 --- a/src/audio/include/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/audio/resample.cpp b/src/tangara/audio/resample.cpp similarity index 98% rename from src/audio/resample.cpp rename to src/tangara/audio/resample.cpp index 1e20392b..143ce230 100644 --- a/src/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 #include diff --git a/src/audio/include/resample.hpp b/src/tangara/audio/resample.hpp similarity index 100% rename from src/audio/include/resample.hpp rename to src/tangara/audio/resample.hpp diff --git a/src/audio/test/CMakeLists.txt b/src/tangara/audio/test/CMakeLists.txt similarity index 100% rename from src/audio/test/CMakeLists.txt rename to src/tangara/audio/test/CMakeLists.txt diff --git a/src/audio/track_queue.cpp b/src/tangara/audio/track_queue.cpp similarity index 98% rename from src/audio/track_queue.cpp rename to src/tangara/audio/track_queue.cpp index dbe283c4..603b0de1 100644 --- a/src/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 #include @@ -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/audio/include/track_queue.hpp b/src/tangara/audio/track_queue.hpp similarity index 97% rename from src/audio/include/track_queue.hpp rename to src/tangara/audio/track_queue.hpp index 5b7c9448..427d5f75 100644 --- a/src/audio/include/track_queue.hpp +++ b/src/tangara/audio/track_queue.hpp @@ -12,11 +12,11 @@ #include #include -#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/battery/battery.cpp b/src/tangara/battery/battery.cpp similarity index 95% rename from src/battery/battery.cpp rename to src/tangara/battery/battery.cpp index debef9e6..2d2fff56 100644 --- a/src/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 -#include "adc.hpp" -#include "event_queue.hpp" +#include "drivers/adc.hpp" +#include "drivers/samd.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/battery/include/battery.hpp b/src/tangara/battery/battery.hpp similarity index 94% rename from src/battery/include/battery.hpp rename to src/tangara/battery/battery.hpp index 314cd373..80b0f2d2 100644 --- a/src/battery/include/battery.hpp +++ b/src/tangara/battery/battery.hpp @@ -11,8 +11,8 @@ #include "freertos/FreeRTOS.h" #include "freertos/timers.h" -#include "adc.hpp" -#include "samd.hpp" +#include "drivers/adc.hpp" +#include "drivers/samd.hpp" namespace battery { diff --git a/src/database/database.cpp b/src/tangara/database/database.cpp similarity index 98% rename from src/database/database.cpp rename to src/tangara/database/database.cpp index 48fb0c63..4064c3ed 100644 --- a/src/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 #include @@ -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 "drivers/spi.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 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/database/include/database.hpp b/src/tangara/database/database.hpp similarity index 97% rename from src/database/include/database.hpp rename to src/tangara/database/database.hpp index 35b76a13..d2de7c72 100644 --- a/src/database/include/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/database/include/db_events.hpp b/src/tangara/database/db_events.hpp similarity index 100% rename from src/database/include/db_events.hpp rename to src/tangara/database/db_events.hpp diff --git a/src/database/env_esp.cpp b/src/tangara/database/env_esp.cpp similarity index 99% rename from src/database/env_esp.cpp rename to src/tangara/database/env_esp.cpp index f7a5637a..86a30613 100644 --- a/src/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 #include @@ -36,12 +36,12 @@ #include "leveldb/slice.h" #include "leveldb/status.h" -#include "spi.hpp" +#include "drivers/spi.hpp" #include "tasks.hpp" namespace leveldb { -tasks::WorkerPool *sBackgroundThread = nullptr; +tasks::WorkerPool* sBackgroundThread = nullptr; std::string ErrToStr(FRESULT err) { switch (err) { diff --git a/src/database/include/env_esp.hpp b/src/tangara/database/env_esp.hpp similarity index 100% rename from src/database/include/env_esp.hpp rename to src/tangara/database/env_esp.hpp diff --git a/src/database/file_gatherer.cpp b/src/tangara/database/file_gatherer.cpp similarity index 96% rename from src/database/file_gatherer.cpp rename to src/tangara/database/file_gatherer.cpp index b7b7271e..75a1af27 100644 --- a/src/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 #include @@ -13,8 +13,8 @@ #include "ff.h" +#include "drivers/spi.hpp" #include "memory_resource.hpp" -#include "spi.hpp" namespace database { diff --git a/src/database/include/file_gatherer.hpp b/src/tangara/database/file_gatherer.hpp similarity index 58% rename from src/database/include/file_gatherer.hpp rename to src/tangara/database/file_gatherer.hpp index 685bdb2c..38558b9e 100644 --- a/src/database/include/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 cb) - -> void = 0; + std::function cb) -> void = 0; }; class FileGathererImpl : public IFileGatherer { public: - virtual auto FindFiles( - const std::string& root, - std::function cb) - -> void override; + virtual auto FindFiles(const std::string& root, + std::function + cb) -> void override; }; } // namespace database diff --git a/src/database/include/future_fetcher.hpp b/src/tangara/database/future_fetcher.hpp similarity index 97% rename from src/database/include/future_fetcher.hpp rename to src/tangara/database/future_fetcher.hpp index e8ce9729..a27101f1 100644 --- a/src/database/include/future_fetcher.hpp +++ b/src/tangara/database/future_fetcher.hpp @@ -9,7 +9,7 @@ #include #include -#include "database.hpp" +#include "database/database.hpp" namespace database { diff --git a/src/database/index.cpp b/src/tangara/database/index.cpp similarity index 95% rename from src/database/index.cpp rename to src/tangara/database/index.cpp index 328c3b43..93a2b1c2 100644 --- a/src/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 #include @@ -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> { +auto Index(locale::ICollator& c, + const IndexInfo& i, + const Track& t) -> std::vector> { Indexer indexer{c, t, i}; return indexer.index(); } diff --git a/src/database/include/index.hpp b/src/tangara/database/index.hpp similarity index 92% rename from src/database/include/index.hpp rename to src/tangara/database/index.hpp index 45dae464..8f78439b 100644 --- a/src/database/include/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 track; }; -auto Index(locale::ICollator&, const IndexInfo&, const Track&) - -> std::vector>; +auto Index(locale::ICollator&, + const IndexInfo&, + const Track&) -> std::vector>; auto ExpandHeader(const IndexKey::Header&, const std::optional&) -> IndexKey::Header; diff --git a/src/database/records.cpp b/src/tangara/database/records.cpp similarity index 98% rename from src/database/records.cpp rename to src/tangara/database/records.cpp index b086be3b..88ddbd91 100644 --- a/src/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 #include @@ -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/database/include/records.hpp b/src/tangara/database/records.hpp similarity index 97% rename from src/database/include/records.hpp rename to src/tangara/database/records.hpp index 3ca68fea..db18fe2f 100644 --- a/src/database/include/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/database/tag_parser.cpp b/src/tangara/database/tag_parser.cpp similarity index 98% rename from src/database/tag_parser.cpp rename to src/tangara/database/tag_parser.cpp index cbcbdcb5..2df2d90f 100644 --- a/src/database/tag_parser.cpp +++ b/src/tangara/database/tag_parser.cpp @@ -4,16 +4,16 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "tag_parser.hpp" +#include "database/tag_parser.hpp" #include #include #include #include +#include "drivers/spi.hpp" #include "esp_log.h" #include "ff.h" -#include "spi.hpp" #include "tags.h" #include "memory_resource.hpp" diff --git a/src/database/include/tag_parser.hpp b/src/tangara/database/tag_parser.hpp similarity index 97% rename from src/database/include/tag_parser.hpp rename to src/tangara/database/tag_parser.hpp index 966258b5..ccbc0ea9 100644 --- a/src/database/include/tag_parser.hpp +++ b/src/tangara/database/tag_parser.hpp @@ -8,8 +8,8 @@ #include +#include "database/track.hpp" #include "lru_cache.hpp" -#include "track.hpp" namespace database { diff --git a/src/database/test/CMakeLists.txt b/src/tangara/database/test/CMakeLists.txt similarity index 100% rename from src/database/test/CMakeLists.txt rename to src/tangara/database/test/CMakeLists.txt diff --git a/src/database/test/test_database.cpp b/src/tangara/database/test/test_database.cpp similarity index 94% rename from src/database/test/test_database.cpp rename to src/tangara/database/test/test_database.cpp index 6aec9bfb..09e19a43 100644 --- a/src/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 #include @@ -13,14 +13,14 @@ #include #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 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/database/test/test_records.cpp b/src/tangara/database/test/test_records.cpp similarity index 99% rename from src/database/test/test_records.cpp rename to src/tangara/database/test/test_records.cpp index 2f59489c..f8eb980f 100644 --- a/src/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 #include diff --git a/src/database/track.cpp b/src/tangara/database/track.cpp similarity index 99% rename from src/database/track.cpp rename to src/tangara/database/track.cpp index 1b1442a1..5bf8c3e2 100644 --- a/src/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 #include diff --git a/src/database/include/track.hpp b/src/tangara/database/track.hpp similarity index 100% rename from src/database/include/track.hpp rename to src/tangara/database/track.hpp diff --git a/src/dev_console/console.cpp b/src/tangara/dev_console/console.cpp similarity index 98% rename from src/dev_console/console.cpp rename to src/tangara/dev_console/console.cpp index f2b1efea..cee68b49 100644 --- a/src/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 #include diff --git a/src/dev_console/include/console.hpp b/src/tangara/dev_console/console.hpp similarity index 100% rename from src/dev_console/include/console.hpp rename to src/tangara/dev_console/console.hpp diff --git a/src/events/event_queue.cpp b/src/tangara/events/event_queue.cpp similarity index 86% rename from src/events/event_queue.cpp rename to src/tangara/events/event_queue.cpp index d3a62ef6..e4751398 100644 --- a/src/events/event_queue.cpp +++ b/src/tangara/events/event_queue.cpp @@ -4,14 +4,15 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "event_queue.hpp" +#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/events/include/event_queue.hpp b/src/tangara/events/event_queue.hpp similarity index 95% rename from src/events/include/event_queue.hpp rename to src/tangara/events/event_queue.hpp index 78b21d53..aa7f472d 100644 --- a/src/events/include/event_queue.hpp +++ b/src/tangara/events/event_queue.hpp @@ -11,14 +11,14 @@ #include #include -#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/input/device_factory.cpp b/src/tangara/input/device_factory.cpp similarity index 84% rename from src/input/device_factory.cpp rename to src/tangara/input/device_factory.cpp index 65f4d785..8e1c5155 100644 --- a/src/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 -#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/input/include/device_factory.hpp b/src/tangara/input/device_factory.hpp similarity index 82% rename from src/input/include/device_factory.hpp rename to src/tangara/input/device_factory.hpp index dd9c7133..5044d025 100644 --- a/src/input/include/device_factory.hpp +++ b/src/tangara/input/device_factory.hpp @@ -9,11 +9,11 @@ #include #include -#include "feedback_device.hpp" -#include "input_device.hpp" -#include "input_touch_wheel.hpp" -#include "nvs.hpp" -#include "service_locator.hpp" +#include "input/feedback_device.hpp" +#include "input/input_device.hpp" +#include "input/input_touch_wheel.hpp" +#include "drivers/nvs.hpp" +#include "system_fsm/service_locator.hpp" namespace input { diff --git a/src/input/include/feedback_device.hpp b/src/tangara/input/feedback_device.hpp similarity index 100% rename from src/input/include/feedback_device.hpp rename to src/tangara/input/feedback_device.hpp diff --git a/src/input/feedback_haptics.cpp b/src/tangara/input/feedback_haptics.cpp similarity index 90% rename from src/input/feedback_haptics.cpp rename to src/tangara/input/feedback_haptics.cpp index 5e83d0d6..e690eb9f 100644 --- a/src/input/feedback_haptics.cpp +++ b/src/tangara/input/feedback_haptics.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "feedback_haptics.hpp" +#include "input/feedback_haptics.hpp" #include @@ -13,7 +13,7 @@ #include "core/lv_event.h" #include "esp_log.h" -#include "haptics.hpp" +#include "drivers/haptics.hpp" namespace input { diff --git a/src/input/include/feedback_haptics.hpp b/src/tangara/input/feedback_haptics.hpp similarity index 84% rename from src/input/include/feedback_haptics.hpp rename to src/tangara/input/feedback_haptics.hpp index a307a429..bde5f345 100644 --- a/src/input/include/feedback_haptics.hpp +++ b/src/tangara/input/feedback_haptics.hpp @@ -8,8 +8,8 @@ #include -#include "feedback_device.hpp" -#include "haptics.hpp" +#include "drivers/haptics.hpp" +#include "input/feedback_device.hpp" namespace input { diff --git a/src/input/include/input_device.hpp b/src/tangara/input/input_device.hpp similarity index 93% rename from src/input/include/input_device.hpp rename to src/tangara/input/input_device.hpp index d944c3bf..e3d17c6c 100644 --- a/src/input/include/input_device.hpp +++ b/src/tangara/input/input_device.hpp @@ -11,8 +11,8 @@ #include #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/input/input_hook.cpp b/src/tangara/input/input_hook.cpp similarity index 91% rename from src/input/input_hook.cpp rename to src/tangara/input/input_hook.cpp index bf9f3596..6946c07f 100644 --- a/src/input/input_hook.cpp +++ b/src/tangara/input/input_hook.cpp @@ -4,13 +4,15 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "input_hook.hpp" +#include "input/input_hook.hpp" #include #include + #include "hal/lv_hal_indev.h" -#include "input_trigger.hpp" -#include "lua.h" +#include "lua.hpp" + +#include "input/input_trigger.hpp" namespace input { @@ -68,8 +70,8 @@ auto TriggerHooks::update(bool pressed, lv_indev_data_t* d) -> void { } } -auto TriggerHooks::override(Trigger::State s, std::optional cb) - -> void { +auto TriggerHooks::override(Trigger::State s, + std::optional cb) -> void { switch (s) { case Trigger::State::kClick: click_.override(cb); diff --git a/src/input/include/input_hook.hpp b/src/tangara/input/input_hook.hpp similarity index 98% rename from src/input/include/input_hook.hpp rename to src/tangara/input/input_hook.hpp index a8705210..3dc8a2c8 100644 --- a/src/input/include/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/input/input_hook_actions.cpp b/src/tangara/input/input_hook_actions.cpp similarity index 95% rename from src/input/input_hook_actions.cpp rename to src/tangara/input/input_hook_actions.cpp index 26075c4c..bc3760ac 100644 --- a/src/input/input_hook_actions.cpp +++ b/src/tangara/input/input_hook_actions.cpp @@ -4,14 +4,14 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "input_hook_actions.hpp" +#include "input/input_hook_actions.hpp" #include #include "hal/lv_hal_indev.h" -#include "event_queue.hpp" -#include "ui_events.hpp" +#include "events/event_queue.hpp" +#include "ui/ui_events.hpp" namespace input { namespace actions { diff --git a/src/input/include/input_hook_actions.hpp b/src/tangara/input/input_hook_actions.hpp similarity index 94% rename from src/input/include/input_hook_actions.hpp rename to src/tangara/input/input_hook_actions.hpp index 105bd10d..71a560bc 100644 --- a/src/input/include/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/input/input_nav_buttons.cpp b/src/tangara/input/input_nav_buttons.cpp similarity index 84% rename from src/input/input_nav_buttons.cpp rename to src/tangara/input/input_nav_buttons.cpp index 61d80075..ba1f4b74 100644 --- a/src/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 "gpios.hpp" +#include "drivers/gpios.hpp" +#include "events/event_queue.hpp" #include "hal/lv_hal_indev.h" -#include "input_hook_actions.hpp" +#include "input/input_hook_actions.hpp" namespace input { diff --git a/src/input/include/input_nav_buttons.hpp b/src/tangara/input/input_nav_buttons.hpp similarity index 73% rename from src/input/include/input_nav_buttons.hpp rename to src/tangara/input/input_nav_buttons.hpp index 9feeb375..ce2312a0 100644 --- a/src/input/include/input_nav_buttons.hpp +++ b/src/tangara/input/input_nav_buttons.hpp @@ -8,14 +8,14 @@ #include -#include "gpios.hpp" +#include "drivers/gpios.hpp" #include "hal/lv_hal_indev.h" -#include "haptics.hpp" -#include "input_device.hpp" -#include "input_hook.hpp" -#include "input_trigger.hpp" -#include "touchwheel.hpp" +#include "drivers/haptics.hpp" +#include "input/input_device.hpp" +#include "input/input_hook.hpp" +#include "input/input_trigger.hpp" +#include "drivers/touchwheel.hpp" namespace input { diff --git a/src/input/input_touch_dpad.cpp b/src/tangara/input/input_touch_dpad.cpp similarity index 85% rename from src/input/input_touch_dpad.cpp rename to src/tangara/input/input_touch_dpad.cpp index df17d766..9275b510 100644 --- a/src/input/input_touch_dpad.cpp +++ b/src/tangara/input/input_touch_dpad.cpp @@ -4,18 +4,19 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "input_touch_dpad.hpp" +#include "input/input_touch_dpad.hpp" #include #include "hal/lv_hal_indev.h" -#include "event_queue.hpp" -#include "haptics.hpp" -#include "input_device.hpp" -#include "input_hook_actions.hpp" -#include "input_touch_dpad.hpp" -#include "touchwheel.hpp" +#include "drivers/haptics.hpp" +#include "drivers/touchwheel.hpp" + +#include "events/event_queue.hpp" +#include "input/input_device.hpp" +#include "input/input_hook_actions.hpp" +#include "input/input_touch_dpad.hpp" namespace input { diff --git a/src/input/include/input_touch_dpad.hpp b/src/tangara/input/input_touch_dpad.hpp similarity index 79% rename from src/input/include/input_touch_dpad.hpp rename to src/tangara/input/input_touch_dpad.hpp index 0c45b2d9..8fb14832 100644 --- a/src/input/include/input_touch_dpad.hpp +++ b/src/tangara/input/input_touch_dpad.hpp @@ -10,11 +10,11 @@ #include "hal/lv_hal_indev.h" -#include "haptics.hpp" -#include "input_device.hpp" -#include "input_hook.hpp" -#include "input_trigger.hpp" -#include "touchwheel.hpp" +#include "drivers/haptics.hpp" +#include "input/input_device.hpp" +#include "input/input_hook.hpp" +#include "input/input_trigger.hpp" +#include "drivers/touchwheel.hpp" namespace input { diff --git a/src/input/input_touch_wheel.cpp b/src/tangara/input/input_touch_wheel.cpp similarity index 92% rename from src/input/input_touch_wheel.cpp rename to src/tangara/input/input_touch_wheel.cpp index 41fd73bc..2c4a8b03 100644 --- a/src/input/input_touch_wheel.cpp +++ b/src/tangara/input/input_touch_wheel.cpp @@ -4,22 +4,22 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "input_touch_wheel.hpp" +#include "input/input_touch_wheel.hpp" #include #include #include "hal/lv_hal_indev.h" -#include "event_queue.hpp" -#include "haptics.hpp" -#include "input_device.hpp" -#include "input_hook_actions.hpp" -#include "input_trigger.hpp" -#include "nvs.hpp" -#include "property.hpp" -#include "touchwheel.hpp" -#include "ui_events.hpp" +#include "drivers/haptics.hpp" +#include "drivers/nvs.hpp" +#include "drivers/touchwheel.hpp" +#include "events/event_queue.hpp" +#include "input/input_device.hpp" +#include "input/input_hook_actions.hpp" +#include "input/input_trigger.hpp" +#include "lua/property.hpp" +#include "ui/ui_events.hpp" namespace input { diff --git a/src/input/include/input_touch_wheel.hpp b/src/tangara/input/input_touch_wheel.hpp similarity index 81% rename from src/input/include/input_touch_wheel.hpp rename to src/tangara/input/input_touch_wheel.hpp index 764cc68d..d023873a 100644 --- a/src/input/include/input_touch_wheel.hpp +++ b/src/tangara/input/input_touch_wheel.hpp @@ -11,13 +11,13 @@ #include "hal/lv_hal_indev.h" -#include "haptics.hpp" -#include "input_device.hpp" -#include "input_hook.hpp" -#include "input_trigger.hpp" -#include "nvs.hpp" -#include "property.hpp" -#include "touchwheel.hpp" +#include "drivers/haptics.hpp" +#include "input/input_device.hpp" +#include "input/input_hook.hpp" +#include "input/input_trigger.hpp" +#include "lua/property.hpp" +#include "drivers/nvs.hpp" +#include "drivers/touchwheel.hpp" namespace input { diff --git a/src/input/input_trigger.cpp b/src/tangara/input/input_trigger.cpp similarity index 97% rename from src/input/input_trigger.cpp rename to src/tangara/input/input_trigger.cpp index 00d4a32d..11b4dbe9 100644 --- a/src/input/input_trigger.cpp +++ b/src/tangara/input/input_trigger.cpp @@ -4,10 +4,10 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "input_trigger.hpp" -#include +#include "input/input_trigger.hpp" #include + #include "esp_timer.h" namespace input { diff --git a/src/input/include/input_trigger.hpp b/src/tangara/input/input_trigger.hpp similarity index 100% rename from src/input/include/input_trigger.hpp rename to src/tangara/input/input_trigger.hpp diff --git a/src/input/input_volume_buttons.cpp b/src/tangara/input/input_volume_buttons.cpp similarity index 82% rename from src/input/input_volume_buttons.cpp rename to src/tangara/input/input_volume_buttons.cpp index 37cf90e5..3c3fb2a3 100644 --- a/src/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 "gpios.hpp" -#include "input_hook_actions.hpp" +#include "input/input_volume_buttons.hpp" +#include "drivers/gpios.hpp" +#include "events/event_queue.hpp" +#include "input/input_hook_actions.hpp" namespace input { diff --git a/src/input/include/input_volume_buttons.hpp b/src/tangara/input/input_volume_buttons.hpp similarity index 77% rename from src/input/include/input_volume_buttons.hpp rename to src/tangara/input/input_volume_buttons.hpp index e3246df4..22a8acf2 100644 --- a/src/input/include/input_volume_buttons.hpp +++ b/src/tangara/input/input_volume_buttons.hpp @@ -8,13 +8,13 @@ #include -#include "gpios.hpp" +#include "drivers/gpios.hpp" #include "hal/lv_hal_indev.h" -#include "haptics.hpp" -#include "input_device.hpp" -#include "input_hook.hpp" -#include "touchwheel.hpp" +#include "drivers/haptics.hpp" +#include "input/input_device.hpp" +#include "input/input_hook.hpp" +#include "drivers/touchwheel.hpp" namespace input { diff --git a/src/input/lvgl_input_driver.cpp b/src/tangara/input/lvgl_input_driver.cpp similarity index 95% rename from src/input/lvgl_input_driver.cpp rename to src/tangara/input/lvgl_input_driver.cpp index a82b7438..8d10bb13 100644 --- a/src/input/lvgl_input_driver.cpp +++ b/src/tangara/input/lvgl_input_driver.cpp @@ -4,25 +4,25 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "lvgl_input_driver.hpp" -#include +#include "input/lvgl_input_driver.hpp" #include #include #include -#include "device_factory.hpp" -#include "feedback_haptics.hpp" -#include "input_hook.hpp" -#include "input_touch_wheel.hpp" -#include "input_trigger.hpp" -#include "input_volume_buttons.hpp" -#include "lauxlib.h" -#include "lua.h" -#include "lua_thread.hpp" +#include "lua.hpp" #include "lvgl.h" -#include "nvs.hpp" -#include "property.hpp" + +#include "drivers/nvs.hpp" + +#include "input/device_factory.hpp" +#include "input/feedback_haptics.hpp" +#include "input/input_hook.hpp" +#include "input/input_touch_wheel.hpp" +#include "input/input_trigger.hpp" +#include "input/input_volume_buttons.hpp" +#include "lua/lua_thread.hpp" +#include "lua/property.hpp" [[maybe_unused]] static constexpr char kTag[] = "input"; diff --git a/src/input/include/lvgl_input_driver.hpp b/src/tangara/input/lvgl_input_driver.hpp similarity index 90% rename from src/input/include/lvgl_input_driver.hpp rename to src/tangara/input/lvgl_input_driver.hpp index 9adaf143..8ede1855 100644 --- a/src/input/include/lvgl_input_driver.hpp +++ b/src/tangara/input/lvgl_input_driver.hpp @@ -12,17 +12,17 @@ #include #include "core/lv_group.h" -#include "device_factory.hpp" -#include "feedback_device.hpp" -#include "gpios.hpp" +#include "drivers/gpios.hpp" #include "hal/lv_hal_indev.h" - -#include "input_device.hpp" -#include "input_hook.hpp" -#include "lua_thread.hpp" -#include "nvs.hpp" -#include "property.hpp" -#include "touchwheel.hpp" +#include "input/device_factory.hpp" +#include "input/feedback_device.hpp" + +#include "input/input_device.hpp" +#include "input/input_hook.hpp" +#include "lua/lua_thread.hpp" +#include "lua/property.hpp" +#include "drivers/nvs.hpp" +#include "drivers/touchwheel.hpp" namespace input { diff --git a/src/lua/bridge.cpp b/src/tangara/lua/bridge.cpp similarity index 84% rename from src/lua/bridge.cpp rename to src/tangara/lua/bridge.cpp index cfa9d5f7..07c299a7 100644 --- a/src/lua/bridge.cpp +++ b/src/tangara/lua/bridge.cpp @@ -4,33 +4,33 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "bridge.hpp" -#include +#include "lua/bridge.hpp" +#include #include #include -#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); @@ -46,8 +46,9 @@ namespace lua { static constexpr char kBridgeKey[] = "bridge"; -static auto make_font_cb(const char* name, int size, int weight) - -> const lv_font_t* { +static auto make_font_cb(const char* name, + int size, + int weight) -> const lv_font_t* { if (std::string{"fusion"} == name) { if (size == 12) { return &font_fusion_12; diff --git a/src/lua/include/bridge.hpp b/src/tangara/lua/bridge.hpp similarity index 85% rename from src/lua/include/bridge.hpp rename to src/tangara/lua/bridge.hpp index 64f14e0e..b4cfe503 100644 --- a/src/lua/include/bridge.hpp +++ b/src/tangara/lua/bridge.hpp @@ -10,9 +10,9 @@ #include #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>>&) - -> void; + std::vector>>&) -> void; Bridge(const Bridge&) = delete; Bridge& operator=(const Bridge&) = delete; diff --git a/src/lua/lua_controls.cpp b/src/tangara/lua/lua_controls.cpp similarity index 93% rename from src/lua/lua_controls.cpp rename to src/tangara/lua/lua_controls.cpp index 2da0ed11..baf40891 100644 --- a/src/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 #include @@ -16,8 +16,8 @@ #include "lua.h" #include "lvgl.h" -#include "nvs.hpp" -#include "ui_events.hpp" +#include "drivers/nvs.hpp" +#include "ui/ui_events.hpp" namespace lua { diff --git a/src/lua/include/lua_controls.hpp b/src/tangara/lua/lua_controls.hpp similarity index 100% rename from src/lua/include/lua_controls.hpp rename to src/tangara/lua/lua_controls.hpp diff --git a/src/lua/lua_database.cpp b/src/tangara/lua/lua_database.cpp similarity index 90% rename from src/lua/lua_database.cpp rename to src/tangara/lua/lua_database.cpp index d0612fdd..1afb01f0 100644 --- a/src/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 #include #include #include -#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( 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( diff --git a/src/lua/include/lua_database.hpp b/src/tangara/lua/lua_database.hpp similarity index 90% rename from src/lua/include/lua_database.hpp rename to src/tangara/lua/lua_database.hpp index b0d2acbd..328004ef 100644 --- a/src/lua/include/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/lua/lua_queue.cpp b/src/tangara/lua/lua_queue.cpp similarity index 83% rename from src/lua/lua_queue.cpp rename to src/tangara/lua/lua_queue.cpp index dfb820c2..bc393aa5 100644 --- a/src/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 #include @@ -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/lua/include/lua_queue.hpp b/src/tangara/lua/lua_queue.hpp similarity index 100% rename from src/lua/include/lua_queue.hpp rename to src/tangara/lua/lua_queue.hpp diff --git a/src/lua/include/lua_registry.hpp b/src/tangara/lua/lua_registry.hpp similarity index 91% rename from src/lua/include/lua_registry.hpp rename to src/tangara/lua/lua_registry.hpp index abc5063e..e556b6eb 100644 --- a/src/lua/include/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/lua/lua_screen.cpp b/src/tangara/lua/lua_screen.cpp similarity index 81% rename from src/lua/lua_screen.cpp rename to src/tangara/lua/lua_screen.cpp index f17f6b1a..8d87eebd 100644 --- a/src/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 #include @@ -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/lua/include/lua_screen.hpp b/src/tangara/lua/lua_screen.hpp similarity index 100% rename from src/lua/include/lua_screen.hpp rename to src/tangara/lua/lua_screen.hpp diff --git a/src/lua/lua_theme.cpp b/src/tangara/lua/lua_theme.cpp similarity index 80% rename from src/lua/lua_theme.cpp rename to src/tangara/lua/lua_theme.cpp index 72434d97..5edde104 100644 --- a/src/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 -#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/lua/include/lua_theme.hpp b/src/tangara/lua/lua_theme.hpp similarity index 100% rename from src/lua/include/lua_theme.hpp rename to src/tangara/lua/lua_theme.hpp diff --git a/src/lua/lua_thread.cpp b/src/tangara/lua/lua_thread.cpp similarity index 94% rename from src/lua/lua_thread.cpp rename to src/tangara/lua/lua_thread.cpp index dd72e41d..77a46b45 100644 --- a/src/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 #include @@ -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(ud); return instance->alloc(ptr, osize, nsize); } diff --git a/src/lua/include/lua_thread.hpp b/src/tangara/lua/lua_thread.hpp similarity index 95% rename from src/lua/include/lua_thread.hpp rename to src/tangara/lua/lua_thread.hpp index 384de61d..d7602c1e 100644 --- a/src/lua/include/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/lua/lua_version.cpp b/src/tangara/lua/lua_version.cpp similarity index 94% rename from src/lua/lua_version.cpp rename to src/tangara/lua/lua_version.cpp index e5f06bb5..b85a30a5 100644 --- a/src/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 -#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/lua/include/lua_version.hpp b/src/tangara/lua/lua_version.hpp similarity index 100% rename from src/lua/include/lua_version.hpp rename to src/tangara/lua/lua_version.hpp diff --git a/src/lua/property.cpp b/src/tangara/lua/property.cpp similarity index 98% rename from src/lua/property.cpp rename to src/tangara/lua/property.cpp index 9f4a1908..2b93809d 100644 --- a/src/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 #include @@ -14,15 +14,15 @@ #include #include -#include "bluetooth_types.hpp" +#include "database/track.hpp" +#include "drivers/bluetooth_types.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/lua/include/property.hpp b/src/tangara/lua/property.hpp similarity index 96% rename from src/lua/include/property.hpp rename to src/tangara/lua/property.hpp index 724261be..9f925766 100644 --- a/src/lua/include/property.hpp +++ b/src/tangara/lua/property.hpp @@ -10,11 +10,11 @@ #include #include -#include "audio_events.hpp" -#include "bluetooth_types.hpp" +#include "audio/audio_events.hpp" +#include "drivers/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/lua/registry.cpp b/src/tangara/lua/registry.cpp similarity index 91% rename from src/lua/registry.cpp rename to src/tangara/lua/registry.cpp index a6487858..d33594a3 100644 --- a/src/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 #include @@ -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/system_fsm/booting.cpp b/src/tangara/system_fsm/booting.cpp similarity index 84% rename from src/system_fsm/booting.cpp rename to src/tangara/system_fsm/booting.cpp index 44700cc4..58f14706 100644 --- a/src/system_fsm/booting.cpp +++ b/src/tangara/system_fsm/booting.cpp @@ -5,9 +5,9 @@ */ #include "collation.hpp" -#include "haptics.hpp" -#include "spiffs.hpp" -#include "system_fsm.hpp" +#include "drivers/haptics.hpp" +#include "drivers/spiffs.hpp" +#include "system_fsm/system_fsm.hpp" #include #include @@ -20,25 +20,25 @@ #include "freertos/projdefs.h" #include "freertos/timers.h" -#include "adc.hpp" -#include "audio_fsm.hpp" -#include "battery.hpp" -#include "bluetooth.hpp" -#include "bluetooth_types.hpp" -#include "display_init.hpp" -#include "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 "audio/audio_fsm.hpp" +#include "audio/track_queue.hpp" +#include "battery/battery.hpp" +#include "database/tag_parser.hpp" +#include "drivers/adc.hpp" +#include "drivers/bluetooth.hpp" +#include "drivers/bluetooth_types.hpp" +#include "drivers/display_init.hpp" +#include "drivers/gpios.hpp" +#include "drivers/i2c.hpp" +#include "drivers/nvs.hpp" +#include "drivers/samd.hpp" +#include "drivers/spi.hpp" +#include "drivers/touchwheel.hpp" +#include "events/event_queue.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/system_fsm/idle.cpp b/src/tangara/system_fsm/idle.cpp similarity index 89% rename from src/system_fsm/idle.cpp rename to src/tangara/system_fsm/idle.cpp index e28864b3..e499693d 100644 --- a/src/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 "drivers/gpios.hpp" #include "freertos/portmacro.h" #include "freertos/projdefs.h" -#include "gpios.hpp" #include "result.hpp" -#include "audio_fsm.hpp" -#include "event_queue.hpp" -#include "samd.hpp" -#include "storage.hpp" -#include "system_events.hpp" -#include "system_fsm.hpp" -#include "ui_fsm.hpp" +#include "audio/audio_fsm.hpp" +#include "drivers/samd.hpp" +#include "drivers/storage.hpp" +#include "events/event_queue.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/system_fsm/running.cpp b/src/tangara/system_fsm/running.cpp similarity index 92% rename from src/system_fsm/running.cpp rename to src/tangara/system_fsm/running.cpp index 796c96dc..82edd018 100644 --- a/src/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 "drivers/gpios.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 "storage.hpp" -#include "system_events.hpp" -#include "system_fsm.hpp" -#include "ui_fsm.hpp" +#include "audio/audio_fsm.hpp" +#include "drivers/storage.hpp" +#include "events/event_queue.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/system_fsm/service_locator.cpp b/src/tangara/system_fsm/service_locator.cpp similarity index 65% rename from src/system_fsm/service_locator.cpp rename to src/tangara/system_fsm/service_locator.cpp index d8dcf44a..ef719930 100644 --- a/src/system_fsm/service_locator.cpp +++ b/src/tangara/system_fsm/service_locator.cpp @@ -4,13 +4,13 @@ * SPDX-License-Identifier: GPL-3.0-only */ -#include "service_locator.hpp" +#include "system_fsm/service_locator.hpp" #include -#include "nvs.hpp" -#include "storage.hpp" -#include "touchwheel.hpp" +#include "drivers/nvs.hpp" +#include "drivers/storage.hpp" +#include "drivers/touchwheel.hpp" namespace system_fsm { diff --git a/src/system_fsm/include/service_locator.hpp b/src/tangara/system_fsm/service_locator.hpp similarity index 90% rename from src/system_fsm/include/service_locator.hpp rename to src/tangara/system_fsm/service_locator.hpp index 5978578c..5b2205eb 100644 --- a/src/system_fsm/include/service_locator.hpp +++ b/src/tangara/system_fsm/service_locator.hpp @@ -8,19 +8,19 @@ #include -#include "battery.hpp" -#include "bluetooth.hpp" +#include "audio/track_queue.hpp" +#include "battery/battery.hpp" +#include "drivers/bluetooth.hpp" #include "collation.hpp" -#include "database.hpp" -#include "gpios.hpp" -#include "haptics.hpp" -#include "nvs.hpp" -#include "samd.hpp" -#include "storage.hpp" -#include "tag_parser.hpp" +#include "database/database.hpp" +#include "database/tag_parser.hpp" +#include "drivers/gpios.hpp" +#include "drivers/haptics.hpp" +#include "drivers/nvs.hpp" +#include "drivers/samd.hpp" +#include "drivers/storage.hpp" #include "tasks.hpp" -#include "touchwheel.hpp" -#include "track_queue.hpp" +#include "drivers/touchwheel.hpp" namespace system_fsm { diff --git a/src/system_fsm/include/system_events.hpp b/src/tangara/system_fsm/system_events.hpp similarity index 89% rename from src/system_fsm/include/system_events.hpp rename to src/tangara/system_fsm/system_events.hpp index 22e3b6bd..c174a1da 100644 --- a/src/system_fsm/include/system_events.hpp +++ b/src/tangara/system_fsm/system_events.hpp @@ -8,13 +8,13 @@ #include -#include "battery.hpp" -#include "bluetooth_types.hpp" -#include "database.hpp" +#include "battery/battery.hpp" +#include "drivers/bluetooth_types.hpp" +#include "database/database.hpp" #include "ff.h" -#include "haptics.hpp" -#include "samd.hpp" -#include "service_locator.hpp" +#include "drivers/haptics.hpp" +#include "drivers/samd.hpp" +#include "system_fsm/service_locator.hpp" #include "tinyfsm.hpp" namespace system_fsm { diff --git a/src/system_fsm/system_fsm.cpp b/src/tangara/system_fsm/system_fsm.cpp similarity index 90% rename from src/system_fsm/system_fsm.cpp rename to src/tangara/system_fsm/system_fsm.cpp index 59d41c73..2e819569 100644 --- a/src/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 "gpios.hpp" -#include "service_locator.hpp" -#include "system_events.hpp" -#include "tag_parser.hpp" -#include "track_queue.hpp" +#include "drivers/gpios.hpp" +#include "events/event_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/system_fsm/include/system_fsm.hpp b/src/tangara/system_fsm/system_fsm.hpp similarity index 85% rename from src/system_fsm/include/system_fsm.hpp rename to src/tangara/system_fsm/system_fsm.hpp index f01afb3f..d69141dd 100644 --- a/src/system_fsm/include/system_fsm.hpp +++ b/src/tangara/system_fsm/system_fsm.hpp @@ -8,27 +8,26 @@ #include -#include "app_console.hpp" -#include "audio_events.hpp" -#include "battery.hpp" -#include "bluetooth.hpp" -#include "database.hpp" -#include "db_events.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 "tinyfsm.hpp" -#include "touchwheel.hpp" - #include "freertos/FreeRTOS.h" #include "freertos/timers.h" -#include "system_events.hpp" -#include "track_queue.hpp" +#include "app_console/app_console.hpp" +#include "audio/audio_events.hpp" +#include "audio/track_queue.hpp" +#include "battery/battery.hpp" +#include "drivers/bluetooth.hpp" +#include "database/database.hpp" +#include "database/db_events.hpp" +#include "database/tag_parser.hpp" +#include "drivers/display.hpp" +#include "drivers/gpios.hpp" +#include "drivers/nvs.hpp" +#include "drivers/samd.hpp" +#include "drivers/storage.hpp" +#include "system_fsm/service_locator.hpp" +#include "system_fsm/system_events.hpp" +#include "tinyfsm.hpp" +#include "drivers/touchwheel.hpp" namespace system_fsm { diff --git a/src/ui/include/fonts.hpp b/src/tangara/ui/fonts.hpp similarity index 100% rename from src/ui/include/fonts.hpp rename to src/tangara/ui/fonts.hpp diff --git a/src/ui/lvgl_task.cpp b/src/tangara/ui/lvgl_task.cpp similarity index 89% rename from src/ui/lvgl_task.cpp rename to src/tangara/ui/lvgl_task.cpp index 51da0179..448aa261 100644 --- a/src/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 #include @@ -20,8 +20,9 @@ #include "core/lv_obj.h" #include "core/lv_obj_pos.h" #include "core/lv_obj_tree.h" +#include "drivers/touchwheel.hpp" #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,21 +31,20 @@ #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" -#include "gpios.hpp" +#include "drivers/display.hpp" +#include "drivers/gpios.hpp" namespace ui { diff --git a/src/ui/include/lvgl_task.hpp b/src/tangara/ui/lvgl_task.hpp similarity index 79% rename from src/ui/include/lvgl_task.hpp rename to src/tangara/ui/lvgl_task.hpp index 8efcbf35..fcf00ab1 100644 --- a/src/ui/include/lvgl_task.hpp +++ b/src/tangara/ui/lvgl_task.hpp @@ -14,11 +14,11 @@ #include "freertos/task.h" #include "freertos/timers.h" -#include "display.hpp" -#include "lvgl_input_driver.hpp" -#include "screen.hpp" -#include "themes.hpp" -#include "touchwheel.hpp" +#include "drivers/display.hpp" +#include "input/lvgl_input_driver.hpp" +#include "drivers/touchwheel.hpp" +#include "ui/screen.hpp" +#include "ui/themes.hpp" namespace ui { diff --git a/src/ui/modal.cpp b/src/tangara/ui/modal.cpp similarity index 86% rename from src/ui/modal.cpp rename to src/tangara/ui/modal.cpp index ec541914..4f5a2432 100644 --- a/src/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/ui/include/modal.hpp b/src/tangara/ui/modal.hpp similarity index 95% rename from src/ui/include/modal.hpp rename to src/tangara/ui/modal.hpp index 6b7e792e..bd5209a7 100644 --- a/src/ui/include/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/ui/screen.cpp b/src/tangara/ui/screen.cpp similarity index 98% rename from src/ui/screen.cpp rename to src/tangara/ui/screen.cpp index a39aaf7e..8357cfbd 100644 --- a/src/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 diff --git a/src/ui/include/screen.hpp b/src/tangara/ui/screen.hpp similarity index 100% rename from src/ui/include/screen.hpp rename to src/tangara/ui/screen.hpp diff --git a/src/ui/screen_lua.cpp b/src/tangara/ui/screen_lua.cpp similarity index 94% rename from src/ui/screen_lua.cpp rename to src/tangara/ui/screen_lua.cpp index 685e43cb..c6cda7ae 100644 --- a/src/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/ui/include/screen_lua.hpp b/src/tangara/ui/screen_lua.hpp similarity index 93% rename from src/ui/include/screen_lua.hpp rename to src/tangara/ui/screen_lua.hpp index 8a463bad..d6bc20a2 100644 --- a/src/ui/include/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/ui/screen_splash.cpp b/src/tangara/ui/screen_splash.cpp similarity index 95% rename from src/ui/screen_splash.cpp rename to src/tangara/ui/screen_splash.cpp index 48cfef88..651f00dd 100644 --- a/src/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/ui/include/screen_splash.hpp b/src/tangara/ui/screen_splash.hpp similarity index 94% rename from src/ui/include/screen_splash.hpp rename to src/tangara/ui/screen_splash.hpp index 6e746345..e56c915f 100644 --- a/src/ui/include/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/ui/themes.cpp b/src/tangara/ui/themes.cpp similarity index 83% rename from src/ui/themes.cpp rename to src/tangara/ui/themes.cpp index b13f226a..44638c55 100644 --- a/src/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>{}); 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/ui/include/themes.hpp b/src/tangara/ui/themes.hpp similarity index 99% rename from src/ui/include/themes.hpp rename to src/tangara/ui/themes.hpp index 09b9cdce..fd576478 100644 --- a/src/ui/include/themes.hpp +++ b/src/tangara/ui/themes.hpp @@ -1,7 +1,7 @@ #pragma once -#include #include +#include #include #include "lvgl.h" @@ -32,7 +32,6 @@ class Theme { Theme(); std::map>> style_map; lv_theme_t theme_; - }; } // namespace themes } // namespace ui diff --git a/src/ui/include/ui_events.hpp b/src/tangara/ui/ui_events.hpp similarity index 86% rename from src/ui/include/ui_events.hpp rename to src/tangara/ui/ui_events.hpp index 3d794edc..cb446cd2 100644 --- a/src/ui/include/ui_events.hpp +++ b/src/tangara/ui/ui_events.hpp @@ -7,12 +7,12 @@ #pragma once #include -#include "database.hpp" -#include "gpios.hpp" -#include "index.hpp" -#include "nvs.hpp" -#include "screen.hpp" +#include "database/database.hpp" +#include "database/index.hpp" +#include "drivers/gpios.hpp" +#include "drivers/nvs.hpp" #include "tinyfsm.hpp" +#include "ui/screen.hpp" namespace ui { diff --git a/src/ui/ui_fsm.cpp b/src/tangara/ui/ui_fsm.cpp similarity index 94% rename from src/ui/ui_fsm.cpp rename to src/tangara/ui/ui_fsm.cpp index 1cbf1be4..17967e20 100644 --- a/src/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 #include #include -#include "bluetooth_types.hpp" -#include "db_events.hpp" -#include "device_factory.hpp" -#include "display_init.hpp" +#include "database/db_events.hpp" +#include "drivers/bluetooth_types.hpp" +#include "drivers/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 "drivers/haptics.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 "display.hpp" -#include "event_queue.hpp" -#include "gpios.hpp" -#include "lua_registry.hpp" -#include "lvgl_task.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 "audio/audio_events.hpp" +#include "audio/track_queue.hpp" +#include "drivers/display.hpp" +#include "drivers/gpios.hpp" +#include "drivers/nvs.hpp" +#include "drivers/samd.hpp" +#include "drivers/spiffs.hpp" +#include "drivers/storage.hpp" +#include "drivers/touchwheel.hpp" +#include "events/event_queue.hpp" +#include "lua/lua_registry.hpp" +#include "lua/property.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/ui/include/ui_fsm.hpp b/src/tangara/ui/ui_fsm.hpp similarity index 83% rename from src/ui/include/ui_fsm.hpp rename to src/tangara/ui/ui_fsm.hpp index 325aea8f..54d8a9ac 100644 --- a/src/ui/include/ui_fsm.hpp +++ b/src/tangara/ui/ui_fsm.hpp @@ -10,30 +10,30 @@ #include #include -#include "audio_events.hpp" -#include "battery.hpp" -#include "db_events.hpp" -#include "device_factory.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 "nvs.hpp" -#include "property.hpp" -#include "screen.hpp" -#include "service_locator.hpp" -#include "storage.hpp" -#include "system_events.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 "drivers/display.hpp" +#include "drivers/gpios.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 "drivers/nvs.hpp" +#include "drivers/storage.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 "drivers/touchwheel.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 { 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 { sCurrentModal.reset(); } - void react(const internal::ReindexDatabase&){}; + void react(const internal::ReindexDatabase&) {}; protected: void PushScreen(std::shared_ptr); diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt deleted file mode 100644 index 3814e9d5..00000000 --- a/src/ui/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2023 jacqueline -# -# SPDX-License-Identifier: GPL-3.0-only - -idf_component_register( - SRCS "lvgl_task.cpp" "ui_fsm.cpp" "screen_splash.cpp" "themes.cpp" - "screen.cpp" "modal.cpp" "screen_lua.cpp" "splash.c" "font_fusion_12.c" - "font_fusion_10.c" - INCLUDE_DIRS "include" - REQUIRES "drivers" "lvgl" "tinyfsm" "events" "system_fsm" "database" "esp_timer" "battery" "lua" "luavgl" "esp_app_format" "input") -target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS}) diff --git a/src/ui/font_symbols.c b/src/ui/font_symbols.c deleted file mode 100644 index abc380eb..00000000 --- a/src/ui/font_symbols.c +++ /dev/null @@ -1,425 +0,0 @@ -/******************************************************************************* - * Size: 12 px - * Bpp: 1 - * Opts: --font fonts/font-awesome/FontAwesome5-Solid+Brands+Regular.woff -r 0xf244,0xf243,0xf242,0xf241,0xf240 -r 0xf104,0xf0d7 -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465 -r 61468,61473,61478,61479,61480,61502,61512,61515,61516,61517 -r 61521,61522,61523,61524,61543,61544,61550,61552,61553,61556 -r 61559,61560,61561,61563,61587,61589,61636,61637,61639,61671 -r 61674,61683,61724,61732,61787,61931,62016,62017,62018,62019 -r 62020,62087,62099,62212,62189,62810,63426,63650 --size 12 --bpp 1 --format lvgl -o font_symbols.c - ******************************************************************************/ - -#ifdef LV_LVGL_H_INCLUDE_SIMPLE -#include "lvgl.h" -#else -#include "lvgl/lvgl.h" -#endif - -#ifndef FONT_SYMBOLS -#define FONT_SYMBOLS 1 -#endif - -#if FONT_SYMBOLS - -/*----------------- - * BITMAPS - *----------------*/ - -/*Store the image of the glyphs*/ -static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { - /* U+F001 "" */ - 0x0, 0x70, 0x3f, 0x1f, 0xf1, 0xfb, 0x1c, 0x31, - 0x83, 0x18, 0x31, 0x83, 0x19, 0xf7, 0x9f, 0xf8, - 0x47, 0x0, - - /* U+F008 "" */ - 0xbf, 0xde, 0x7, 0xa0, 0x5e, 0x7, 0xbf, 0xde, - 0x7, 0xa0, 0x5e, 0x7, 0xbf, 0xd0, - - /* U+F00B "" */ - 0xf7, 0xf7, 0xbf, 0xfd, 0xfe, 0x0, 0xf, 0x7f, - 0x7b, 0xff, 0xdf, 0xc0, 0x0, 0xf7, 0xf7, 0xbf, - 0xfd, 0xfc, - - /* U+F00C "" */ - 0x0, 0x20, 0x7, 0x0, 0xe4, 0x1c, 0xe3, 0x87, - 0x70, 0x3e, 0x1, 0xc0, 0x8, 0x0, - - /* U+F00D "" */ - 0xc3, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0xc3, - - /* U+F011 "" */ - 0x6, 0x2, 0x64, 0x76, 0xe6, 0x66, 0xc6, 0x3c, - 0x63, 0xc6, 0x3c, 0x3, 0x60, 0x67, 0xe, 0x3f, - 0xc0, 0xf0, - - /* U+F013 "" */ - 0xe, 0x4, 0xf0, 0x7f, 0xef, 0xfe, 0x71, 0xe7, - 0xc, 0x71, 0xef, 0xfe, 0x7f, 0xe4, 0xf0, 0xe, - 0x0, - - /* U+F015 "" */ - 0x3, 0x30, 0x1e, 0xc1, 0xcf, 0xc, 0xcc, 0x6f, - 0xdb, 0x7f, 0xb3, 0xff, 0xf, 0x3c, 0x3c, 0xf0, - 0xf3, 0xc0, - - /* U+F019 "" */ - 0xe, 0x0, 0xe0, 0xe, 0x0, 0xe0, 0x3f, 0xc3, - 0xf8, 0x1f, 0x0, 0xe0, 0xf5, 0xff, 0xff, 0xff, - 0x5f, 0xff, - - /* U+F01C "" */ - 0x1f, 0xe0, 0xc0, 0xc6, 0x1, 0x90, 0x2, 0xf8, - 0x7f, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, - - /* U+F021 "" */ - 0x0, 0x31, 0xf3, 0x71, 0xfc, 0x7, 0xc3, 0xf0, - 0x0, 0x0, 0x0, 0x0, 0xfc, 0x3e, 0x3, 0xf8, - 0xec, 0xf8, 0xc0, 0x0, - - /* U+F026 "" */ - 0xc, 0x7f, 0xff, 0xff, 0xf1, 0xc3, - - /* U+F027 "" */ - 0xc, 0xe, 0x3f, 0x7f, 0x9f, 0xdf, 0xe0, 0x70, - 0x18, - - /* U+F028 "" */ - 0x0, 0x60, 0x1, 0x83, 0x34, 0x38, 0xdf, 0xda, - 0xfe, 0x57, 0xf6, 0xbf, 0x8d, 0x1c, 0xd0, 0x61, - 0x80, 0x18, - - /* U+F03E "" */ - 0xff, 0xf9, 0xff, 0x9f, 0xf9, 0xef, 0xfc, 0x7d, - 0x83, 0xc0, 0x38, 0x3, 0xff, 0xf0, - - /* U+F048 "" */ - 0xc3, 0xc7, 0xcf, 0xdf, 0xff, 0xff, 0xdf, 0xcf, - 0xc7, 0xc3, - - /* U+F04B "" */ - 0x0, 0x1c, 0x3, 0xe0, 0x7f, 0xf, 0xf9, 0xff, - 0xbf, 0xff, 0xfe, 0xff, 0x9f, 0xc3, 0xe0, 0x70, - 0x0, 0x0, - - /* U+F04C "" */ - 0xfb, 0xff, 0x7f, 0xef, 0xfd, 0xff, 0xbf, 0xf7, - 0xfe, 0xff, 0xdf, 0xfb, 0xff, 0x7c, - - /* U+F04D "" */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, - - /* U+F051 "" */ - 0xc3, 0xe3, 0xf3, 0xfb, 0xff, 0xff, 0xfb, 0xf3, - 0xe3, 0xc3, - - /* U+F052 "" */ - 0xc, 0x3, 0xc0, 0x7c, 0x1f, 0xc7, 0xfd, 0xff, - 0xbf, 0xf0, 0x0, 0xff, 0xff, 0xff, 0xff, 0x80, - - /* U+F053 "" */ - 0xc, 0x73, 0x9c, 0xe3, 0x87, 0xe, 0x1c, 0x30, - - /* U+F054 "" */ - 0x83, 0x87, 0xe, 0x1c, 0x73, 0x9c, 0xe2, 0x0, - - /* U+F067 "" */ - 0xe, 0x1, 0xc0, 0x38, 0x7, 0xf, 0xff, 0xff, - 0xc3, 0x80, 0x70, 0xe, 0x1, 0xc0, - - /* U+F068 "" */ - 0xff, 0xff, 0xfc, - - /* U+F06E "" */ - 0xf, 0x81, 0xc7, 0x1c, 0x1d, 0xc6, 0x7e, 0xfb, - 0xf7, 0xdd, 0xdd, 0xc7, 0x1c, 0xf, 0x80, - - /* U+F070 "" */ - 0x0, 0x1, 0xc0, 0x1, 0xdf, 0x0, 0xe3, 0x80, - 0xdb, 0x84, 0xfb, 0x9c, 0x77, 0x3c, 0x6e, 0x38, - 0x78, 0x38, 0x70, 0x1e, 0x30, 0x0, 0x30, 0x0, - 0x0, - - /* U+F071 "" */ - 0x3, 0x0, 0x1c, 0x0, 0xf8, 0x3, 0xf0, 0x1c, - 0xc0, 0x73, 0x83, 0xcf, 0x1f, 0xfc, 0x7c, 0xfb, - 0xf3, 0xef, 0xff, 0x80, - - /* U+F074 "" */ - 0x0, 0x0, 0x6, 0xe1, 0xff, 0x3f, 0x17, 0x60, - 0xe4, 0x1f, 0x6f, 0xbf, 0xf1, 0xf0, 0x6, 0x0, - 0x40, - - /* U+F077 "" */ - 0x0, 0x3, 0x1, 0xe0, 0xcc, 0x61, 0xb0, 0x30, - 0x0, - - /* U+F078 "" */ - 0x0, 0x30, 0x36, 0x18, 0xcc, 0x1e, 0x3, 0x0, - 0x0, - - /* U+F079 "" */ - 0x30, 0x0, 0xf7, 0xf3, 0xf0, 0x65, 0xa0, 0xc3, - 0x1, 0x86, 0xb, 0x4c, 0x1f, 0x9f, 0xde, 0x0, - 0x18, - - /* U+F07B "" */ - 0x78, 0xf, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, - - /* U+F093 "" */ - 0x6, 0x0, 0xf0, 0x1f, 0x83, 0xfc, 0x7, 0x0, - 0x70, 0x7, 0x0, 0x70, 0xf7, 0xff, 0xff, 0xff, - 0x5f, 0xff, - - /* U+F095 "" */ - 0x0, 0x0, 0xf, 0x0, 0xf0, 0x1f, 0x0, 0xf0, - 0x6, 0x0, 0xe0, 0x1c, 0x73, 0xcf, 0xf8, 0xfe, - 0xf, 0xc0, 0x40, 0x0, - - /* U+F0C4 "" */ - 0x70, 0x5b, 0x3f, 0x6f, 0x3f, 0xc1, 0xf0, 0x3e, - 0x1f, 0xe6, 0xde, 0xd9, 0xee, 0x8, - - /* U+F0C5 "" */ - 0x1f, 0x43, 0xef, 0x7f, 0xef, 0xfd, 0xff, 0xbf, - 0xf7, 0xfe, 0xff, 0xdf, 0xf8, 0x3, 0xfc, 0x0, - - /* U+F0C7 "" */ - 0xff, 0x98, 0x1b, 0x3, 0xe0, 0x7c, 0xf, 0xff, - 0xfe, 0x7f, 0x8f, 0xf9, 0xff, 0xfc, - - /* U+F0D7 "" */ - 0xfe, 0xf8, 0xe0, 0x80, - - /* U+F0E7 "" */ - 0x78, 0x78, 0xf8, 0xf0, 0xff, 0xfe, 0xfc, 0x1c, - 0x18, 0x18, 0x10, 0x30, - - /* U+F0EA "" */ - 0x18, 0x3b, 0x8e, 0xe3, 0xf8, 0xe0, 0x3b, 0xae, - 0xe7, 0xbf, 0xef, 0xfb, 0xf0, 0xfc, 0x3f, - - /* U+F0F3 "" */ - 0x4, 0x0, 0x80, 0x7c, 0x1f, 0xc3, 0xf8, 0x7f, - 0x1f, 0xf3, 0xfe, 0x7f, 0xdf, 0xfc, 0x0, 0x7, - 0x0, - - /* U+F104 "" */ - 0x17, 0xec, 0xe7, 0x10, - - /* U+F11C "" */ - 0xff, 0xff, 0x52, 0xbd, 0x4a, 0xff, 0xff, 0xeb, - 0x5f, 0xff, 0xfd, 0x2, 0xf4, 0xb, 0xff, 0xfc, - - /* U+F124 "" */ - 0x0, 0x0, 0xf, 0x3, 0xf0, 0xfe, 0x3f, 0xef, - 0xfc, 0xff, 0xc0, 0x78, 0x7, 0x80, 0x78, 0x7, - 0x0, 0x70, 0x2, 0x0, - - /* U+F15B "" */ - 0xfa, 0x7d, 0xbe, 0xff, 0xf, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, - - /* U+F1EB "" */ - 0x7, 0xc0, 0x7f, 0xf1, 0xe0, 0xf7, 0x0, 0x70, - 0x7c, 0x3, 0xfe, 0x6, 0xc, 0x0, 0x0, 0x3, - 0x80, 0x7, 0x0, 0xe, 0x0, - - /* U+F240 "" */ - 0xff, 0xff, 0x80, 0x1f, 0x7f, 0xfe, 0xff, 0xbd, - 0xff, 0xf8, 0x1, 0xff, 0xff, 0x80, - - /* U+F241 "" */ - 0xff, 0xff, 0x80, 0x1f, 0x7f, 0x3e, 0xfe, 0x3d, - 0xfc, 0xf8, 0x1, 0xff, 0xff, 0x80, - - /* U+F242 "" */ - 0xff, 0xff, 0x80, 0x1f, 0x78, 0x3e, 0xf0, 0x3d, - 0xe0, 0xf8, 0x1, 0xff, 0xff, 0x80, - - /* U+F243 "" */ - 0xff, 0xff, 0x80, 0x1f, 0x60, 0x3e, 0xc0, 0x3d, - 0x80, 0xf8, 0x1, 0xff, 0xff, 0x80, - - /* U+F244 "" */ - 0xff, 0xff, 0x80, 0x1f, 0x0, 0x3e, 0x0, 0x3c, - 0x0, 0xf8, 0x1, 0xff, 0xff, 0x80, - - /* U+F287 "" */ - 0x0, 0xc0, 0x7, 0x80, 0x10, 0x7, 0x20, 0x6f, - 0xff, 0xfc, 0x41, 0x80, 0x40, 0x0, 0xb8, 0x0, - 0xf0, - - /* U+F293 "" */ - 0x3e, 0x3b, 0x9c, 0xdb, 0x7c, 0xbf, 0x1f, 0x9f, - 0x87, 0xd5, 0xf9, 0x9d, 0xc7, 0xc0, - - /* U+F2ED "" */ - 0xe, 0x1f, 0xfc, 0x0, 0x0, 0x7, 0xfc, 0xd5, - 0x9a, 0xb3, 0x56, 0x6a, 0xcd, 0x59, 0xab, 0x3f, - 0xe0, - - /* U+F304 "" */ - 0x0, 0x40, 0xe, 0x0, 0xf0, 0x37, 0x7, 0xa0, - 0xfc, 0x1f, 0x83, 0xf0, 0x7e, 0xf, 0xc0, 0xf8, - 0xf, 0x0, 0x80, 0x0, - - /* U+F55A "" */ - 0xf, 0xfe, 0x3f, 0xfc, 0xfb, 0x3b, 0xf0, 0xff, - 0xf3, 0xef, 0xc3, 0xcf, 0xb7, 0x8f, 0xff, 0xf, - 0xfe, - - /* U+F7C2 "" */ - 0x1f, 0x9a, 0xbe, 0xaf, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, - - /* U+F8A2 "" */ - 0x0, 0x0, 0x3, 0x30, 0x37, 0x3, 0xff, 0xff, - 0xff, 0x70, 0x3, 0x0 -}; - - -/*--------------------- - * GLYPH DESCRIPTION - *--------------------*/ - -static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { - {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, - {.bitmap_index = 0, .adv_w = 192, .box_w = 12, .box_h = 12, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 18, .adv_w = 192, .box_w = 12, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 32, .adv_w = 192, .box_w = 13, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 50, .adv_w = 192, .box_w = 12, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 64, .adv_w = 132, .box_w = 8, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 72, .adv_w = 192, .box_w = 12, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 90, .adv_w = 192, .box_w = 12, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 107, .adv_w = 216, .box_w = 14, .box_h = 10, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 125, .adv_w = 192, .box_w = 12, .box_h = 12, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 143, .adv_w = 216, .box_w = 14, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 159, .adv_w = 192, .box_w = 12, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 179, .adv_w = 96, .box_w = 6, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 185, .adv_w = 144, .box_w = 9, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 194, .adv_w = 216, .box_w = 13, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 212, .adv_w = 192, .box_w = 12, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 226, .adv_w = 168, .box_w = 8, .box_h = 10, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 236, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 254, .adv_w = 168, .box_w = 11, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 268, .adv_w = 168, .box_w = 11, .box_h = 10, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 282, .adv_w = 168, .box_w = 8, .box_h = 10, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 292, .adv_w = 168, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 308, .adv_w = 120, .box_w = 6, .box_h = 10, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 316, .adv_w = 120, .box_w = 6, .box_h = 10, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 324, .adv_w = 168, .box_w = 11, .box_h = 10, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 338, .adv_w = 168, .box_w = 11, .box_h = 2, .ofs_x = 0, .ofs_y = 3}, - {.bitmap_index = 341, .adv_w = 216, .box_w = 13, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 356, .adv_w = 240, .box_w = 15, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 381, .adv_w = 216, .box_w = 14, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 401, .adv_w = 192, .box_w = 12, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 418, .adv_w = 168, .box_w = 10, .box_h = 7, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 427, .adv_w = 168, .box_w = 10, .box_h = 7, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 436, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 453, .adv_w = 192, .box_w = 12, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 467, .adv_w = 192, .box_w = 12, .box_h = 12, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 485, .adv_w = 192, .box_w = 12, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 505, .adv_w = 168, .box_w = 11, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 519, .adv_w = 168, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 535, .adv_w = 168, .box_w = 11, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 549, .adv_w = 120, .box_w = 7, .box_h = 4, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 553, .adv_w = 120, .box_w = 8, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 565, .adv_w = 168, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 580, .adv_w = 168, .box_w = 11, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 597, .adv_w = 96, .box_w = 4, .box_h = 7, .ofs_x = 1, .ofs_y = 1}, - {.bitmap_index = 601, .adv_w = 216, .box_w = 14, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 617, .adv_w = 192, .box_w = 12, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 637, .adv_w = 144, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 651, .adv_w = 240, .box_w = 15, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 672, .adv_w = 240, .box_w = 15, .box_h = 7, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 686, .adv_w = 240, .box_w = 15, .box_h = 7, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 700, .adv_w = 240, .box_w = 15, .box_h = 7, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 714, .adv_w = 240, .box_w = 15, .box_h = 7, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 728, .adv_w = 240, .box_w = 15, .box_h = 7, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 742, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 759, .adv_w = 168, .box_w = 9, .box_h = 12, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 773, .adv_w = 168, .box_w = 11, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 790, .adv_w = 192, .box_w = 12, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 810, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 827, .adv_w = 144, .box_w = 10, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 841, .adv_w = 193, .box_w = 12, .box_h = 8, .ofs_x = 0, .ofs_y = 1} -}; - -/*--------------------- - * CHARACTER MAPPING - *--------------------*/ - -static const uint16_t unicode_list_0[] = { - 0x0, 0x7, 0xa, 0xb, 0xc, 0x10, 0x12, 0x14, - 0x18, 0x1b, 0x20, 0x25, 0x26, 0x27, 0x3d, 0x47, - 0x4a, 0x4b, 0x4c, 0x50, 0x51, 0x52, 0x53, 0x66, - 0x67, 0x6d, 0x6f, 0x70, 0x73, 0x76, 0x77, 0x78, - 0x7a, 0x92, 0x94, 0xc3, 0xc4, 0xc6, 0xd6, 0xe6, - 0xe9, 0xf2, 0x103, 0x11b, 0x123, 0x15a, 0x1ea, 0x23f, - 0x240, 0x241, 0x242, 0x243, 0x286, 0x292, 0x2ec, 0x303, - 0x559, 0x7c1, 0x8a1 -}; - -/*Collect the unicode lists and glyph_id offsets*/ -static const lv_font_fmt_txt_cmap_t cmaps[] = -{ - { - .range_start = 61441, .range_length = 2210, .glyph_id_start = 1, - .unicode_list = unicode_list_0, .glyph_id_ofs_list = NULL, .list_length = 59, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY - } -}; - - - -/*-------------------- - * ALL CUSTOM DATA - *--------------------*/ - -#if LV_VERSION_CHECK(8, 0, 0) -/*Store all the custom data of the font*/ -static lv_font_fmt_txt_glyph_cache_t cache; -static const lv_font_fmt_txt_dsc_t font_dsc = { -#else -static lv_font_fmt_txt_dsc_t font_dsc = { -#endif - .glyph_bitmap = glyph_bitmap, - .glyph_dsc = glyph_dsc, - .cmaps = cmaps, - .kern_dsc = NULL, - .kern_scale = 0, - .cmap_num = 1, - .bpp = 1, - .kern_classes = 0, - .bitmap_format = 0, -#if LV_VERSION_CHECK(8, 0, 0) - .cache = &cache -#endif -}; - - -/*----------------- - * PUBLIC FONT - *----------------*/ - -/*Initialize a public general font descriptor*/ -#if LV_VERSION_CHECK(8, 0, 0) -const lv_font_t font_symbols = { -#else -lv_font_t font_symbols = { -#endif - .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ - .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ - .line_height = 13, /*The maximum line height required by the font*/ - .base_line = 2, /*Baseline measured from the bottom of the line*/ -#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) - .subpx = LV_FONT_SUBPX_NONE, -#endif -#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8 - .underline_position = -4, - .underline_thickness = 1, -#endif - .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ -}; - - - -#endif /*#if FONT_SYMBOLS*/ - diff --git a/src/ui/icons/battery_20.c b/src/ui/icons/battery_20.c deleted file mode 100644 index 3be6b614..00000000 --- a/src/ui/icons/battery_20.c +++ /dev/null @@ -1,52 +0,0 @@ -#ifdef __has_include - #if __has_include("lvgl.h") - #ifndef LV_LVGL_H_INCLUDE_SIMPLE - #define LV_LVGL_H_INCLUDE_SIMPLE - #endif - #endif -#endif - -#if defined(LV_LVGL_H_INCLUDE_SIMPLE) - #include "lvgl.h" -#else - #include "lvgl/lvgl.h" -#endif - - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_BATTERY_20 -#define LV_ATTRIBUTE_IMG_BATTERY_20 -#endif - -static const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_BATTERY_20 uint8_t battery_20_map[] = { - 0x00, 0x00, 0x00, 0xff, /*Color of index 0*/ - 0xfd, 0xfe, 0xfd, 0xff, /*Color of index 1*/ - 0x26, 0xc1, 0x38, 0xff, /*Color of index 2*/ - 0x01, 0xbe, 0x37, 0xff, /*Color of index 3*/ - - 0x55, 0x00, 0x55, - 0x54, 0x00, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xff, 0x15, - 0x54, 0x00, 0x15, -}; - -const lv_img_dsc_t kIconBattery20 = { - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .header.always_zero = 0, - .header.reserved = 0, - .header.w = 12, - .header.h = 12, - .data_size = 52, - .data = battery_20_map, -}; diff --git a/src/ui/icons/battery_40.c b/src/ui/icons/battery_40.c deleted file mode 100644 index 4a6ead0c..00000000 --- a/src/ui/icons/battery_40.c +++ /dev/null @@ -1,52 +0,0 @@ -#ifdef __has_include - #if __has_include("lvgl.h") - #ifndef LV_LVGL_H_INCLUDE_SIMPLE - #define LV_LVGL_H_INCLUDE_SIMPLE - #endif - #endif -#endif - -#if defined(LV_LVGL_H_INCLUDE_SIMPLE) - #include "lvgl.h" -#else - #include "lvgl/lvgl.h" -#endif - - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_BATTERY_40 -#define LV_ATTRIBUTE_IMG_BATTERY_40 -#endif - -static const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_BATTERY_40 uint8_t battery_40_map[] = { - 0x00, 0x00, 0x00, 0xff, /*Color of index 0*/ - 0xfd, 0xfe, 0xfd, 0xff, /*Color of index 1*/ - 0x26, 0xc1, 0x38, 0xff, /*Color of index 2*/ - 0x01, 0xbe, 0x37, 0xff, /*Color of index 3*/ - - 0x55, 0x00, 0x55, - 0x54, 0x00, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xff, 0x15, - 0x54, 0xff, 0x15, - 0x54, 0x00, 0x15, -}; - -const lv_img_dsc_t kIconBattery40 = { - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .header.always_zero = 0, - .header.reserved = 0, - .header.w = 12, - .header.h = 12, - .data_size = 52, - .data = battery_40_map, -}; diff --git a/src/ui/icons/battery_60.c b/src/ui/icons/battery_60.c deleted file mode 100644 index 4695cb73..00000000 --- a/src/ui/icons/battery_60.c +++ /dev/null @@ -1,52 +0,0 @@ -#ifdef __has_include - #if __has_include("lvgl.h") - #ifndef LV_LVGL_H_INCLUDE_SIMPLE - #define LV_LVGL_H_INCLUDE_SIMPLE - #endif - #endif -#endif - -#if defined(LV_LVGL_H_INCLUDE_SIMPLE) - #include "lvgl.h" -#else - #include "lvgl/lvgl.h" -#endif - - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_BATTERY_60 -#define LV_ATTRIBUTE_IMG_BATTERY_60 -#endif - -static const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_BATTERY_60 uint8_t battery_60_map[] = { - 0x00, 0x00, 0x00, 0xff, /*Color of index 0*/ - 0xfd, 0xfe, 0xfd, 0xff, /*Color of index 1*/ - 0x26, 0xc1, 0x38, 0xff, /*Color of index 2*/ - 0x01, 0xbe, 0x37, 0xff, /*Color of index 3*/ - - 0x55, 0x00, 0x55, - 0x54, 0x00, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xff, 0x15, - 0x54, 0xff, 0x15, - 0x54, 0x00, 0x15, -}; - -const lv_img_dsc_t kIconBattery60 = { - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .header.always_zero = 0, - .header.reserved = 0, - .header.w = 12, - .header.h = 12, - .data_size = 52, - .data = battery_60_map, -}; diff --git a/src/ui/icons/battery_80.c b/src/ui/icons/battery_80.c deleted file mode 100644 index e0b60dfe..00000000 --- a/src/ui/icons/battery_80.c +++ /dev/null @@ -1,52 +0,0 @@ -#ifdef __has_include - #if __has_include("lvgl.h") - #ifndef LV_LVGL_H_INCLUDE_SIMPLE - #define LV_LVGL_H_INCLUDE_SIMPLE - #endif - #endif -#endif - -#if defined(LV_LVGL_H_INCLUDE_SIMPLE) - #include "lvgl.h" -#else - #include "lvgl/lvgl.h" -#endif - - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_BATTERY_80 -#define LV_ATTRIBUTE_IMG_BATTERY_80 -#endif - -static const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_BATTERY_80 uint8_t battery_80_map[] = { - 0x00, 0x00, 0x00, 0xff, /*Color of index 0*/ - 0xfd, 0xfe, 0xfd, 0xff, /*Color of index 1*/ - 0x26, 0xc1, 0x38, 0xff, /*Color of index 2*/ - 0x01, 0xbe, 0x37, 0xff, /*Color of index 3*/ - - 0x55, 0x00, 0x55, - 0x54, 0x00, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0x55, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xff, 0x15, - 0x54, 0xff, 0x15, - 0x54, 0x00, 0x15, -}; - -const lv_img_dsc_t kIconBattery80 = { - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .header.always_zero = 0, - .header.reserved = 0, - .header.w = 12, - .header.h = 12, - .data_size = 52, - .data = battery_80_map, -}; diff --git a/src/ui/icons/battery_empty.c b/src/ui/icons/battery_empty.c deleted file mode 100644 index 26f84863..00000000 --- a/src/ui/icons/battery_empty.c +++ /dev/null @@ -1,52 +0,0 @@ -#ifdef __has_include - #if __has_include("lvgl.h") - #ifndef LV_LVGL_H_INCLUDE_SIMPLE - #define LV_LVGL_H_INCLUDE_SIMPLE - #endif - #endif -#endif - -#if defined(LV_LVGL_H_INCLUDE_SIMPLE) - #include "lvgl.h" -#else - #include "lvgl/lvgl.h" -#endif - - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_BATTERY_EMPTY -#define LV_ATTRIBUTE_IMG_BATTERY_EMPTY -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_BATTERY_EMPTY uint8_t battery_empty_map[] = { - 0xfd, 0xfd, 0xfd, 0xff, /*Color of index 0*/ - 0x00, 0x00, 0x00, 0xff, /*Color of index 1*/ - 0x26, 0x2c, 0xfa, 0xff, /*Color of index 2*/ - 0x00, 0x00, 0x00, 0x00, /*Color of index 3*/ - - 0x00, 0x55, 0x00, - 0x01, 0x55, 0x40, - 0x01, 0x00, 0x40, - 0x01, 0x00, 0x40, - 0x01, 0x00, 0x40, - 0x01, 0x00, 0x40, - 0x01, 0x00, 0x40, - 0x01, 0x00, 0x40, - 0x01, 0x00, 0x40, - 0x01, 0xaa, 0x40, - 0x01, 0xaa, 0x40, - 0x01, 0x55, 0x40, -}; - -const lv_img_dsc_t kIconBatteryEmpty = { - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .header.always_zero = 0, - .header.reserved = 0, - .header.w = 12, - .header.h = 12, - .data_size = 52, - .data = battery_empty_map, -}; diff --git a/src/ui/icons/battery_full.c b/src/ui/icons/battery_full.c deleted file mode 100644 index 1e3b17e3..00000000 --- a/src/ui/icons/battery_full.c +++ /dev/null @@ -1,52 +0,0 @@ -#ifdef __has_include - #if __has_include("lvgl.h") - #ifndef LV_LVGL_H_INCLUDE_SIMPLE - #define LV_LVGL_H_INCLUDE_SIMPLE - #endif - #endif -#endif - -#if defined(LV_LVGL_H_INCLUDE_SIMPLE) - #include "lvgl.h" -#else - #include "lvgl/lvgl.h" -#endif - - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_BATTERY_FULL -#define LV_ATTRIBUTE_IMG_BATTERY_FULL -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_BATTERY_FULL uint8_t battery_full_map[] = { - 0x00, 0x00, 0x00, 0xff, /*Color of index 0*/ - 0xfd, 0xfe, 0xfd, 0xff, /*Color of index 1*/ - 0x26, 0xc1, 0x38, 0xff, /*Color of index 2*/ - 0x01, 0xbe, 0x37, 0xff, /*Color of index 3*/ - - 0x55, 0x00, 0x55, - 0x54, 0x00, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xaa, 0x15, - 0x54, 0xff, 0x15, - 0x54, 0xff, 0x15, - 0x54, 0x00, 0x15, -}; - -const lv_img_dsc_t kIconBatteryFull = { - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .header.always_zero = 0, - .header.reserved = 0, - .header.w = 12, - .header.h = 12, - .data_size = 52, - .data = battery_full_map, -}; diff --git a/src/ui/icons/bluetooth.c b/src/ui/icons/bluetooth.c deleted file mode 100644 index 66322f8f..00000000 --- a/src/ui/icons/bluetooth.c +++ /dev/null @@ -1,54 +0,0 @@ -#ifdef __has_include - #if __has_include("lvgl.h") - #ifndef LV_LVGL_H_INCLUDE_SIMPLE - #define LV_LVGL_H_INCLUDE_SIMPLE - #endif - #endif -#endif - -#if defined(LV_LVGL_H_INCLUDE_SIMPLE) - #include "lvgl.h" -#else - #include "lvgl/lvgl.h" -#endif - - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_BLUETOOTH -#define LV_ATTRIBUTE_IMG_BLUETOOTH -#endif - -static const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_BLUETOOTH uint8_t bluetooth_map[] = { - 0xfe, 0xfe, 0xfe, 0xff, /*Color of index 0*/ - 0xff, 0x75, 0x00, 0xff, /*Color of index 1*/ - 0x00, 0x00, 0x00, 0x00, /*Color of index 2*/ - 0x00, 0x00, 0x00, 0x00, /*Color of index 3*/ - - 0x00, 0x55, 0x40, 0x00, - 0x01, 0x51, 0x50, 0x00, - 0x05, 0x50, 0x54, 0x00, - 0x05, 0x51, 0x14, 0x00, - 0x05, 0x11, 0x04, 0x00, - 0x15, 0x40, 0x15, 0x00, - 0x15, 0x50, 0x55, 0x00, - 0x15, 0x40, 0x15, 0x00, - 0x05, 0x11, 0x04, 0x00, - 0x05, 0x51, 0x14, 0x00, - 0x05, 0x50, 0x54, 0x00, - 0x01, 0x51, 0x50, 0x00, - 0x00, 0x55, 0x40, 0x00, - 0x00, 0x00, 0x00, 0x00, -}; - -const lv_img_dsc_t kIconBluetooth = { - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .header.always_zero = 0, - .header.reserved = 0, - .header.w = 14, - .header.h = 14, - .data_size = 72, - .data = bluetooth_map, -}; diff --git a/src/ui/icons/pause.c b/src/ui/icons/pause.c deleted file mode 100644 index 8201b5bb..00000000 --- a/src/ui/icons/pause.c +++ /dev/null @@ -1,54 +0,0 @@ -#ifdef __has_include - #if __has_include("lvgl.h") - #ifndef LV_LVGL_H_INCLUDE_SIMPLE - #define LV_LVGL_H_INCLUDE_SIMPLE - #endif - #endif -#endif - -#if defined(LV_LVGL_H_INCLUDE_SIMPLE) - #include "lvgl.h" -#else - #include "lvgl/lvgl.h" -#endif - - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_PAUSE -#define LV_ATTRIBUTE_IMG_PAUSE -#endif - -static const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_PAUSE uint8_t pause_map[] = { - 0xfe, 0xfe, 0xfe, 0xff, /*Color of index 0*/ - 0x00, 0x00, 0x00, 0xff, /*Color of index 1*/ - 0x00, 0x00, 0x00, 0x00, /*Color of index 2*/ - 0x00, 0x00, 0x00, 0x00, /*Color of index 3*/ - - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x50, 0x14, 0x00, - 0x00, 0x50, 0x14, 0x00, - 0x00, 0x50, 0x14, 0x00, - 0x00, 0x50, 0x14, 0x00, - 0x00, 0x50, 0x14, 0x00, - 0x00, 0x50, 0x14, 0x00, - 0x00, 0x50, 0x14, 0x00, - 0x00, 0x50, 0x14, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, -}; - -const lv_img_dsc_t kIconPause = { - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .header.always_zero = 0, - .header.reserved = 0, - .header.w = 14, - .header.h = 14, - .data_size = 72, - .data = pause_map, -}; diff --git a/src/ui/icons/play.c b/src/ui/icons/play.c deleted file mode 100644 index 8984eae4..00000000 --- a/src/ui/icons/play.c +++ /dev/null @@ -1,54 +0,0 @@ -#ifdef __has_include - #if __has_include("lvgl.h") - #ifndef LV_LVGL_H_INCLUDE_SIMPLE - #define LV_LVGL_H_INCLUDE_SIMPLE - #endif - #endif -#endif - -#if defined(LV_LVGL_H_INCLUDE_SIMPLE) - #include "lvgl.h" -#else - #include "lvgl/lvgl.h" -#endif - - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_PLAY -#define LV_ATTRIBUTE_IMG_PLAY -#endif - -static const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_PLAY uint8_t play_map[] = { - 0xfe, 0xfe, 0xfe, 0xff, /*Color of index 0*/ - 0x00, 0x00, 0x00, 0xff, /*Color of index 1*/ - 0x00, 0x00, 0x00, 0x00, /*Color of index 2*/ - 0x00, 0x00, 0x00, 0x00, /*Color of index 3*/ - - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x50, 0x00, 0x00, - 0x00, 0x55, 0x00, 0x00, - 0x00, 0x55, 0x50, 0x00, - 0x00, 0x55, 0x54, 0x00, - 0x00, 0x55, 0x54, 0x00, - 0x00, 0x55, 0x50, 0x00, - 0x00, 0x55, 0x00, 0x00, - 0x00, 0x50, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, -}; - -const lv_img_dsc_t kIconPlay = { - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .header.always_zero = 0, - .header.reserved = 0, - .header.w = 14, - .header.h = 14, - .data_size = 72, - .data = play_map, -}; diff --git a/src/ui/include/ui_tick.hpp b/src/ui/include/ui_tick.hpp deleted file mode 100644 index 37f8a8bd..00000000 --- a/src/ui/include/ui_tick.hpp +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright 2023 jacqueline - * - * SPDX-License-Identifier: GPL-3.0-only - */ - -#pragma once - -#include "esp_timer.h" - -#define LV_TICK_CUSTOM_SYS_TIME_EXPR (esp_timer_get_time() / 1000) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index e1913920..49554be8 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -2,4 +2,4 @@ # # SPDX-License-Identifier: GPL-3.0-only -idf_component_register(SRCS INCLUDE_DIRS "include" REQUIRES "database") +idf_component_register(SRCS INCLUDE_DIRS "include" REQUIRES "memory") diff --git a/src/util/random.cpp b/src/util/random.cpp index ae543765..2b2af9c7 100644 --- a/src/util/random.cpp +++ b/src/util/random.cpp @@ -29,8 +29,8 @@ auto Random::Next() -> std::uint64_t { return komirand(&seed1_, &seed2_); } -auto Random::RangeInclusive(std::uint64_t lower, std::uint64_t upper) - -> std::uint64_t { +auto Random::RangeInclusive(std::uint64_t lower, + std::uint64_t upper) -> std::uint64_t { return (Next() % (upper - lower + 1)) + lower; }