summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorailurux <ailuruxx@gmail.com>2024-05-10 13:06:20 +1000
committerailurux <ailuruxx@gmail.com>2024-05-10 13:06:20 +1000
commit3f177cdb8880abf199f4445f1398cd69fb813892 (patch)
treee20de4949b1344c826e5af41ab701f3db75b21bc /src/drivers
parent8019c7691889cde4c3d40bbd78d485a92d713bbf (diff)
parente4ce7c4ac23402e09be8d6a52e0f739c0dff4ff0 (diff)
downloadtangara-fw-3f177cdb8880abf199f4445f1398cd69fb813892.tar.gz
Merge branch 'main' into file-browser
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/CMakeLists.txt4
-rw-r--r--src/drivers/adc.cpp2
-rw-r--r--src/drivers/bluetooth.cpp19
-rw-r--r--src/drivers/display.cpp8
-rw-r--r--src/drivers/display_init.cpp2
-rw-r--r--src/drivers/gpios.cpp4
-rw-r--r--src/drivers/haptics.cpp12
-rw-r--r--src/drivers/i2c.cpp2
-rw-r--r--src/drivers/i2s_dac.cpp27
-rw-r--r--src/drivers/include/drivers/a2dp_audio_output.hpp (renamed from src/drivers/include/a2dp_audio_output.hpp)0
-rw-r--r--src/drivers/include/drivers/adc.hpp (renamed from src/drivers/include/adc.hpp)0
-rw-r--r--src/drivers/include/drivers/bluetooth.hpp (renamed from src/drivers/include/bluetooth.hpp)5
-rw-r--r--src/drivers/include/drivers/bluetooth_types.hpp (renamed from src/drivers/include/bluetooth_types.hpp)0
-rw-r--r--src/drivers/include/drivers/display.hpp (renamed from src/drivers/include/display.hpp)4
-rw-r--r--src/drivers/include/drivers/display_init.hpp (renamed from src/drivers/include/display_init.hpp)0
-rw-r--r--src/drivers/include/drivers/fatfs_audio_input.hpp (renamed from src/drivers/include/fatfs_audio_input.hpp)0
-rw-r--r--src/drivers/include/drivers/gpios.hpp (renamed from src/drivers/include/gpios.hpp)0
-rw-r--r--src/drivers/include/drivers/haptics.hpp (renamed from src/drivers/include/haptics.hpp)0
-rw-r--r--src/drivers/include/drivers/i2c.hpp (renamed from src/drivers/include/i2c.hpp)0
-rw-r--r--src/drivers/include/drivers/i2s_dac.hpp (renamed from src/drivers/include/i2s_dac.hpp)8
-rw-r--r--src/drivers/include/drivers/nvs.hpp (renamed from src/drivers/include/nvs.hpp)3
-rw-r--r--src/drivers/include/drivers/samd.hpp (renamed from src/drivers/include/samd.hpp)0
-rw-r--r--src/drivers/include/drivers/spi.hpp (renamed from src/drivers/include/spi.hpp)0
-rw-r--r--src/drivers/include/drivers/spiffs.hpp (renamed from src/drivers/include/spiffs.hpp)0
-rw-r--r--src/drivers/include/drivers/storage.hpp (renamed from src/drivers/include/storage.hpp)2
-rw-r--r--src/drivers/include/drivers/touchwheel.hpp (renamed from src/drivers/include/touchwheel.hpp)2
-rw-r--r--src/drivers/include/drivers/wm8523.hpp (renamed from src/drivers/include/wm8523.hpp)0
-rw-r--r--src/drivers/nvs.cpp25
-rw-r--r--src/drivers/samd.cpp4
-rw-r--r--src/drivers/spi.cpp2
-rw-r--r--src/drivers/spiffs.cpp2
-rw-r--r--src/drivers/storage.cpp4
-rw-r--r--src/drivers/test/test_dac.cpp4
-rw-r--r--src/drivers/test/test_gpio_expander.cpp4
-rw-r--r--src/drivers/test/test_storage.cpp8
-rw-r--r--src/drivers/touchwheel.cpp4
-rw-r--r--src/drivers/wm8523.cpp4
37 files changed, 94 insertions, 71 deletions
diff --git a/src/drivers/CMakeLists.txt b/src/drivers/CMakeLists.txt
index 891115d4..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" "span" "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 <cstdint>
#include "esp_adc/adc_cali.h"
diff --git a/src/drivers/bluetooth.cpp b/src/drivers/bluetooth.cpp
index 5d1b35fa..fcb764f6 100644
--- a/src/drivers/bluetooth.cpp
+++ b/src/drivers/bluetooth.cpp
@@ -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 {
@@ -39,6 +38,7 @@ namespace drivers {
DRAM_ATTR static StreamBufferHandle_t sStream = nullptr;
DRAM_ATTR static std::atomic<float> sVolumeFactor = 1.f;
+DRAM_ATTR static std::atomic<uint32_t> sSamplesUsed = 0;
static tasks::WorkerPool* sBgWorker;
@@ -74,6 +74,13 @@ IRAM_ATTR auto a2dp_data_cb(uint8_t* buf, int32_t buf_size) -> int32_t {
}
size_t bytes_received = xStreamBufferReceive(stream, buf, buf_size, 0);
+ size_t samples_received = bytes_received / 2;
+ if (UINT32_MAX - sSamplesUsed < samples_received) {
+ sSamplesUsed = samples_received - (UINT32_MAX - sSamplesUsed);
+ } else {
+ sSamplesUsed += samples_received;
+ }
+
// Apply software volume scaling.
int16_t* samples = reinterpret_cast<int16_t*>(buf);
float factor = sVolumeFactor.load();
@@ -166,6 +173,10 @@ auto Bluetooth::SetVolumeFactor(float f) -> void {
sVolumeFactor = f;
}
+auto Bluetooth::SamplesUsed() -> uint32_t {
+ return sSamplesUsed;
+}
+
auto Bluetooth::SetEventHandler(std::function<void(bluetooth::Event)> cb)
-> void {
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 <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";
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 <cstdint>
@@ -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 <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);
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 <cstdint>
diff --git a/src/drivers/i2s_dac.cpp b/src/drivers/i2s_dac.cpp
index aef466c2..e5efe198 100644
--- a/src/drivers/i2s_dac.cpp
+++ b/src/drivers/i2s_dac.cpp
@@ -4,7 +4,8 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "i2s_dac.hpp"
+#include "drivers/i2s_dac.hpp"
+#include <stdint.h>
#include <cmath>
#include <cstdint>
@@ -25,11 +26,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 {
@@ -140,7 +141,7 @@ auto I2SDac::SetPaused(bool paused) -> void {
}
}
-static volatile bool sSwapWords = false;
+DRAM_ATTR static volatile bool sSwapWords = false;
auto I2SDac::Reconfigure(Channels ch, BitsPerSample bps, SampleRate rate)
-> void {
@@ -207,7 +208,7 @@ auto I2SDac::Reconfigure(Channels ch, BitsPerSample bps, SampleRate rate)
}
}
-auto I2SDac::WriteData(const cpp::span<const std::byte>& data) -> void {
+auto I2SDac::WriteData(const std::span<const std::byte>& data) -> void {
std::size_t bytes_written = 0;
esp_err_t err = i2s_channel_write(i2s_handle_, data.data(), data.size_bytes(),
&bytes_written, portMAX_DELAY);
@@ -216,6 +217,8 @@ auto I2SDac::WriteData(const cpp::span<const std::byte>& data) -> void {
}
}
+DRAM_ATTR static volatile uint32_t sSamplesRead = 0;
+
extern "C" IRAM_ATTR auto callback(i2s_chan_handle_t handle,
i2s_event_data_t* event,
void* user_ctx) -> bool {
@@ -234,6 +237,14 @@ extern "C" IRAM_ATTR auto callback(i2s_chan_handle_t handle,
size_t bytes_written =
xStreamBufferReceiveFromISR(src, buf, event->size, &ret);
+ // Assume 16 bit samples.
+ size_t samples = bytes_written / 2;
+ if (UINT32_MAX - sSamplesRead < samples) {
+ sSamplesRead = samples - (UINT32_MAX - sSamplesRead);
+ } else {
+ sSamplesRead = sSamplesRead + samples;
+ }
+
// The ESP32's I2S peripheral has a different endianness to its processors.
// ESP-IDF handles this difference for stereo channels, but not for mono
// channels. We therefore sometimes need to swap each pair of words as they're
@@ -275,6 +286,10 @@ auto I2SDac::SetSource(StreamBufferHandle_t buffer) -> void {
}
}
+auto I2SDac::SamplesUsed() -> uint32_t {
+ return sSamplesRead;
+}
+
auto I2SDac::set_channel(bool enabled) -> void {
if (i2s_active_ == enabled) {
return;
diff --git a/src/drivers/include/a2dp_audio_output.hpp b/src/drivers/include/drivers/a2dp_audio_output.hpp
index 010470c6..010470c6 100644
--- a/src/drivers/include/a2dp_audio_output.hpp
+++ b/src/drivers/include/drivers/a2dp_audio_output.hpp
diff --git a/src/drivers/include/adc.hpp b/src/drivers/include/drivers/adc.hpp
index 3e94a9ee..3e94a9ee 100644
--- a/src/drivers/include/adc.hpp
+++ b/src/drivers/include/drivers/adc.hpp
diff --git a/src/drivers/include/bluetooth.hpp b/src/drivers/include/drivers/bluetooth.hpp
index 8da5ce2e..ad61fcc1 100644
--- a/src/drivers/include/bluetooth.hpp
+++ b/src/drivers/include/drivers/bluetooth.hpp
@@ -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 "drivers/nvs.hpp"
#include "esp_a2dp_api.h"
#include "esp_avrc_api.h"
#include "esp_gap_bt_api.h"
-#include "nvs.hpp"
#include "tasks.hpp"
#include "tinyfsm.hpp"
#include "tinyfsm/include/tinyfsm.hpp"
@@ -44,6 +44,7 @@ class Bluetooth {
auto SetSource(StreamBufferHandle_t) -> void;
auto SetVolumeFactor(float) -> void;
+ auto SamplesUsed() -> uint32_t;
auto SetEventHandler(std::function<void(bluetooth::Event)> cb) -> void;
};
diff --git a/src/drivers/include/bluetooth_types.hpp b/src/drivers/include/drivers/bluetooth_types.hpp
index 7cfb236f..7cfb236f 100644
--- a/src/drivers/include/bluetooth_types.hpp
+++ b/src/drivers/include/drivers/bluetooth_types.hpp
diff --git a/src/drivers/include/display.hpp b/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
index 9bf5b3f5..9bf5b3f5 100644
--- a/src/drivers/include/display_init.hpp
+++ b/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
index 705f6e7d..705f6e7d 100644
--- a/src/drivers/include/fatfs_audio_input.hpp
+++ b/src/drivers/include/drivers/fatfs_audio_input.hpp
diff --git a/src/drivers/include/gpios.hpp b/src/drivers/include/drivers/gpios.hpp
index e27a3ade..e27a3ade 100644
--- a/src/drivers/include/gpios.hpp
+++ b/src/drivers/include/drivers/gpios.hpp
diff --git a/src/drivers/include/haptics.hpp b/src/drivers/include/drivers/haptics.hpp
index 940c3c6d..940c3c6d 100644
--- a/src/drivers/include/haptics.hpp
+++ b/src/drivers/include/drivers/haptics.hpp
diff --git a/src/drivers/include/i2c.hpp b/src/drivers/include/drivers/i2c.hpp
index 0dc1e7c0..0dc1e7c0 100644
--- a/src/drivers/include/i2c.hpp
+++ b/src/drivers/include/drivers/i2c.hpp
diff --git a/src/drivers/include/i2s_dac.hpp b/src/drivers/include/drivers/i2s_dac.hpp
index bd837ca0..0776dbab 100644
--- a/src/drivers/include/i2s_dac.hpp
+++ b/src/drivers/include/drivers/i2s_dac.hpp
@@ -11,6 +11,7 @@
#include <functional>
#include <memory>
#include <optional>
+#include <span>
#include <utility>
#include "driver/i2s_std.h"
@@ -20,9 +21,8 @@
#include "freertos/portmacro.h"
#include "freertos/stream_buffer.h"
#include "result.hpp"
-#include "span.hpp"
-#include "gpios.hpp"
+#include "drivers/gpios.hpp"
#include "sys/_stdint.h"
namespace drivers {
@@ -68,9 +68,11 @@ class I2SDac {
auto Reconfigure(Channels ch, BitsPerSample bps, SampleRate rate) -> void;
- auto WriteData(const cpp::span<const std::byte>& data) -> void;
+ auto WriteData(const std::span<const std::byte>& data) -> void;
auto SetSource(StreamBufferHandle_t buffer) -> void;
+ auto SamplesUsed() -> uint32_t;
+
// Not copyable or movable.
I2SDac(const I2SDac&) = delete;
I2SDac& operator=(const I2SDac&) = delete;
diff --git a/src/drivers/include/nvs.hpp b/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
index 55ea513c..55ea513c 100644
--- a/src/drivers/include/samd.hpp
+++ b/src/drivers/include/drivers/samd.hpp
diff --git a/src/drivers/include/spi.hpp b/src/drivers/include/drivers/spi.hpp
index 60638f71..60638f71 100644
--- a/src/drivers/include/spi.hpp
+++ b/src/drivers/include/drivers/spi.hpp
diff --git a/src/drivers/include/spiffs.hpp b/src/drivers/include/drivers/spiffs.hpp
index 04478590..04478590 100644
--- a/src/drivers/include/spiffs.hpp
+++ b/src/drivers/include/drivers/spiffs.hpp
diff --git a/src/drivers/include/storage.hpp b/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
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
index a64f6bac..a64f6bac 100644
--- a/src/drivers/include/wm8523.hpp
+++ b/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 <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);
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 <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,
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 <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";
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 <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 {
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 <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 {
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 <cstdint>
#include "esp_err.h"
+#include "drivers/i2c.hpp"
#include "hal/i2c_types.h"
-#include "i2c.hpp"
namespace drivers {
namespace wm8523 {