Skip to content

Commit 031717a

Browse files
MariuszSkamracarlescufi
authored andcommitted
Bluetooth: lc3: Improve BT_CODEC_LC3_CHAN_COUNT_SUPPORT macro
This improves the macro so that it can take variable number of arguments, e.g. BT_CODEC_LC3_CHAN_COUNT_SUPPORT(1, 2, 8). Signed-off-by: Mariusz Skamra <[email protected]>
1 parent 132ad4a commit 031717a

File tree

1 file changed

+15
-6
lines changed
  • include/zephyr/bluetooth/audio

1 file changed

+15
-6
lines changed

include/zephyr/bluetooth/audio/lc3.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,31 @@ enum bt_codec_capability_type {
129129
*/
130130
#define BT_CODEC_LC3_DURATION_PREFER_10 BIT(5)
131131

132-
132+
/** @def BT_CODEC_LC3_CHAN_COUNT_MIN
133+
* @brief LC3 minimum supported channel counts
134+
*/
135+
#define BT_CODEC_LC3_CHAN_COUNT_MIN 1
136+
/** @def BT_CODEC_LC3_CHAN_COUNT_MIN
137+
* @brief LC3 maximum supported channel counts
138+
*/
139+
#define BT_CODEC_LC3_CHAN_COUNT_MAX 8
133140
/** @def BT_CODEC_LC3_CHAN_COUNT_SUPPORT
134141
* @brief LC3 channel count support capability
135-
* OR multiple supported counts together from 1 to 8
142+
*
143+
* Macro accepts variable number of channel counts.
144+
* The allowed channel counts are defined by specification and have to be in range from
145+
* @ref BT_CODEC_LC3_CHAN_COUNT_MIN to @ref BT_CODEC_LC3_CHAN_COUNT_MAX inclusive.
146+
*
136147
* Example to support 1 and 3 channels:
137-
* BT_CODEC_LC3_CHAN_COUNT_SUPPORT(1) | BT_CODEC_LC3_CHAN_COUNT_SUPPORT(3)
148+
* BT_CODEC_LC3_CHAN_COUNT_SUPPORT(1, 3)
138149
*/
139-
#define BT_CODEC_LC3_CHAN_COUNT_SUPPORT(_count) ((uint8_t)BIT((_count) - 1))
140-
150+
#define BT_CODEC_LC3_CHAN_COUNT_SUPPORT(...) ((uint8_t)((FOR_EACH(BIT, (|), __VA_ARGS__)) >> 1))
141151

142152
struct bt_codec_lc3_frame_len {
143153
uint16_t min;
144154
uint16_t max;
145155
};
146156

147-
148157
/**
149158
* @brief Codec configuration type IDs
150159
*

0 commit comments

Comments
 (0)