Merge pull request 'Break dependency cycles with our components by merging co-dependent components together' (#68) from jqln/component-merge into main

Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/68
custom
cooljqln 12 months ago
commit 3ceb8025ee
  1. 1
      lib/lvgl/env_support/cmake/esp.cmake
  2. 3
      lib/lvgl/lv_conf.h
  3. 9
      src/app_console/CMakeLists.txt
  4. 14
      src/audio/CMakeLists.txt
  5. 10
      src/battery/CMakeLists.txt
  6. 2
      src/codecs/codec.cpp
  7. 4
      src/codecs/source_buffer.cpp
  8. 22
      src/database/CMakeLists.txt
  9. 9
      src/dev_console/CMakeLists.txt
  10. 4
      src/drivers/CMakeLists.txt
  11. 2
      src/drivers/adc.cpp
  12. 11
      src/drivers/bluetooth.cpp
  13. 8
      src/drivers/display.cpp
  14. 2
      src/drivers/display_init.cpp
  15. 4
      src/drivers/gpios.cpp
  16. 12
      src/drivers/haptics.cpp
  17. 2
      src/drivers/i2c.cpp
  18. 13
      src/drivers/i2s_dac.cpp
  19. 0
      src/drivers/include/drivers/a2dp_audio_output.hpp
  20. 0
      src/drivers/include/drivers/adc.hpp
  21. 4
      src/drivers/include/drivers/bluetooth.hpp
  22. 0
      src/drivers/include/drivers/bluetooth_types.hpp
  23. 4
      src/drivers/include/drivers/display.hpp
  24. 0
      src/drivers/include/drivers/display_init.hpp
  25. 0
      src/drivers/include/drivers/fatfs_audio_input.hpp
  26. 0
      src/drivers/include/drivers/gpios.hpp
  27. 0
      src/drivers/include/drivers/haptics.hpp
  28. 0
      src/drivers/include/drivers/i2c.hpp
  29. 2
      src/drivers/include/drivers/i2s_dac.hpp
  30. 3
      src/drivers/include/drivers/nvs.hpp
  31. 0
      src/drivers/include/drivers/samd.hpp
  32. 0
      src/drivers/include/drivers/spi.hpp
  33. 0
      src/drivers/include/drivers/spiffs.hpp
  34. 2
      src/drivers/include/drivers/storage.hpp
  35. 2
      src/drivers/include/drivers/touchwheel.hpp
  36. 0
      src/drivers/include/drivers/wm8523.hpp
  37. 25
      src/drivers/nvs.cpp
  38. 4
      src/drivers/samd.cpp
  39. 2
      src/drivers/spi.cpp
  40. 2
      src/drivers/spiffs.cpp
  41. 4
      src/drivers/storage.cpp
  42. 4
      src/drivers/test/test_dac.cpp
  43. 4
      src/drivers/test/test_gpio_expander.cpp
  44. 8
      src/drivers/test/test_storage.cpp
  45. 4
      src/drivers/touchwheel.cpp
  46. 4
      src/drivers/wm8523.cpp
  47. 9
      src/events/CMakeLists.txt
  48. 7
      src/graphics/CMakeLists.txt
  49. 0
      src/graphics/font_fusion_10.c
  50. 0
      src/graphics/font_fusion_12.c
  51. 0
      src/graphics/splash.c
  52. 13
      src/input/CMakeLists.txt
  53. 13
      src/lua/CMakeLists.txt
  54. 5
      src/main/CMakeLists.txt
  55. 12
      src/main/main.cpp
  56. 11
      src/system_fsm/CMakeLists.txt
  57. 22
      src/tangara/CMakeLists.txt
  58. 36
      src/tangara/app_console/app_console.cpp
  59. 12
      src/tangara/app_console/app_console.hpp
  60. 0
      src/tangara/audio/README.md
  61. 12
      src/tangara/audio/audio_converter.cpp
  62. 8
      src/tangara/audio/audio_converter.hpp
  63. 27
      src/tangara/audio/audio_decoder.cpp
  64. 10
      src/tangara/audio/audio_decoder.hpp
  65. 4
      src/tangara/audio/audio_events.hpp
  66. 38
      src/tangara/audio/audio_fsm.cpp
  67. 32
      src/tangara/audio/audio_fsm.hpp
  68. 0
      src/tangara/audio/audio_sink.hpp
  69. 8
      src/tangara/audio/audio_source.cpp
  70. 5
      src/tangara/audio/audio_source.hpp
  71. 10
      src/tangara/audio/bt_audio_output.cpp
  72. 8
      src/tangara/audio/bt_audio_output.hpp
  73. 30
      src/tangara/audio/fatfs_audio_input.cpp
  74. 6
      src/tangara/audio/fatfs_audio_input.hpp
  75. 10
      src/tangara/audio/fatfs_source.cpp
  76. 2
      src/tangara/audio/fatfs_source.hpp
  77. 15
      src/tangara/audio/i2s_audio_output.cpp
  78. 6
      src/tangara/audio/i2s_audio_output.hpp
  79. 6
      src/tangara/audio/readahead_source.cpp
  80. 2
      src/tangara/audio/readahead_source.hpp
  81. 2
      src/tangara/audio/resample.cpp
  82. 0
      src/tangara/audio/resample.hpp
  83. 0
      src/tangara/audio/test/CMakeLists.txt
  84. 14
      src/tangara/audio/track_queue.cpp
  85. 6
      src/tangara/audio/track_queue.hpp
  86. 10
      src/tangara/battery/battery.cpp
  87. 4
      src/tangara/battery/battery.hpp
  88. 24
      src/tangara/database/database.cpp
  89. 10
      src/tangara/database/database.hpp
  90. 0
      src/tangara/database/db_events.hpp
  91. 4
      src/tangara/database/env_esp.cpp
  92. 0
      src/tangara/database/env_esp.hpp
  93. 4
      src/tangara/database/file_gatherer.cpp
  94. 10
      src/tangara/database/file_gatherer.hpp
  95. 2
      src/tangara/database/future_fetcher.hpp
  96. 11
      src/tangara/database/index.cpp
  97. 7
      src/tangara/database/index.hpp
  98. 6
      src/tangara/database/records.cpp
  99. 4
      src/tangara/database/records.hpp
  100. 4
      src/tangara/database/tag_parser.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

@ -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")

@ -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.

@ -1,9 +0,0 @@
# Copyright 2023 jacqueline <me@jacqueline.id.au>
#
# 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})

@ -1,14 +0,0 @@
# Copyright 2023 jacqueline <me@jacqueline.id.au>
#
# 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})

@ -1,10 +0,0 @@
# Copyright 2023 jacqueline <me@jacqueline.id.au>
#
# 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})

@ -9,8 +9,8 @@
#include <memory>
#include <optional>
#include "mad.hpp"
#include "dr_flac.hpp"
#include "mad.hpp"
#include "opus.hpp"
#include "types.hpp"
#include "vorbis.hpp"

@ -62,8 +62,8 @@ auto SourceBuffer::AddBytes(std::function<size_t(std::span<std::byte>)> writer)
auto SourceBuffer::ConsumeBytes(
std::function<size_t(std::span<std::byte>)> 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;

@ -1,22 +0,0 @@
# Copyright 2023 jacqueline <me@jacqueline.id.au>
#
# 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)

@ -1,9 +0,0 @@
# Copyright 2023 jacqueline <me@jacqueline.id.au>
#
# 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})

@ -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})

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "adc.hpp"
#include "drivers/adc.hpp"
#include <cstdint>
#include "esp_adc/adc_cali.h"

