summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2022-11-07 12:20:20 +1100
committerjacqueline <me@jacqueline.id.au>2022-11-07 12:20:20 +1100
commit675d52c9a5bd32c18e5c7f1588965d2238add9c2 (patch)
treed36358f39fbc9347737b46d65e9ec37e6c1fb63c
parent28d73ad8660e27f9c7b20b6e978d3d0c412dec00 (diff)
downloadtangara-fw-675d52c9a5bd32c18e5c7f1588965d2238add9c2.tar.gz
use a less fun but more descriptive namespace
-rw-r--r--src/drivers/battery.cpp4
-rw-r--r--src/drivers/dac.cpp4
-rw-r--r--src/drivers/display-init.cpp4
-rw-r--r--src/drivers/display.cpp4
-rw-r--r--src/drivers/gpio-expander.cpp4
-rw-r--r--src/drivers/i2c.cpp4
-rw-r--r--src/drivers/include/battery.hpp4
-rw-r--r--src/drivers/include/dac.hpp4
-rw-r--r--src/drivers/include/display-init.hpp4
-rw-r--r--src/drivers/include/display.hpp4
-rw-r--r--src/drivers/include/gpio-expander.hpp4
-rw-r--r--src/drivers/include/i2c.hpp4
-rw-r--r--src/drivers/include/playback.hpp4
-rw-r--r--src/drivers/include/storage.hpp4
-rw-r--r--src/drivers/playback.cpp4
-rw-r--r--src/drivers/storage.cpp4
-rw-r--r--src/main/main.cpp26
17 files changed, 45 insertions, 45 deletions
diff --git a/src/drivers/battery.cpp b/src/drivers/battery.cpp
index 66c96daf..b3341eab 100644
--- a/src/drivers/battery.cpp
+++ b/src/drivers/battery.cpp
@@ -4,7 +4,7 @@
#include "esp_adc_cal.h"
#include "hal/adc_types.h"
-namespace gay_ipod {
+namespace drivers {
static esp_adc_cal_characteristics_t calibration;
@@ -28,4 +28,4 @@ uint32_t read_battery_voltage(void) {
return esp_adc_cal_raw_to_voltage(raw, &calibration);
}
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/dac.cpp b/src/drivers/dac.cpp
index d74e9523..ac5b5eaa 100644
--- a/src/drivers/dac.cpp
+++ b/src/drivers/dac.cpp
@@ -11,7 +11,7 @@
#include "esp_log.h"
#include "hal/i2c_types.h"
-namespace gay_ipod {
+namespace drivers {
static const char* kTag = "AUDIODAC";
static const uint8_t kPcm5122Address = 0x4C;
@@ -103,4 +103,4 @@ void AudioDac::WriteRegister(Register reg, uint8_t val) {
ESP_ERROR_CHECK(transaction.Execute());
}
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/display-init.cpp b/src/drivers/display-init.cpp
index e4545339..b958505d 100644
--- a/src/drivers/display-init.cpp
+++ b/src/drivers/display-init.cpp
@@ -1,6 +1,6 @@
#include "display-init.hpp"
-namespace gay_ipod {
+namespace drivers {
namespace displays {
/* Bit to use to signify we should delay after part of an init sequence */
@@ -100,4 +100,4 @@ const InitialisationData kST7735R = {
kST7735RCommonFooter}};
} // namespace displays
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/display.cpp b/src/drivers/display.cpp
index 8708436f..d59d61bc 100644
--- a/src/drivers/display.cpp
+++ b/src/drivers/display.cpp
@@ -41,7 +41,7 @@ static const int kDisplayBufferSize = (kDisplayWidth * kDisplayHeight) / 10;
DMA_ATTR static lv_color_t sBuffer1[kDisplayBufferSize];
DMA_ATTR static lv_color_t sBuffer2[kDisplayBufferSize];
-namespace gay_ipod {
+namespace drivers {
// Static functions for interrop with the LVGL display driver API, which
// requires a function pointer.
@@ -282,4 +282,4 @@ void Display::ServiceTransactions() {
}
}
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/gpio-expander.cpp b/src/drivers/gpio-expander.cpp
index 6b472d1c..b2490c8f 100644
--- a/src/drivers/gpio-expander.cpp
+++ b/src/drivers/gpio-expander.cpp
@@ -4,7 +4,7 @@
#include <cstdint>
-namespace gay_ipod {
+namespace drivers {
GpioExpander::GpioExpander() {
ports_ = pack(kPortADefault, kPortBDefault);
@@ -84,4 +84,4 @@ GpioExpander::SpiLock::~SpiLock() {
gpio_.with([&](auto& gpio) { gpio.set_pin(cs_, 1); });
}
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/i2c.cpp b/src/drivers/i2c.cpp
index d3bfaa59..d3378df6 100644
--- a/src/drivers/i2c.cpp
+++ b/src/drivers/i2c.cpp
@@ -4,7 +4,7 @@
#include "assert.h"
#include "driver/i2c.h"
-namespace gay_ipod {
+namespace drivers {
static constexpr int kCmdLinkSize = I2C_LINK_RECOMMENDED_SIZE(12);
@@ -48,4 +48,4 @@ I2CTransaction& I2CTransaction::read(uint8_t* dest, i2c_ack_type_t ack) {
return *this;
}
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/include/battery.hpp b/src/drivers/include/battery.hpp
index 399e866f..9358f9b0 100644
--- a/src/drivers/include/battery.hpp
+++ b/src/drivers/include/battery.hpp
@@ -4,7 +4,7 @@
#include "esp_err.h"
-namespace gay_ipod {
+namespace drivers {
esp_err_t init_adc(void);
@@ -13,4 +13,4 @@ esp_err_t init_adc(void);
*/
uint32_t read_battery_voltage(void);
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/include/dac.hpp b/src/drivers/include/dac.hpp
index 6d025384..b4e95ad4 100644
--- a/src/drivers/include/dac.hpp
+++ b/src/drivers/include/dac.hpp
@@ -8,7 +8,7 @@
#include "esp_err.h"
#include "result.hpp"
-namespace gay_ipod {
+namespace drivers {
/**
* Interface for a PCM5122PWR DAC, configured over I2C.
@@ -70,4 +70,4 @@ class AudioDac {
void WriteRegister(Register reg, uint8_t val);
};
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/include/display-init.hpp b/src/drivers/include/display-init.hpp
index f11e9b57..f7d287f7 100644
--- a/src/drivers/include/display-init.hpp
+++ b/src/drivers/include/display-init.hpp
@@ -2,7 +2,7 @@
#include <cstdint>
-namespace gay_ipod {
+namespace drivers {
namespace displays {
extern const uint8_t kDelayBit;
@@ -78,4 +78,4 @@ enum StCommands {
};
} // namespace displays
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/include/display.hpp b/src/drivers/include/display.hpp
index 2d6e9cd6..6caf1571 100644
--- a/src/drivers/include/display.hpp
+++ b/src/drivers/include/display.hpp
@@ -7,7 +7,7 @@
#include "lvgl/lvgl.h"
#include "result.hpp"
-namespace gay_ipod {
+namespace drivers {
/*
* Display driver for LVGL.
@@ -64,4 +64,4 @@ class Display {
uintptr_t flags = 0);
};
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/include/gpio-expander.hpp b/src/drivers/include/gpio-expander.hpp
index 2a12fba4..7ae0f107 100644
--- a/src/drivers/include/gpio-expander.hpp
+++ b/src/drivers/include/gpio-expander.hpp
@@ -13,7 +13,7 @@
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
-namespace gay_ipod {
+namespace drivers {
/**
* Wrapper for interfacing with the PCA8575 GPIO expander. Includes basic
@@ -205,4 +205,4 @@ class GpioExpander {
std::atomic<uint16_t> inputs_;
};
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/include/i2c.hpp b/src/drivers/include/i2c.hpp
index db554f5d..a4c71767 100644
--- a/src/drivers/include/i2c.hpp
+++ b/src/drivers/include/i2c.hpp
@@ -5,7 +5,7 @@
#include "driver/i2c.h"
#include "hal/i2c_types.h"
-namespace gay_ipod {
+namespace drivers {
/*
* Convenience wrapper for performing an I2C transaction with a reasonable
@@ -81,4 +81,4 @@ class I2CTransaction {
uint8_t* buffer_;
};
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/include/playback.hpp b/src/drivers/include/playback.hpp
index 493dd311..5fa7ab38 100644
--- a/src/drivers/include/playback.hpp
+++ b/src/drivers/include/playback.hpp
@@ -17,7 +17,7 @@
#include "mp3_decoder.h"
#include "result.hpp"
-namespace gay_ipod {
+namespace drivers {
class DacAudioPlayback {
public:
@@ -64,4 +64,4 @@ class DacAudioPlayback {
audio_element_handle_t mp3_decoder_;
};
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/include/storage.hpp b/src/drivers/include/storage.hpp
index cee49cc5..3aa2cb92 100644
--- a/src/drivers/include/storage.hpp
+++ b/src/drivers/include/storage.hpp
@@ -10,7 +10,7 @@
#include "esp_vfs_fat.h"
#include "result.hpp"
-namespace gay_ipod {
+namespace drivers {
extern const char* kStoragePath;
@@ -57,4 +57,4 @@ class SdStorage {
FATFS* fs_ = nullptr;
};
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/playback.cpp b/src/drivers/playback.cpp
index 46dec680..89b1f7e1 100644
--- a/src/drivers/playback.cpp
+++ b/src/drivers/playback.cpp
@@ -15,7 +15,7 @@
static const char* kTag = "PLAYBACK";
static const i2s_port_t kI2SPort = I2S_NUM_0;
-namespace gay_ipod {
+namespace drivers {
static audio_element_status_t status_from_the_void(void* status) {
uintptr_t as_pointer_int = reinterpret_cast<uintptr_t>(status);
@@ -243,4 +243,4 @@ auto DacAudioPlayback::volume() -> uint8_t {
return volume_;
}
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/drivers/storage.cpp b/src/drivers/storage.cpp
index 7fed6ed0..465c84ea 100644
--- a/src/drivers/storage.cpp
+++ b/src/drivers/storage.cpp
@@ -22,7 +22,7 @@
static const char* kTag = "SDSTORAGE";
static const uint8_t kMaxOpenFiles = 8;
-namespace gay_ipod {
+namespace drivers {
const char* kStoragePath = "/sdcard";
@@ -146,4 +146,4 @@ auto SdStorage::HandleTransaction(sdspi_dev_handle_t handle,
return do_transaction_(handle, cmdinfo);
}
-} // namespace gay_ipod
+} // namespace drivers
diff --git a/src/main/main.cpp b/src/main/main.cpp
index 8d989146..97be7de6 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -104,13 +104,13 @@ static StaticTask_t sLvglTaskBuffer = {};
static StackType_t sLvglStack[kLvglStackSize] = {0};
struct LvglArgs {
- gay_ipod::GpioExpander* gpio_expander;
+ drivers::GpioExpander* gpio_expander;
};
void lvgl_main(void* voidArgs) {
ESP_LOGI(TAG, "starting LVGL task");
LvglArgs* args = (LvglArgs*)voidArgs;
- gay_ipod::GpioExpander* gpio_expander = args->gpio_expander;
+ drivers::GpioExpander* gpio_expander = args->gpio_expander;
// Dispose of the args now that we've gotten everything out of them.
delete args;
@@ -123,12 +123,12 @@ void lvgl_main(void* voidArgs) {
ESP_LOGI(TAG, "init display");
auto display_res =
- gay_ipod::Display::create(gpio_expander, gay_ipod::displays::kST7735R);
+ drivers::Display::create(gpio_expander, drivers::displays::kST7735R);
if (display_res.has_error()) {
ESP_LOGE(TAG, "Failed: %d", display_res.error());
return;
}
- std::unique_ptr<gay_ipod::Display> display = std::move(display_res.value());
+ std::unique_ptr<drivers::Display> display = std::move(display_res.value());
auto label = lv_label_create(NULL);
lv_label_set_text(label, "g'day, cunts!");
@@ -151,38 +151,38 @@ extern "C" void app_main(void) {
ESP_ERROR_CHECK(gpio_install_isr_service(ESP_INTR_FLAG_LOWMED));
init_i2c();
init_spi();
- ESP_ERROR_CHECK(gay_ipod::init_adc());
+ ESP_ERROR_CHECK(drivers::init_adc());
ESP_LOGI(TAG, "Init GPIOs");
- gay_ipod::GpioExpander* expander = new gay_ipod::GpioExpander();
+ drivers::GpioExpander* expander = new drivers::GpioExpander();
// for debugging usb ic
- // expander.set_sd_mux(gay_ipod::GpioExpander::USB);
+ // expander.set_sd_mux(drivers::GpioExpander::USB);
/*
ESP_LOGI(TAG, "Init SD card");
- auto storage_res = gay_ipod::SdStorage::create(expander);
+ auto storage_res = drivers::SdStorage::create(expander);
if (storage_res.has_error()) {
ESP_LOGE(TAG, "Failed: %d", storage_res.error());
return;
}
- std::unique_ptr<gay_ipod::SdStorage> storage = std::move(storage_res.value());
+ std::unique_ptr<drivers::SdStorage> storage = std::move(storage_res.value());
ESP_LOGI(TAG, "Init DAC");
- auto dac_res = gay_ipod::AudioDac::create(expander);
+ auto dac_res = drivers::AudioDac::create(expander);
if (storage_res.has_error()) {
ESP_LOGE(TAG, "Failed: %d", dac_res.error());
return;
}
- std::unique_ptr<gay_ipod::AudioDac> dac = std::move(dac_res.value());
+ std::unique_ptr<drivers::AudioDac> dac = std::move(dac_res.value());
ESP_LOGI(TAG, "Init Audio Pipeline");
- auto playback_res = gay_ipod::DacAudioPlayback::create(dac.get());
+ auto playback_res = drivers::DacAudioPlayback::create(dac.get());
if (playback_res.has_error()) {
ESP_LOGE(TAG, "Failed: %d", playback_res.error());
return;
}
- std::unique_ptr<gay_ipod::DacAudioPlayback> playback =
+ std::unique_ptr<drivers::DacAudioPlayback> playback =
std::move(playback_res.value());
*/