Skip to content

Commit b9a0b9d

Browse files
committed
Applications: nrf5340_audio: defines cleanup
OCT-3419 Cleaned up defines with CONFIG_* names to avoid conflicts. Removed unused defines. Signed-off-by: Kristoffer Skøien <[email protected]>
1 parent ab6af6e commit b9a0b9d

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

applications/nrf5340_audio/src/audio/sw_codec_select.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
#include <zephyr/logging/log.h>
2020
LOG_MODULE_REGISTER(sw_codec_select, CONFIG_SW_CODEC_SELECT_LOG_LEVEL);
2121

22+
/* Used for debugging, inserts 0 instead of packet loss concealment */
23+
#define SW_CODEC_OVERRIDE_PLC false
24+
2225
static struct sw_codec_config m_config;
2326

2427
static struct sample_rate_converter_ctx encoder_converters[CONFIG_AUDIO_ENCODE_CHANNELS_MAX];
@@ -222,7 +225,7 @@ int sw_codec_decode(struct net_buf const *const audio_frame, void **decoded_data
222225

223226
switch (m_config.decoder.channel_mode) {
224227
case SW_CODEC_MONO: {
225-
if (meta->bad_data && IS_ENABLED(CONFIG_SW_CODEC_OVERRIDE_PLC)) {
228+
if (meta->bad_data && SW_CODEC_OVERRIDE_PLC) {
226229
memset(decoded_data_mono[0], 0, PCM_NUM_BYTES_MONO);
227230
decoded_data_size = PCM_NUM_BYTES_MONO;
228231
} else {
@@ -261,7 +264,7 @@ int sw_codec_decode(struct net_buf const *const audio_frame, void **decoded_data
261264
}
262265
case SW_CODEC_STEREO: {
263266

264-
if (meta->bad_data && IS_ENABLED(CONFIG_SW_CODEC_OVERRIDE_PLC)) {
267+
if (meta->bad_data && SW_CODEC_OVERRIDE_PLC) {
265268
memset(decoded_data_mono[0], 0, PCM_NUM_BYTES_MONO);
266269
memset(decoded_data_mono[1], 0, PCM_NUM_BYTES_MONO);
267270
decoded_data_size = PCM_NUM_BYTES_MONO;

applications/nrf5340_audio/src/bluetooth/bt_management/dfu/bt_mgmt_dfu.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
#include <zephyr/logging/log.h>
1919
LOG_MODULE_REGISTER(bt_mgmt_dfu, CONFIG_BT_MGMT_DFU_LOG_LEVEL);
2020

21-
/* These defined name only used by DFU */
22-
#define DEVICE_NAME_DFU CONFIG_BT_DFU_DEVICE_NAME
23-
#define DEVICE_NAME_DFU_LEN (sizeof(DEVICE_NAME_DFU) - 1)
24-
2521
static const struct bt_data ad_peer[] = {
2622
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
2723
BT_DATA_BYTES(BT_DATA_UUID128_ALL, 0x84, 0xaa, 0x60, 0x74, 0x52, 0x8a, 0x8b, 0x86, 0xd3,

applications/nrf5340_audio/src/modules/audio_i2s.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ static enum audio_i2s_state state = AUDIO_I2S_STATE_UNINIT;
2727
PINCTRL_DT_DEFINE(I2S_NL);
2828

2929
#if CONFIG_AUDIO_SAMPLE_RATE_16000_HZ
30-
#define CONFIG_AUDIO_RATIO NRF_I2S_RATIO_384X
30+
#define I2S_RATIO NRF_I2S_RATIO_384X
3131
#elif CONFIG_AUDIO_SAMPLE_RATE_24000_HZ
32-
#define CONFIG_AUDIO_RATIO NRF_I2S_RATIO_256X
32+
#define I2S_RATIO NRF_I2S_RATIO_256X
3333
#elif CONFIG_AUDIO_SAMPLE_RATE_48000_HZ
34-
#define CONFIG_AUDIO_RATIO NRF_I2S_RATIO_128X
34+
#define I2S_RATIO NRF_I2S_RATIO_128X
3535
#else
3636
#error "Current AUDIO_SAMPLE_RATE_HZ setting not supported"
3737
#endif
@@ -46,7 +46,7 @@ static nrfx_i2s_config_t cfg = {
4646
.mode = NRF_I2S_MODE_MASTER,
4747
.format = NRF_I2S_FORMAT_I2S,
4848
.alignment = NRF_I2S_ALIGN_LEFT,
49-
.ratio = CONFIG_AUDIO_RATIO,
49+
.ratio = I2S_RATIO,
5050
.mck_setup = 0x66666000,
5151
#if (CONFIG_AUDIO_BIT_DEPTH_16)
5252
.sample_width = NRF_I2S_SWIDTH_16BIT,

tests/subsys/audio/audio_module_template/src/template_test.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/* Define a timeout to prevent system locking */
1515
#define TEST_TX_RX_TIMEOUT_US (K_FOREVER)
1616

17-
#define CONFIG_TEXT "Template config"
17+
#define ORIGINAL_TEXT "Template config"
1818
#define RECONFIG_TEXT "Template reconfig"
1919

2020
#define TEST_MSG_QUEUE_SIZE (4)
@@ -78,7 +78,7 @@ ZTEST(suite_audio_module_template, test_module_template)
7878
struct audio_module_parameters mod_parameters;
7979

8080
struct audio_module_template_configuration configuration = {
81-
.sample_rate_hz = 48000, .bit_depth = 24, .module_description = CONFIG_TEXT};
81+
.sample_rate_hz = 48000, .bit_depth = 24, .module_description = ORIGINAL_TEXT};
8282
struct audio_module_template_configuration reconfiguration = {
8383
.sample_rate_hz = 16000, .bit_depth = 8, .module_description = RECONFIG_TEXT};
8484
struct audio_module_template_configuration return_configuration;
@@ -114,7 +114,7 @@ ZTEST(suite_audio_module_template, test_module_template)
114114
zassert_equal(test_config->sample_rate_hz, configuration.sample_rate_hz,
115115
"Failed to configure module in the open function");
116116
zassert_mem_equal(test_config->module_description, configuration.module_description,
117-
sizeof(CONFIG_TEXT),
117+
sizeof(ORIGINAL_TEXT),
118118
"Failed to configure module in the open function");
119119
}
120120

@@ -146,7 +146,7 @@ ZTEST(suite_audio_module_template, test_module_template)
146146
zassert_equal(return_configuration.sample_rate_hz, configuration.sample_rate_hz,
147147
"Failed to get configuration");
148148
zassert_mem_equal(return_configuration.module_description, configuration.module_description,
149-
sizeof(CONFIG_TEXT), "Failed to get configuration");
149+
sizeof(ORIGINAL_TEXT), "Failed to get configuration");
150150

151151
ret = audio_module_connect(&handle, NULL, true);
152152
zassert_equal(ret, 0, "Connect function did not return successfully (0): ret %d", ret);
@@ -234,7 +234,7 @@ ZTEST(suite_audio_module_template, test_module_template_stream)
234234
struct audio_module_parameters mod_parameters;
235235

236236
struct audio_module_template_configuration configuration = {
237-
.sample_rate_hz = 48000, .bit_depth = 16, .module_description = CONFIG_TEXT};
237+
.sample_rate_hz = 48000, .bit_depth = 16, .module_description = ORIGINAL_TEXT};
238238

239239
struct audio_module_template_context context = {0};
240240

0 commit comments

Comments
 (0)