@ -1,4 +1,4 @@
#include "bluetooth.hpp"
#include "drivers/bluetooth.hpp"
#include <stdint.h>
@ -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<void>([=]() {
auto lock = bluetooth::BluetoothState::lock();

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "display.hpp"
#include "drivers/display.hpp"
#include <stdint.h>
#include <cmath>
@ -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";

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "display_init.hpp"
#include "drivers/display_init.hpp"
namespace drivers {
namespace displays {

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "gpios.hpp"
#include "drivers/gpios.hpp"
#include <cstdint>
@ -15,7 +15,7 @@
#include "esp_intr_alloc.h"
#include "hal/gpio_types.h"
#include "i2c.hpp"
#include "drivers/i2c.hpp"
namespace drivers {

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "haptics.hpp"
#include "drivers/haptics.hpp"
#include <stdint.h>
#include <cstdint>
@ -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<ErmMotor, LraMotor>& motor) {
// Set library
// TODO(robin): try the other libraries and test response. C is marginal, D
// too much?
WriteRegister(Register::kWaveformLibrary, static_cast<uint8_t>(kDefaultErmLibrary));
WriteRegister(Register::kWaveformLibrary,
static_cast<uint8_t>(kDefaultErmLibrary));
} else if (std::holds_alternative<LraMotor>(motor)) {
ESP_LOGI(kTag, "Setting up LRA motor...");
@ -75,7 +76,8 @@ Haptics::Haptics(const std::variant<ErmMotor, LraMotor>& motor) {
ControlMask::kLraOpenLoop);
// Set library; only option is the LRA one for, well, LRA motors.
WriteRegister(Register::kWaveformLibrary, static_cast<uint8_t>(Library::LRA));
WriteRegister(Register::kWaveformLibrary,
static_cast<uint8_t>(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<uint8_t>(Mode::kInternalTrigger) |
ModeMask::kStandby);

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "i2c.hpp"
#include "drivers/i2c.hpp"
#include <cstdint>

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "i2s_dac.hpp"
#include "drivers/i2s_dac.hpp"
#include <cmath>
#include <cstdint>
@ -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<std::mutex> lock(configure_mutex_);
if (i2s_active_) {

@ -12,11 +12,11 @@
#include <freertos/FreeRTOS.h>
#include <freertos/stream_buffer.h>
#include <stdint.h>
#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"

@ -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 {

@ -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 {

@ -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 {

@ -15,7 +15,7 @@
#include "ff.h"
#include "result.hpp"
#include "gpios.hpp"
#include "drivers/gpios.hpp"
namespace drivers {

@ -12,7 +12,7 @@
#include "esp_err.h"
#include "result.hpp"
#include "gpios.hpp"
#include "drivers/gpios.hpp"
namespace drivers {

@ -4,22 +4,19 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "nvs.hpp"
#include <stdint.h>
#include <sys/_stdint.h>
#include "drivers/nvs.hpp"
#include <cstdint>
#include <memory>
#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<std::string> {
static auto nvs_get_string(nvs_handle_t nvs,
const char* key) -> std::optional<std::string> {
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<std::mutex> lock{mutex_};
bt_volumes_dirty_ = true;
bt_volumes_.Put(mac, vol);

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "samd.hpp"
#include "drivers/samd.hpp"
#include <cstdint>
#include <optional>
@ -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,

@ -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"

@ -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"

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "storage.hpp"
#include "drivers/storage.hpp"
#include <atomic>
#include <memory>
@ -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";

@ -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 {

@ -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 {

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "storage.hpp"
#include "drivers/storage.hpp"
#include <dirent.h>
@ -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 {

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "touchwheel.hpp"
#include "drivers/touchwheel.hpp"
#include <stdint.h>
#include <cstdint>
@ -18,7 +18,7 @@
#include "hal/gpio_types.h"
#include "hal/i2c_types.h"
#include "i2c.hpp"
#include "drivers/i2c.hpp"
namespace drivers {

@ -3,14 +3,14 @@
*
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "wm8523.hpp"
#include "drivers/wm8523.hpp"
#include <cstdint>
#include "esp_err.h"
#include "drivers/i2c.hpp"
#include "hal/i2c_types.h"
#include "i2c.hpp"
namespace drivers {
namespace wm8523 {

@ -1,9 +0,0 @@
# Copyright 2023 jacqueline <me@jacqueline.id.au>
#
# 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})

@ -0,0 +1,7 @@
# Copyright 2024 jacqueline <me@jacqueline.id.au>
#
# SPDX-License-Identifier: GPL-3.0-only
idf_component_register(
SRCS "font_fusion_10.c" "font_fusion_12.c" "splash.c"
REQUIRES "lvgl")

@ -1,13 +0,0 @@
# Copyright 2023 jacqueline <me@jacqueline.id.au>
#
# 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})

@ -1,13 +0,0 @@
# Copyright 2023 jacqueline <me@jacqueline.id.au>
#
# 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})

@ -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})

@ -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());

@ -1,11 +0,0 @@
# Copyright 2023 jacqueline <me@jacqueline.id.au>
#
# 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})

@ -0,0 +1,22 @@
# Copyright 2024 jacqueline <me@jacqueline.id.au>
#
# 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)

@ -4,11 +4,9 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "app_console.hpp"
#include "app_console/app_console.hpp"
#include <dirent.h>
#include <stdint.h>
#include <sys/_stdint.h>
#include <algorithm>
#include <cstdint>
@ -21,11 +19,7 @@
#include <string>
#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 {

@ -8,12 +8,12 @@
#include <memory>
#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 {

@ -4,23 +4,23 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "audio_converter.hpp"
#include "audio/audio_converter.hpp"
#include <stdint.h>
#include <algorithm>
#include <cmath>
#include <cstdint>
#include "audio_events.hpp"
#include "audio_sink.hpp"
#include "audio/audio_events.hpp"
#include "audio/audio_sink.hpp"
#include "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"

@ -10,11 +10,11 @@
#include <cstdint>
#include <memory>
#include "audio_events.hpp"
#include "audio_sink.hpp"
#include "audio_source.hpp"
#include "audio/audio_events.hpp"
#include "audio/audio_sink.hpp"
#include "audio/audio_source.hpp"
#include "audio/resample.hpp"
#include "codec.hpp"
#include "resample.hpp"
#include "sample.hpp"
namespace audio {

@ -4,22 +4,19 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "audio_decoder.hpp"
#include <cstdint>
#include <cstdlib>
#include "audio/audio_decoder.hpp"
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <memory>
#include <span>
#include <variant>
#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 {

@ -9,12 +9,12 @@
#include <cstdint>
#include <memory>
#include "audio_converter.hpp"
#include "audio_events.hpp"
#include "audio_sink.hpp"
#include "audio_source.hpp"
#include "audio/audio_converter.hpp"
#include "audio/audio_events.hpp"
#include "audio/audio_sink.hpp"
#include "audio/audio_source.hpp"
#include "codec.hpp"
#include "track.hpp"
#include "database/track.hpp"
#include "types.hpp"
namespace audio {

@ -12,10 +12,10 @@
#include <optional>
#include <string>
#include "audio_sink.hpp"
#include "audio/audio_sink.hpp"
#include "tinyfsm.hpp"
#include "track.hpp"
#include "database/track.hpp"
#include "types.hpp"
namespace audio {

@ -4,41 +4,41 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "audio_fsm.hpp"
#include "audio/audio_fsm.hpp"
#include <stdint.h>
#include <future>
#include <memory>
#include <variant>
#include "audio_sink.hpp"
#include "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 {

@ -11,24 +11,24 @@
#include <memory>
#include <vector>
#include "audio_sink.hpp"
#include "service_locator.hpp"
#include "audio/audio_sink.hpp"
#include "system_fsm/service_locator.hpp"
#include "tinyfsm.hpp"
#include "audio_decoder.hpp"
#include "audio_events.hpp"
#include "bt_audio_output.hpp"
#include "database.hpp"
#include "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 {

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "audio_source.hpp"
#include "audio/audio_source.hpp"
#include "codec.hpp"
#include "types.hpp"
@ -14,7 +14,11 @@ TaggedStream::TaggedStream(std::shared_ptr<database::TrackTags> t,
std::unique_ptr<codecs::IStream> w,
std::string filepath,
uint32_t offset)
: codecs::IStream(w->type()), tags_(t), wrapped_(std::move(w)), filepath_(filepath), offset_(offset) {}
: codecs::IStream(w->type()),
tags_(t),
wrapped_(std::move(w)),
filepath_(filepath),
offset_(offset) {}
auto TaggedStream::tags() -> std::shared_ptr<database::TrackTags> {
return tags_;

@ -8,7 +8,7 @@
#include <memory>
#include "codec.hpp"
#include "track.hpp"
#include "database/track.hpp"
#include "types.hpp"
namespace audio {
@ -18,8 +18,7 @@ class TaggedStream : public codecs::IStream {
TaggedStream(std::shared_ptr<database::TrackTags>,
std::unique_ptr<codecs::IStream> wrapped,
std::string path,
uint32_t offset = 0
);
uint32_t offset = 0);
auto tags() -> std::shared_ptr<database::TrackTags>;

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "bt_audio_output.hpp"
#include "audio/bt_audio_output.hpp"
#include <algorithm>
#include <cmath>
@ -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";

@ -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 {

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "fatfs_audio_input.hpp"
#include "audio/fatfs_audio_input.hpp"
#include <algorithm>
#include <climits>
@ -18,24 +18,24 @@
#include <string>
#include <variant>
#include "audio/readahead_source.hpp"
#include "esp_heap_caps.h"
#include "esp_log.h"
#include "ff.h"
#include "freertos/portmacro.h"
#include "freertos/projdefs.h"
#include "readahead_source.hpp"
#include "audio_events.hpp"
#include "audio_fsm.hpp"
#include "audio_source.hpp"
#include "audio/audio_events.hpp"
#include "audio/audio_fsm.hpp"
#include "audio/audio_source.hpp"
#include "audio/fatfs_source.hpp"
#include "codec.hpp"
#include "event_queue.hpp"
#include "fatfs_source.hpp"
#include "future_fetcher.hpp"
#include "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<std::string> path) -> void {
}
}
auto FatfsAudioInput::SetPath(const std::string& path, uint32_t offset)
-> void {
auto FatfsAudioInput::SetPath(const std::string& path,
uint32_t offset) -> void {
std::lock_guard<std::mutex> guard{new_stream_mutex_};
if (OpenFile(path, offset)) {
has_new_stream_ = true;
@ -103,8 +103,8 @@ auto FatfsAudioInput::NextStream() -> std::shared_ptr<TaggedStream> {
}
}
auto FatfsAudioInput::OpenFile(const std::string& path, uint32_t offset)
-> bool {
auto FatfsAudioInput::OpenFile(const std::string& path,
uint32_t offset) -> bool {
ESP_LOGI(kTag, "opening file %s", path.c_str());
auto tags = tag_parser_.ReadAndParseTags(path);

@ -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"

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "fatfs_source.hpp"
#include "audio/fatfs_source.hpp"
#include <sys/_stdint.h>
#include <cstddef>
@ -12,13 +12,13 @@
#include <memory>
#include "esp_log.h"
#include "event_queue.hpp"
#include "events/event_queue.hpp"
#include "ff.h"
#include "audio_source.hpp"
#include "audio/audio_source.hpp"
#include "codec.hpp"
#include "spi.hpp"
#include "system_events.hpp"
#include "drivers/spi.hpp"
#include "system_fsm/system_events.hpp"
#include "types.hpp"
namespace audio {

@ -13,7 +13,7 @@
#include "codec.hpp"
#include "ff.h"
#include "audio_source.hpp"
#include "audio/audio_source.hpp"
namespace audio {

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "i2s_audio_output.hpp"
#include "audio/i2s_audio_output.hpp"
#include <stdint.h>
#include <algorithm>
@ -18,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";
@ -133,7 +133,8 @@ auto I2SAudioOutput::GetVolumeDb() -> int_fast16_t {
}
auto I2SAudioOutput::SetVolumeDb(int_fast16_t val) -> bool {
SetVolume(val * 4 + static_cast<int>(drivers::wm8523::kLineLevelReferenceVolume) - 2);
SetVolume(val * 4 +
static_cast<int>(drivers::wm8523::kLineLevelReferenceVolume) - 2);
return true;
}

@ -11,9 +11,9 @@
#include <memory>
#include <vector>
#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 {

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "readahead_source.hpp"
#include "audio/readahead_source.hpp"
#include <cstddef>
#include <cstdint>
@ -14,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"

@ -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"

@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "resample.hpp"
#include "audio/resample.hpp"
#include <algorithm>
#include <cmath>

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "track_queue.hpp"
#include "audio/track_queue.hpp"
#include <stdint.h>
#include <algorithm>
@ -18,16 +18,16 @@
#include "MillerShuffle.h"
#include "esp_random.h"
#include "audio_events.hpp"
#include "audio_fsm.hpp"
#include "audio/audio_events.hpp"
#include "audio/audio_fsm.hpp"
#include "cppbor.h"
#include "cppbor_parse.h"
#include "database.hpp"
#include "event_queue.hpp"
#include "database/database.hpp"
#include "database/track.hpp"
#include "events/event_queue.hpp"
#include "memory_resource.hpp"
#include "tasks.hpp"
#include "track.hpp"
#include "ui_fsm.hpp"
#include "ui/ui_fsm.hpp"
namespace audio {

@ -12,11 +12,11 @@
#include <shared_mutex>
#include <vector>
#include "audio_events.hpp"
#include "audio/audio_events.hpp"
#include "cppbor_parse.h"
#include "database.hpp"
#include "database/database.hpp"
#include "database/track.hpp"
#include "tasks.hpp"
#include "track.hpp"
namespace audio {

@ -4,15 +4,15 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "battery.hpp"
#include "battery/battery.hpp"
#include <cstdint>
#include "adc.hpp"
#include "event_queue.hpp"
#include "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 {

@ -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 {

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "database.hpp"
#include "database/database.hpp"
#include <stdint.h>
#include <sys/_stdint.h>
@ -23,10 +23,10 @@
#include "collation.hpp"
#include "cppbor.h"
#include "cppbor_parse.h"
#include "database/index.hpp"
#include "esp_log.h"
#include "ff.h"
#include "freertos/projdefs.h"
#include "index.hpp"
#include "komihash.h"
#include "leveldb/cache.h"
#include "leveldb/db.h"
@ -36,17 +36,17 @@
#include "leveldb/status.h"
#include "leveldb/write_batch.h"
#include "db_events.hpp"
#include "env_esp.hpp"
#include "event_queue.hpp"
#include "file_gatherer.hpp"
#include "database/db_events.hpp"
#include "database/env_esp.hpp"
#include "database/file_gatherer.hpp"
#include "database/records.hpp"
#include "database/tag_parser.hpp"
#include "database/track.hpp"
#include "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<bool> sIsDbOpen(false);
static auto CreateNewDatabase(leveldb::Options& options, locale::ICollator& col)
-> leveldb::DB* {
static auto CreateNewDatabase(leveldb::Options& options,
locale::ICollator& col) -> leveldb::DB* {
Database::Destroy();
leveldb::DB* db;
options.create_if_missing = true;

@ -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 {

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "env_esp.hpp"
#include "database/env_esp.hpp"
#include <atomic>
#include <cerrno>
@ -36,7 +36,7 @@
#include "leveldb/slice.h"
#include "leveldb/status.h"
#include "spi.hpp"
#include "drivers/spi.hpp"
#include "tasks.hpp"
namespace leveldb {

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "file_gatherer.hpp"
#include "database/file_gatherer.hpp"
#include <deque>
#include <functional>
@ -13,8 +13,8 @@
#include "ff.h"
#include "drivers/spi.hpp"
#include "memory_resource.hpp"
#include "spi.hpp"
namespace database {

@ -21,16 +21,14 @@ class IFileGatherer {
virtual auto FindFiles(
const std::string& root,
std::function<void(std::string_view, const FILINFO&)> cb)
-> void = 0;
std::function<void(std::string_view, const FILINFO&)> cb) -> void = 0;
};
class FileGathererImpl : public IFileGatherer {
public:
virtual auto FindFiles(
const std::string& root,
std::function<void(std::string_view, const FILINFO&)> cb)
-> void override;
virtual auto FindFiles(const std::string& root,
std::function<void(std::string_view, const FILINFO&)>
cb) -> void override;
};
} // namespace database

@ -9,7 +9,7 @@
#include <memory>
#include <utility>
#include "database.hpp"
#include "database/database.hpp"
namespace database {

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "index.hpp"
#include "database/index.hpp"
#include <sys/_stdint.h>
#include <cstdint>
@ -21,8 +21,8 @@
#include "komihash.h"
#include "leveldb/write_batch.h"
#include "records.hpp"
#include "track.hpp"
#include "database/records.hpp"
#include "database/track.hpp"
namespace database {
@ -183,8 +183,9 @@ auto Indexer::handleItem(const IndexKey::Header& header,
}
}
auto Index(locale::ICollator& c, const IndexInfo& i, const Track& t)
-> std::vector<std::pair<IndexKey, std::string>> {
auto Index(locale::ICollator& c,
const IndexInfo& i,
const Track& t) -> std::vector<std::pair<IndexKey, std::string>> {
Indexer indexer{c, t, i};
return indexer.index();
}

@ -17,9 +17,9 @@
#include "leveldb/db.h"
#include "leveldb/slice.h"
#include "database/track.hpp"
#include "leveldb/write_batch.h"
#include "memory_resource.hpp"
#include "track.hpp"
namespace database {
@ -61,8 +61,9 @@ struct IndexKey {
std::optional<TrackId> track;
};
auto Index(locale::ICollator&, const IndexInfo&, const Track&)
-> std::vector<std::pair<IndexKey, std::string>>;
auto Index(locale::ICollator&,
const IndexInfo&,
const Track&) -> std::vector<std::pair<IndexKey, std::string>>;
auto ExpandHeader(const IndexKey::Header&,
const std::optional<std::pmr::string>&) -> IndexKey::Header;

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "records.hpp"
#include "database/records.hpp"
#include <stdint.h>
#include <sys/_stdint.h>
@ -21,10 +21,10 @@
#include "cppbor_parse.h"
#include "esp_log.h"
#include "index.hpp"
#include "database/index.hpp"
#include "database/track.hpp"
#include "komihash.h"
#include "memory_resource.hpp"
#include "track.hpp"
// As LevelDB is a key-value store, each record in the database consists of a
// key and an optional value.

@ -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 {

@ -4,16 +4,16 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "tag_parser.hpp"
#include "database/tag_parser.hpp"
#include <cstdint>
#include <cstdlib>
#include <iomanip>
#include <mutex>
#include "drivers/spi.hpp"
#include "esp_log.h"
#include "ff.h"
#include "spi.hpp"
#include "tags.h"
#include "memory_resource.hpp"

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save