summaryrefslogtreecommitdiff
path: root/src/drivers/nvs.cpp
diff options
context:
space:
mode:
authorcooljqln <cooljqln@noreply.codeberg.org>2024-05-03 04:48:17 +0000
committercooljqln <cooljqln@noreply.codeberg.org>2024-05-03 04:48:17 +0000
commit3ceb8025ee4330c177101ed30ec17dfb0002f41e (patch)
tree58350210f15df7d00d967cac6f30eeceeb031a3c /src/drivers/nvs.cpp
parent964da15a0b84f8e5f00e8abac2f7dfda0bf60488 (diff)
parent9fafd797a5504f458b5fcae4a1d28a68da936315 (diff)
downloadtangara-fw-3ceb8025ee4330c177101ed30ec17dfb0002f41e.tar.gz
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
Diffstat (limited to 'src/drivers/nvs.cpp')
-rw-r--r--src/drivers/nvs.cpp25
1 files changed, 10 insertions, 15 deletions
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);