diff --git a/applications/nrf5340_audio/src/audio/audio_datapath.c b/applications/nrf5340_audio/src/audio/audio_datapath.c index e487f5c8558..d68de9c0b38 100644 --- a/applications/nrf5340_audio/src/audio/audio_datapath.c +++ b/applications/nrf5340_audio/src/audio/audio_datapath.c @@ -15,7 +15,6 @@ #include "nrf5340_audio_common.h" #include "macros_common.h" -#include "board.h" #include "led.h" #include "audio_i2s.h" #include "sw_codec_select.h" @@ -42,23 +41,23 @@ LOG_MODULE_REGISTER(audio_datapath, CONFIG_AUDIO_DATAPATH_LOG_LEVEL); /* Total sample FIFO period in microseconds */ #define FIFO_SMPL_PERIOD_US (CONFIG_AUDIO_MAX_PRES_DLY_US * 2) -#define FIFO_NUM_BLKS NUM_BLKS(FIFO_SMPL_PERIOD_US) -#define MAX_FIFO_SIZE (FIFO_NUM_BLKS * BLK_SIZE_SAMPLES(CONFIG_AUDIO_SAMPLE_RATE_HZ) * 2) +#define FIFO_NUM_BLKS NUM_BLKS(FIFO_SMPL_PERIOD_US) +#define MAX_FIFO_SIZE (FIFO_NUM_BLKS * BLK_SIZE_SAMPLES(CONFIG_AUDIO_SAMPLE_RATE_HZ) * 2) /* Number of audio blocks given a duration */ -#define NUM_BLKS(d) ((d) / BLK_PERIOD_US) +#define NUM_BLKS(d) ((d) / BLK_PERIOD_US) /* Single audio block size in number of samples (stereo) */ #define BLK_SIZE_SAMPLES(r) (((r)*BLK_PERIOD_US) / 1000000) /* Increment sample FIFO index by one block */ -#define NEXT_IDX(i) (((i) < (FIFO_NUM_BLKS - 1)) ? ((i) + 1) : 0) +#define NEXT_IDX(i) (((i) < (FIFO_NUM_BLKS - 1)) ? ((i) + 1) : 0) /* Decrement sample FIFO index by one block */ -#define PREV_IDX(i) (((i) > 0) ? ((i)-1) : (FIFO_NUM_BLKS - 1)) +#define PREV_IDX(i) (((i) > 0) ? ((i)-1) : (FIFO_NUM_BLKS - 1)) -#define NUM_BLKS_IN_FRAME NUM_BLKS(CONFIG_AUDIO_FRAME_DURATION_US) -#define BLK_MONO_NUM_SAMPS BLK_SIZE_SAMPLES(CONFIG_AUDIO_SAMPLE_RATE_HZ) -#define BLK_STEREO_NUM_SAMPS (BLK_MONO_NUM_SAMPS * 2) +#define NUM_BLKS_IN_FRAME NUM_BLKS(CONFIG_AUDIO_FRAME_DURATION_US) +#define BLK_MONO_NUM_SAMPS BLK_SIZE_SAMPLES(CONFIG_AUDIO_SAMPLE_RATE_HZ) +#define BLK_STEREO_NUM_SAMPS (BLK_MONO_NUM_SAMPS * 2) /* Number of octets in a single audio block */ -#define BLK_MONO_SIZE_OCTETS (BLK_MONO_NUM_SAMPS * CONFIG_AUDIO_BIT_DEPTH_OCTETS) +#define BLK_MONO_SIZE_OCTETS (BLK_MONO_NUM_SAMPS * CONFIG_AUDIO_BIT_DEPTH_OCTETS) #define BLK_STEREO_SIZE_OCTETS (BLK_MONO_SIZE_OCTETS * 2) /* How many function calls before moving on with drift compensation */ #define DRIFT_COMP_WAITING_CNT (DRIFT_MEAS_PERIOD_US / BLK_PERIOD_US) @@ -67,27 +66,27 @@ LOG_MODULE_REGISTER(audio_datapath, CONFIG_AUDIO_DATAPATH_LOG_LEVEL); /* Audio clock - nRF5340 Analog Phase-Locked Loop (APLL) */ #define APLL_FREQ_CENTER 39854 -#define APLL_FREQ_MIN 36834 -#define APLL_FREQ_MAX 42874 +#define APLL_FREQ_MIN 36834 +#define APLL_FREQ_MAX 42874 /* Use nanoseconds to reduce rounding errors */ #define APLL_FREQ_ADJ(t) (-((t)*1000) / 331) -#define DRIFT_MEAS_PERIOD_US 100000 -#define DRIFT_ERR_THRESH_LOCK 16 +#define DRIFT_MEAS_PERIOD_US 100000 +#define DRIFT_ERR_THRESH_LOCK 16 #define DRIFT_ERR_THRESH_UNLOCK 32 /* 3000 us to allow BLE transmission and (host -> HCI -> controller) */ -#define JUST_IN_TIME_US (CONFIG_AUDIO_FRAME_DURATION_US - 3000) +#define JUST_IN_TIME_US (CONFIG_AUDIO_FRAME_DURATION_US - 3000) #define JUST_IN_TIME_THRESHOLD_US 1500 /* How often to print underrun warning */ #define UNDERRUN_LOG_INTERVAL_BLKS 5000 enum drift_comp_state { - DRIFT_STATE_INIT, /* Waiting for data to be received */ - DRIFT_STATE_CALIB, /* Calibrate and zero out local delay */ + DRIFT_STATE_INIT, /* Waiting for data to be received */ + DRIFT_STATE_CALIB, /* Calibrate and zero out local delay */ DRIFT_STATE_OFFSET, /* Adjust I2S offset relative to SDU Reference */ - DRIFT_STATE_LOCKED /* Drift compensation locked - Minor corrections */ + DRIFT_STATE_LOCKED /* Drift compensation locked - Minor corrections */ }; static const char *const drift_comp_state_names[] = { @@ -98,9 +97,9 @@ static const char *const drift_comp_state_names[] = { }; enum pres_comp_state { - PRES_STATE_INIT, /* Initialize presentation compensation */ - PRES_STATE_MEAS, /* Measure presentation delay */ - PRES_STATE_WAIT, /* Wait for some time */ + PRES_STATE_INIT, /* Initialize presentation compensation */ + PRES_STATE_MEAS, /* Measure presentation delay */ + PRES_STATE_WAIT, /* Wait for some time */ PRES_STATE_LOCKED /* Presentation compensation locked */ }; @@ -137,7 +136,7 @@ static struct { uint32_t current_pres_dly_us; struct { - enum drift_comp_state state : 8; + enum drift_comp_state state: 8; uint16_t ctr; /* Count func calls. Used for waiting */ uint32_t meas_start_time_us; uint32_t center_freq; @@ -145,7 +144,7 @@ static struct { } drift_comp; struct { - enum pres_comp_state state : 8; + enum pres_comp_state state: 8; uint16_t ctr; /* Count func calls. Used for collecting data points and waiting */ int32_t sum_err_dly_us; uint32_t pres_delay_us; @@ -1071,24 +1070,23 @@ static int cmd_audio_pres_comp_disable(const struct shell *shell, size_t argc, c return 0; } -SHELL_STATIC_SUBCMD_SET_CREATE( - test_cmd, - SHELL_COND_CMD(CONFIG_SHELL, nrf_tone_start, NULL, "Start local tone from nRF5340", - cmd_i2s_tone_play), - SHELL_COND_CMD(CONFIG_SHELL, nrf_tone_stop, NULL, "Stop local tone from nRF5340", - cmd_i2s_tone_stop), - SHELL_COND_CMD(CONFIG_SHELL, pll_drift_comp_enable, NULL, - "Enable audio PLL auto drift compensation (default)", - cmd_hfclkaudio_drift_comp_enable), - SHELL_COND_CMD(CONFIG_SHELL, pll_drift_comp_disable, NULL, - "Disable audio PLL auto drift compensation", - cmd_hfclkaudio_drift_comp_disable), - SHELL_COND_CMD(CONFIG_SHELL, pll_pres_comp_enable, NULL, - "Enable audio presentation compensation (default)", - cmd_audio_pres_comp_enable), - SHELL_COND_CMD(CONFIG_SHELL, pll_pres_comp_disable, NULL, - "Disable audio presentation compensation", - cmd_audio_pres_comp_disable), - SHELL_SUBCMD_SET_END); +SHELL_STATIC_SUBCMD_SET_CREATE(test_cmd, + SHELL_COND_CMD(CONFIG_SHELL, nrf_tone_start, NULL, + "Start local tone from nRF5340", cmd_i2s_tone_play), + SHELL_COND_CMD(CONFIG_SHELL, nrf_tone_stop, NULL, + "Stop local tone from nRF5340", cmd_i2s_tone_stop), + SHELL_COND_CMD(CONFIG_SHELL, pll_drift_comp_enable, NULL, + "Enable audio PLL auto drift compensation (default)", + cmd_hfclkaudio_drift_comp_enable), + SHELL_COND_CMD(CONFIG_SHELL, pll_drift_comp_disable, NULL, + "Disable audio PLL auto drift compensation", + cmd_hfclkaudio_drift_comp_disable), + SHELL_COND_CMD(CONFIG_SHELL, pll_pres_comp_enable, NULL, + "Enable audio presentation compensation (default)", + cmd_audio_pres_comp_enable), + SHELL_COND_CMD(CONFIG_SHELL, pll_pres_comp_disable, NULL, + "Disable audio presentation compensation", + cmd_audio_pres_comp_disable), + SHELL_SUBCMD_SET_END); SHELL_CMD_REGISTER(test, &test_cmd, "Test mode commands", NULL); diff --git a/applications/nrf5340_audio/src/audio/audio_system.c b/applications/nrf5340_audio/src/audio/audio_system.c index b2a763de2b8..4e01e17d0b8 100644 --- a/applications/nrf5340_audio/src/audio/audio_system.c +++ b/applications/nrf5340_audio/src/audio/audio_system.c @@ -14,7 +14,6 @@ #include "audio_datapath.h" #include "audio_i2s.h" #include "data_fifo.h" -#include "led.h" #include "hw_codec.h" #include "tone.h" #include "contin_array.h" @@ -303,11 +302,10 @@ void audio_system_start(void) sw_codec_cfg.initialized = true; if (sw_codec_cfg.encoder.enabled && encoder_thread_id == NULL) { - encoder_thread_id = - k_thread_create(&encoder_thread_data, encoder_thread_stack, - CONFIG_ENCODER_STACK_SIZE, (k_thread_entry_t)encoder_thread, - NULL, NULL, NULL, - K_PRIO_PREEMPT(CONFIG_ENCODER_THREAD_PRIO), 0, K_NO_WAIT); + encoder_thread_id = k_thread_create( + &encoder_thread_data, encoder_thread_stack, CONFIG_ENCODER_STACK_SIZE, + (k_thread_entry_t)encoder_thread, NULL, NULL, NULL, + K_PRIO_PREEMPT(CONFIG_ENCODER_THREAD_PRIO), 0, K_NO_WAIT); ret = k_thread_name_set(encoder_thread_id, "ENCODER"); ERR_CHK(ret); } diff --git a/applications/nrf5340_audio/src/audio/streamctrl.c b/applications/nrf5340_audio/src/audio/streamctrl.c index b7cb4fa9250..19fa9db85db 100644 --- a/applications/nrf5340_audio/src/audio/streamctrl.c +++ b/applications/nrf5340_audio/src/audio/streamctrl.c @@ -23,7 +23,6 @@ #include "audio_system.h" #include "button_handler.h" #include "data_fifo.h" -#include "board.h" #include "le_audio.h" #include "bt_mgmt.h" #include "bt_rend.h" diff --git a/applications/nrf5340_audio/src/audio/sw_codec_select.c b/applications/nrf5340_audio/src/audio/sw_codec_select.c index d1aff99ca0e..19f95950fcf 100644 --- a/applications/nrf5340_audio/src/audio/sw_codec_select.c +++ b/applications/nrf5340_audio/src/audio/sw_codec_select.c @@ -23,7 +23,7 @@ static struct sw_codec_config m_config; int sw_codec_encode(void *pcm_data, size_t pcm_size, uint8_t **encoded_data, size_t *encoded_size) { /* Temp storage for split stereo PCM signal */ - char pcm_data_mono[AUDIO_CH_NUM][PCM_NUM_BYTES_MONO] = { 0 }; + char pcm_data_mono[AUDIO_CH_NUM][PCM_NUM_BYTES_MONO] = {0}; /* Make sure we have enough space for two frames (stereo) */ static uint8_t m_encoded_data[ENC_MAX_FRAME_SIZE * AUDIO_CH_NUM]; @@ -109,7 +109,7 @@ int sw_codec_decode(uint8_t const *const encoded_data, size_t encoded_size, bool } int ret; - char pcm_data_mono[PCM_NUM_BYTES_MONO] = { 0 }; + char pcm_data_mono[PCM_NUM_BYTES_MONO] = {0}; static char pcm_data_stereo[PCM_NUM_BYTES_STEREO]; size_t pcm_size_stereo = 0; @@ -119,7 +119,7 @@ int sw_codec_decode(uint8_t const *const encoded_data, size_t encoded_size, bool case SW_CODEC_LC3: { #if (CONFIG_SW_CODEC_LC3) /* Typically used for right channel if stereo signal */ - char pcm_data_mono_right[PCM_NUM_BYTES_MONO] = { 0 }; + char pcm_data_mono_right[PCM_NUM_BYTES_MONO] = {0}; switch (m_config.decoder.num_ch) { case SW_CODEC_MONO: { @@ -127,10 +127,9 @@ int sw_codec_decode(uint8_t const *const encoded_data, size_t encoded_size, bool memset(pcm_data_mono, 0, PCM_NUM_BYTES_MONO); pcm_size_session = PCM_NUM_BYTES_MONO; } else { - ret = sw_codec_lc3_dec_run(encoded_data, encoded_size, - LC3_PCM_NUM_BYTES_MONO, 0, pcm_data_mono, - (uint16_t *)&pcm_size_session, - bad_frame); + ret = sw_codec_lc3_dec_run( + encoded_data, encoded_size, LC3_PCM_NUM_BYTES_MONO, 0, + pcm_data_mono, (uint16_t *)&pcm_size_session, bad_frame); if (ret) { return ret; } @@ -155,20 +154,18 @@ int sw_codec_decode(uint8_t const *const encoded_data, size_t encoded_size, bool pcm_size_session = PCM_NUM_BYTES_MONO; } else { /* Decode left channel */ - ret = sw_codec_lc3_dec_run(encoded_data, encoded_size / 2, - LC3_PCM_NUM_BYTES_MONO, AUDIO_CH_L, - pcm_data_mono, - (uint16_t *)&pcm_size_session, - bad_frame); + ret = sw_codec_lc3_dec_run( + encoded_data, encoded_size / 2, LC3_PCM_NUM_BYTES_MONO, + AUDIO_CH_L, pcm_data_mono, (uint16_t *)&pcm_size_session, + bad_frame); if (ret) { return ret; } /* Decode right channel */ - ret = sw_codec_lc3_dec_run((encoded_data + (encoded_size / 2)), - encoded_size / 2, LC3_PCM_NUM_BYTES_MONO, - AUDIO_CH_R, pcm_data_mono_right, - (uint16_t *)&pcm_size_session, - bad_frame); + ret = sw_codec_lc3_dec_run( + (encoded_data + (encoded_size / 2)), encoded_size / 2, + LC3_PCM_NUM_BYTES_MONO, AUDIO_CH_R, pcm_data_mono_right, + (uint16_t *)&pcm_size_session, bad_frame); if (ret) { return ret; } @@ -288,19 +285,19 @@ int sw_codec_init(struct sw_codec_config sw_codec_cfg) CONFIG_AUDIO_SAMPLE_RATE_HZ, CONFIG_AUDIO_BIT_DEPTH_BITS, CONFIG_AUDIO_FRAME_DURATION_US, sw_codec_cfg.decoder.num_ch); - ret = sw_codec_lc3_dec_init(CONFIG_AUDIO_SAMPLE_RATE_HZ, - CONFIG_AUDIO_BIT_DEPTH_BITS, - CONFIG_AUDIO_FRAME_DURATION_US, - sw_codec_cfg.decoder.num_ch); + ret = sw_codec_lc3_dec_init( + CONFIG_AUDIO_SAMPLE_RATE_HZ, CONFIG_AUDIO_BIT_DEPTH_BITS, + CONFIG_AUDIO_FRAME_DURATION_US, sw_codec_cfg.decoder.num_ch); if (ret) { return ret; } } break; -#endif /* (CONFIG_SW_CODEC_LC3) */ +#else LOG_ERR("LC3 is not compiled in, please open menuconfig and select LC3"); return -ENODEV; +#endif /* (CONFIG_SW_CODEC_LC3) */ } default: LOG_ERR("Unsupported codec: %d", sw_codec_cfg.sw_codec); diff --git a/applications/nrf5340_audio/src/bluetooth/bt_management/advertising/bt_mgmt_adv.c b/applications/nrf5340_audio/src/bluetooth/bt_management/advertising/bt_mgmt_adv.c index 046b78f27cf..a9bbc683d91 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_management/advertising/bt_mgmt_adv.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_management/advertising/bt_mgmt_adv.c @@ -52,6 +52,11 @@ static void bond_find(const struct bt_bond_info *info, void *user_data) struct bt_conn_info conn_info; ret = bt_conn_get_info(conn, &conn_info); + if (ret) { + LOG_WRN("Could not get conn info"); + bt_conn_unref(conn); + return; + } if (conn_info.state == BT_CONN_STATE_CONNECTED) { LOG_WRN("Already connected"); diff --git a/applications/nrf5340_audio/src/bluetooth/bt_management/bt_mgmt.c b/applications/nrf5340_audio/src/bluetooth/bt_management/bt_mgmt.c index f76289e9aec..7aa80bef2ff 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_management/bt_mgmt.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_management/bt_mgmt.c @@ -74,7 +74,7 @@ static void conn_state_connected_check(struct bt_conn *conn, void *data) static void connected_cb(struct bt_conn *conn, uint8_t err) { int ret; - char addr[BT_ADDR_LE_STR_LEN]; + char addr[BT_ADDR_LE_STR_LEN] = {0}; uint8_t num_conn = 0; uint16_t conn_handle; enum ble_hci_vs_tx_power conn_tx_pwr; diff --git a/applications/nrf5340_audio/src/bluetooth/bt_management/dfu/bt_mgmt_dfu.c b/applications/nrf5340_audio/src/bluetooth/bt_management/dfu/bt_mgmt_dfu.c index 733024b25f3..beea9a45570 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_management/dfu/bt_mgmt_dfu.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_management/dfu/bt_mgmt_dfu.c @@ -11,11 +11,8 @@ #include #include #include -#include #include "string.h" -#include "button_assignments.h" -#include "button_handler.h" #include "macros_common.h" #include "channel_assignment.h" diff --git a/applications/nrf5340_audio/src/bluetooth/bt_renderer/volume/bt_rend_vol.c b/applications/nrf5340_audio/src/bluetooth/bt_renderer/volume/bt_rend_vol.c index ceb01cdb880..40d0d37e1fb 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_renderer/volume/bt_rend_vol.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_renderer/volume/bt_rend_vol.c @@ -244,9 +244,9 @@ int bt_rend_vol_down(void) i, ret); } } - - return 0; } + + return 0; } else if (IS_ENABLED(CONFIG_BT_VCP_VOL_REND)) { return bt_vcp_vol_rend_unmute_vol_down(); } diff --git a/applications/nrf5340_audio/src/bluetooth/le_audio_cis_gateway.c b/applications/nrf5340_audio/src/bluetooth/le_audio_cis_gateway.c index 8c448f75a67..85121763db7 100644 --- a/applications/nrf5340_audio/src/bluetooth/le_audio_cis_gateway.c +++ b/applications/nrf5340_audio/src/bluetooth/le_audio_cis_gateway.c @@ -19,7 +19,6 @@ #include "macros_common.h" #include "nrf5340_audio_common.h" -#include "channel_assignment.h" #include LOG_MODULE_REGISTER(cis_gateway, CONFIG_BLE_LOG_LEVEL); @@ -375,7 +374,7 @@ static void pac_record_cb(struct bt_conn *conn, enum bt_audio_dir dir, const str } /* num_caps is an increasing index that starts at 0 */ - if (temp_cap[temp_cap_index].num_caps <= ARRAY_SIZE(temp_cap[temp_cap_index].codec)) { + if (temp_cap[temp_cap_index].num_caps < ARRAY_SIZE(temp_cap[temp_cap_index].codec)) { struct bt_codec *codec_loc = &temp_cap[temp_cap_index].codec[temp_cap[temp_cap_index].num_caps]; @@ -1017,7 +1016,7 @@ static int discover_source(struct bt_conn *conn) return ret; } -static int iso_stream_send(uint8_t const *const data, size_t size, struct le_audio_headset headset) +static int iso_stream_send(uint8_t const *const data, size_t size, struct le_audio_headset *headset) { int ret; struct net_buf *buf; @@ -1030,18 +1029,18 @@ static int iso_stream_send(uint8_t const *const data, size_t size, struct le_aud * Data will be discarded if allocation becomes too high, to avoid audio delays. * If the NET and APP core operates in clock sync, discarding should not occur. */ - if (atomic_get(&headset.iso_tx_pool_alloc) >= HCI_ISO_BUF_ALLOC_PER_CHAN) { - if (!headset.hci_wrn_printed) { - LOG_WRN("HCI ISO TX overrun on %s ch - Single print", headset.ch_name); - headset.hci_wrn_printed = true; + if (atomic_get(&headset->iso_tx_pool_alloc) >= HCI_ISO_BUF_ALLOC_PER_CHAN) { + if (!headset->hci_wrn_printed) { + LOG_WRN("HCI ISO TX overrun on %s ch - Single print", headset->ch_name); + headset->hci_wrn_printed = true; } return -ENOMEM; } - headset.hci_wrn_printed = false; + headset->hci_wrn_printed = false; - buf = net_buf_alloc(headset.iso_tx_pool, K_NO_WAIT); + buf = net_buf_alloc(headset->iso_tx_pool, K_NO_WAIT); if (buf == NULL) { /* This should never occur because of the iso_tx_pool_alloc check above */ LOG_WRN("Out of TX buffers"); @@ -1051,14 +1050,15 @@ static int iso_stream_send(uint8_t const *const data, size_t size, struct le_aud net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE); net_buf_add_mem(buf, data, size); - atomic_inc(&headset.iso_tx_pool_alloc); + atomic_inc(&headset->iso_tx_pool_alloc); - ret = bt_bap_stream_send(&headset.sink_stream, buf, - get_and_incr_seq_num(&headset.sink_stream), BT_ISO_TIMESTAMP_NONE); + ret = bt_bap_stream_send(&headset->sink_stream, buf, + get_and_incr_seq_num(&headset->sink_stream), + BT_ISO_TIMESTAMP_NONE); if (ret < 0) { - LOG_WRN("Failed to send audio data to %s: %d", headset.ch_name, ret); + LOG_WRN("Failed to send audio data to %s: %d", headset->ch_name, ret); net_buf_unref(buf); - atomic_dec(&headset.iso_tx_pool_alloc); + atomic_dec(&headset->iso_tx_pool_alloc); } return 0; @@ -1345,7 +1345,7 @@ int le_audio_send(struct encoded_audio enc_audio) } if (ep_state_check(headsets[AUDIO_CH_L].sink_stream.ep, BT_BAP_EP_STATE_STREAMING)) { - ret = iso_stream_send(enc_audio.data, data_size_pr_stream, headsets[AUDIO_CH_L]); + ret = iso_stream_send(enc_audio.data, data_size_pr_stream, &headsets[AUDIO_CH_L]); if (ret) { LOG_DBG("Failed to send data to left channel"); } @@ -1354,10 +1354,10 @@ int le_audio_send(struct encoded_audio enc_audio) if (ep_state_check(headsets[AUDIO_CH_R].sink_stream.ep, BT_BAP_EP_STATE_STREAMING)) { if (enc_audio.num_ch == 1) { ret = iso_stream_send(enc_audio.data, data_size_pr_stream, - headsets[AUDIO_CH_R]); + &headsets[AUDIO_CH_R]); } else { ret = iso_stream_send(&enc_audio.data[data_size_pr_stream], - data_size_pr_stream, headsets[AUDIO_CH_R]); + data_size_pr_stream, &headsets[AUDIO_CH_R]); } if (ret) { LOG_DBG("Failed to send data to right channel"); diff --git a/applications/nrf5340_audio/src/modules/audio_usb.c b/applications/nrf5340_audio/src/modules/audio_usb.c index 11bfc87b48c..00c1bc33b5c 100644 --- a/applications/nrf5340_audio/src/modules/audio_usb.c +++ b/applications/nrf5340_audio/src/modules/audio_usb.c @@ -74,7 +74,7 @@ static void data_received(const struct device *dev, struct net_buf *buffer, size return; } - if (!buffer || !size) { + if (buffer == NULL || size == 0) { /* This should never happen */ ERR_CHK(-EINVAL); } diff --git a/applications/nrf5340_audio/src/modules/led.c b/applications/nrf5340_audio/src/modules/led.c index 9dc0b93880c..79a1385db2c 100644 --- a/applications/nrf5340_audio/src/modules/led.c +++ b/applications/nrf5340_audio/src/modules/led.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -19,19 +18,19 @@ #include LOG_MODULE_REGISTER(led, CONFIG_MODULE_LED_LOG_LEVEL); -#define BLINK_FREQ_MS 1000 +#define BLINK_FREQ_MS 1000 /* Maximum number of LED_UNITS. 1 RGB LED = 1 UNIT of 3 LEDS */ -#define LED_UNIT_MAX 10 -#define NUM_COLORS_RGB 3 -#define BASE_10 10 -#define DT_LABEL_AND_COMMA(node_id) DT_PROP(node_id, label), +#define LED_UNIT_MAX 10 +#define NUM_COLORS_RGB 3 +#define BASE_10 10 +#define DT_LABEL_AND_COMMA(node_id) DT_PROP(node_id, label), #define GPIO_DT_SPEC_GET_AND_COMMA(node_id) GPIO_DT_SPEC_GET(node_id, gpios), /* The following arrays are populated compile time from the .dts*/ -static const char *const led_labels[] = { DT_FOREACH_CHILD(DT_PATH(leds), DT_LABEL_AND_COMMA) }; +static const char *const led_labels[] = {DT_FOREACH_CHILD(DT_PATH(leds), DT_LABEL_AND_COMMA)}; -static const struct gpio_dt_spec leds[] = { DT_FOREACH_CHILD(DT_PATH(leds), - GPIO_DT_SPEC_GET_AND_COMMA) }; +static const struct gpio_dt_spec leds[] = { + DT_FOREACH_CHILD(DT_PATH(leds), GPIO_DT_SPEC_GET_AND_COMMA)}; enum led_type { LED_MONOCHROME, diff --git a/applications/nrf5340_audio/src/utils/board_version.c b/applications/nrf5340_audio/src/utils/board_version.c index 43be3df4aa2..d768a7a77ce 100644 --- a/applications/nrf5340_audio/src/utils/board_version.c +++ b/applications/nrf5340_audio/src/utils/board_version.c @@ -10,7 +10,6 @@ #include #include #include -#include #include "board.h" #include "macros_common.h" @@ -24,7 +23,7 @@ static const struct adc_dt_spec adc = ADC_DT_SPEC_GET(BOARD_ID); static const struct gpio_dt_spec power_gpios = GPIO_DT_SPEC_GET(BOARD_ID, power_gpios); /* We allow the ADC register value to deviate by N points in either direction */ -#define BOARD_VERSION_TOLERANCE 70 +#define BOARD_VERSION_TOLERANCE 70 #define VOLTAGE_STABILIZE_TIME_US 5 static int16_t sample_buffer;