summaryrefslogtreecommitdiff
path: root/src/drivers/include/dac.hpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-01-21 19:01:54 +1100
committerjacqueline <me@jacqueline.id.au>2023-01-21 19:01:54 +1100
commit8ed3d7e31f8b16a24593c01a480b19b14a513b48 (patch)
treef055abec7631f9682396ad5c3f125824d76cc95e /src/drivers/include/dac.hpp
parentc7901ae4297d42d55bb3a06010198ecf14b3a7ba (diff)
downloadtangara-fw-8ed3d7e31f8b16a24593c01a480b19b14a513b48.tar.gz
Re-enable the parts of the audio pipeline that are working
Diffstat (limited to 'src/drivers/include/dac.hpp')
-rw-r--r--src/drivers/include/dac.hpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/drivers/include/dac.hpp b/src/drivers/include/dac.hpp
index 2d4e812f..8c49ce17 100644
--- a/src/drivers/include/dac.hpp
+++ b/src/drivers/include/dac.hpp
@@ -3,13 +3,15 @@
#include <stdint.h>
#include <functional>
+#include <memory>
+#include <utility>
+#include "driver/i2s_types.h"
#include "esp_err.h"
#include "freertos/portmacro.h"
-#include "hal/i2s_types.h"
#include "result.hpp"
#include "span.hpp"
-#include "driver/i2s_types_legacy.h"
+#include "driver/i2s_std.h"
#include "gpio_expander.hpp"
@@ -29,7 +31,7 @@ class AudioDac {
static auto create(GpioExpander* expander)
-> cpp::result<std::unique_ptr<AudioDac>, Error>;
- AudioDac(GpioExpander* gpio);
+ AudioDac(GpioExpander* gpio, i2s_chan_handle_t i2s_handle);
~AudioDac();
/**
@@ -54,9 +56,9 @@ class AudioDac {
std::pair<bool, PowerState> ReadPowerState();
enum BitsPerSample {
- BPS_16 = I2S_BITS_PER_SAMPLE_16BIT,
- BPS_24 = I2S_BITS_PER_SAMPLE_24BIT,
- BPS_32 = I2S_BITS_PER_SAMPLE_32BIT
+ BPS_16 = I2S_DATA_BIT_WIDTH_16BIT,
+ BPS_24 = I2S_DATA_BIT_WIDTH_24BIT,
+ BPS_32 = I2S_DATA_BIT_WIDTH_32BIT,
};
enum SampleRate {
SAMPLE_RATE_44_1 = 44100,
@@ -75,6 +77,10 @@ class AudioDac {
private:
GpioExpander* gpio_;
+ i2s_chan_handle_t i2s_handle_;
+
+ i2s_std_clk_config_t clock_config_;
+ i2s_std_slot_config_t slot_config_;
/*
* Pools the power state for up to 10ms, waiting for the given predicate to