From 58ed7b1e109d0ed8214c338cf3bfd1816ed816ea Mon Sep 17 00:00:00 2001 From: jacqueline Date: Mon, 24 Oct 2022 14:18:11 +1100 Subject: [PATCH] clang-format --- main/dac.hpp | 2 +- main/gay-ipod-fw.cpp | 4 ++-- main/gpio-expander.hpp | 2 +- main/i2c.cpp | 2 +- main/i2c.hpp | 2 +- main/playback.cpp | 35 +++++++++++++++++++---------------- main/playback.hpp | 2 +- 7 files changed, 26 insertions(+), 23 deletions(-) diff --git a/main/dac.hpp b/main/dac.hpp index 68d4c21a..6d025384 100644 --- a/main/dac.hpp +++ b/main/dac.hpp @@ -2,8 +2,8 @@ #include "gpio-expander.hpp" -#include #include +#include #include "esp_err.h" #include "result.hpp" diff --git a/main/gay-ipod-fw.cpp b/main/gay-ipod-fw.cpp index ffbdea62..b55c61da 100644 --- a/main/gay-ipod-fw.cpp +++ b/main/gay-ipod-fw.cpp @@ -4,10 +4,10 @@ #include "playback.hpp" #include "storage.hpp" -#include #include -#include #include +#include +#include #include "audio_common.h" #include "audio_element.h" diff --git a/main/gpio-expander.hpp b/main/gpio-expander.hpp index 089aac42..2a12fba4 100644 --- a/main/gpio-expander.hpp +++ b/main/gpio-expander.hpp @@ -1,9 +1,9 @@ #pragma once +#include #include #include #include -#include #include #include diff --git a/main/i2c.cpp b/main/i2c.cpp index 65ed9012..d3bfaa59 100644 --- a/main/i2c.cpp +++ b/main/i2c.cpp @@ -10,7 +10,7 @@ static constexpr int kCmdLinkSize = I2C_LINK_RECOMMENDED_SIZE(12); I2CTransaction::I2CTransaction() { // Use a fixed size buffer to avoid many many tiny allocations. - buffer_ = (uint8_t*) calloc(sizeof(uint8_t), kCmdLinkSize); + buffer_ = (uint8_t*)calloc(sizeof(uint8_t), kCmdLinkSize); handle_ = i2c_cmd_link_create_static(buffer_, kCmdLinkSize); assert(handle_ != NULL && "failed to create command link"); } diff --git a/main/i2c.hpp b/main/i2c.hpp index 0993a305..db554f5d 100644 --- a/main/i2c.hpp +++ b/main/i2c.hpp @@ -78,7 +78,7 @@ class I2CTransaction { private: i2c_cmd_handle_t handle_; - uint8_t *buffer_; + uint8_t* buffer_; }; } // namespace gay_ipod diff --git a/main/playback.cpp b/main/playback.cpp index 401dc9a3..46dec680 100644 --- a/main/playback.cpp +++ b/main/playback.cpp @@ -17,7 +17,7 @@ static const i2s_port_t kI2SPort = I2S_NUM_0; namespace gay_ipod { -static audio_element_status_t status_from_the_void(void *status) { +static audio_element_status_t status_from_the_void(void* status) { uintptr_t as_pointer_int = reinterpret_cast(status); return static_cast(as_pointer_int); } @@ -182,39 +182,42 @@ void DacAudioPlayback::Pause() { void DacAudioPlayback::ProcessEvents() { while (1) { audio_event_iface_msg_t event; - esp_err_t err = audio_event_iface_listen(event_interface_, &event, portMAX_DELAY); + esp_err_t err = + audio_event_iface_listen(event_interface_, &event, portMAX_DELAY); if (err != ESP_OK) { ESP_LOGI(kTag, "error listening for event:%x", err); continue; } ESP_LOGI(kTag, "received event, cmd %i", event.cmd); - if (event.source_type == AUDIO_ELEMENT_TYPE_ELEMENT - && event.source == (void *) mp3_decoder_ - && event.cmd == AEL_MSG_CMD_REPORT_MUSIC_INFO) { + if (event.source_type == AUDIO_ELEMENT_TYPE_ELEMENT && + event.source == (void*)mp3_decoder_ && + event.cmd == AEL_MSG_CMD_REPORT_MUSIC_INFO) { audio_element_info_t music_info = {0}; audio_element_getinfo(mp3_decoder_, &music_info); - ESP_LOGI(kTag, "sample_rate=%d, bits=%d, ch=%d", music_info.sample_rates, music_info.bits, music_info.channels); + ESP_LOGI(kTag, "sample_rate=%d, bits=%d, ch=%d", music_info.sample_rates, + music_info.bits, music_info.channels); audio_element_setinfo(i2s_stream_writer_, &music_info); - i2s_stream_set_clk(i2s_stream_writer_, music_info.sample_rates, music_info.bits, music_info.channels); + i2s_stream_set_clk(i2s_stream_writer_, music_info.sample_rates, + music_info.bits, music_info.channels); } - if (event.source_type == AUDIO_ELEMENT_TYPE_ELEMENT - && event.source == (void *) fatfs_stream_reader_ - && event.cmd == AEL_MSG_CMD_REPORT_STATUS) { + if (event.source_type == AUDIO_ELEMENT_TYPE_ELEMENT && + event.source == (void*)fatfs_stream_reader_ && + event.cmd == AEL_MSG_CMD_REPORT_STATUS) { audio_element_status_t status = status_from_the_void(event.data); if (status == AEL_STATUS_STATE_FINISHED) { - // TODO: enqueue next track? + // TODO: enqueue next track? } } - if (event.source_type == AUDIO_ELEMENT_TYPE_ELEMENT - && event.source == (void *) i2s_stream_writer_ - && event.cmd == AEL_MSG_CMD_REPORT_STATUS) { + if (event.source_type == AUDIO_ELEMENT_TYPE_ELEMENT && + event.source == (void*)i2s_stream_writer_ && + event.cmd == AEL_MSG_CMD_REPORT_STATUS) { audio_element_status_t status = status_from_the_void(event.data); if (status == AEL_STATUS_STATE_FINISHED) { - // TODO. - return; + // TODO. + return; } } diff --git a/main/playback.hpp b/main/playback.hpp index 88336105..493dd311 100644 --- a/main/playback.hpp +++ b/main/playback.hpp @@ -13,9 +13,9 @@ #include "audio_pipeline.h" #include "esp_err.h" #include "fatfs_stream.h" -#include "result.hpp" #include "i2s_stream.h" #include "mp3_decoder.h" +#include "result.hpp" namespace gay_ipod {