Skip to content

Commit 18f6b7f

Browse files
asmellbyjhedberg
authored andcommitted
simplicity_sdk: Patch generic macros
Certain instances of CONCAT() and MAX() conflict between SiSDK and Zephyr. Add a SL_ prefix to the SiSDK variants. Signed-off-by: Aksel Skauge Mellbye <[email protected]>
1 parent 8995a64 commit 18f6b7f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

simplicity_sdk/platform/common/inc/sl_common.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ extern "C" {
7373
******************************************************************************/
7474

7575
/** @brief Macros to concatenate. */
76-
#define _CONCAT_2(first, second) first ## second
77-
#define SL_CONCAT_PASTER_2(first, second) _CONCAT_2(first, second) ///< sl concat paster 2.
78-
#define _CONCAT_3(first, second, third) first ## second ## third
79-
#define SL_CONCAT_PASTER_3(first, second, third) _CONCAT_3(first, second, third) ///< sl concat paster 3.
80-
#define _CONCAT_4(first, second, third, fourth) first ## second ## third ## fourth
81-
#define SL_CONCAT_PASTER_4(first, second, third, fourth) _CONCAT_4(first, second, third, fourth) ///< sl concat paster 4.
76+
#define _SL_CONCAT_2(first, second) first ## second
77+
#define SL_CONCAT_PASTER_2(first, second) _SL_CONCAT_2(first, second) ///< sl concat paster 2.
78+
#define _SL_CONCAT_3(first, second, third) first ## second ## third
79+
#define SL_CONCAT_PASTER_3(first, second, third) _SL_CONCAT_3(first, second, third) ///< sl concat paster 3.
80+
#define _SL_CONCAT_4(first, second, third, fourth) first ## second ## third ## fourth
81+
#define SL_CONCAT_PASTER_4(first, second, third, fourth) _SL_CONCAT_4(first, second, third, fourth) ///< sl concat paster 4.
8282

8383
/** @brief Round n up to closest interval of i. */
8484
#define SL_CEILING(n, i) ((((n) + (i) - 1U) / (i)) * (i))

simplicity_sdk/platform/radio/rail_lib/plugin/pa-conversions/pa_conversions_efr32.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include "pa_conversions_efr32.h"
4444
#include "rail.h"
4545

46-
#define MAX(a, b) ((a) > (b) ? (a) : (b))
46+
#define _SL_MAX(a, b) ((a) > (b) ? (a) : (b))
4747

4848
static RAIL_TxPowerCurvesConfigAlt_t powerCurvesState;
4949

@@ -319,7 +319,7 @@ RAIL_TxPowerLevel_t RAIL_ConvertDbmToRaw(RAIL_Handle_t railHandle,
319319
if ((mode < sizeof(supportedPaIndices))
320320
&& (supportedPaIndices[mode] < RAIL_NUM_PA)) {
321321
RAIL_PaDescriptor_t const *modeInfo = &powerCurvesState.curves[supportedPaIndices[mode]];
322-
uint32_t minPowerLevel = MAX(modeInfo->min, PA_CONVERSION_MINIMUM_PWRLVL);
322+
uint32_t minPowerLevel = _SL_MAX(modeInfo->min, PA_CONVERSION_MINIMUM_PWRLVL);
323323
#if RAIL_SUPPORTS_DBM_POWERSETTING_MAPPING_TABLE
324324
if (modeInfo->algorithm == RAIL_PA_ALGORITHM_DBM_POWERSETTING_MAPPING_TABLE) {
325325
RAIL_TxPower_t minPower = modeInfo->minPowerDbm;
@@ -472,7 +472,7 @@ RAIL_TxPower_t RAIL_ConvertRawToDbm(RAIL_Handle_t railHandle,
472472
}
473473

474474
// We 1-index low power PA power levels, but of course arrays are 0 indexed
475-
powerLevel -= MAX(modeInfo->min, PA_CONVERSION_MINIMUM_PWRLVL);
475+
powerLevel -= _SL_MAX(modeInfo->min, PA_CONVERSION_MINIMUM_PWRLVL);
476476

477477
//If the index calculation above underflowed, then provide the lowest array index.
478478
if (powerLevel > (modeInfo->max - modeInfo->min)) {

0 commit comments

Comments
 (0)