Skip to content

Commit

Permalink
Add units to defines and variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mkardous-silabs committed Sep 22, 2023
1 parent 0b39434 commit 0deec9f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 49 deletions.
2 changes: 1 addition & 1 deletion src/app/icd/ICDStateObserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#pragma once

#ifndef ICD_SLEEP_TIME_JITTER_MS
#define ICD_SLEEP_TIME_JITTER_MS (CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL * 0.75)
#define ICD_SLEEP_TIME_JITTER_MS (CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC * 0.75)
#endif

#ifndef ICD_ACTIVE_TIME_JITTER_MS
Expand Down
32 changes: 11 additions & 21 deletions src/app/icd/IcdManagementServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,11 @@ using chip::Protocols::InteractionModel::Status;
class IcdManagementServer
{
public:
void Init(uint32_t idle_interval, uint32_t active_interval, uint16_t active_threshold, uint32_t count,
uint16_t fabric_clients_supported)
{
mIdleInterval = idle_interval;
mActiveInterval = active_interval;
mActiveThreshold = active_threshold;
mIcdCounter = count;
mFabricClientsSupported = fabric_clients_supported;
}
uint32_t GetIdleModeInterval() { return mIdleInterval_s; }

uint32_t GetIdleModeInterval() { return mIdleInterval; }
uint32_t GetActiveModeInterval() { return mActiveInterval_ms; }

uint32_t GetActiveModeInterval() { return mActiveInterval; }

uint16_t GetActiveModeThreshold() { return mActiveThreshold; }
uint16_t GetActiveModeThreshold() { return mActiveThreshold_ms; }

uint32_t GetICDCounter() { return mIcdCounter; }

Expand All @@ -67,20 +57,20 @@ class IcdManagementServer

static IcdManagementServer mInstance;

static_assert((CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL) <= 64800,
static_assert((CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC) <= 64800,
"Spec requires the IdleModeInterval to be equal or inferior to 64800s.");
static_assert((CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL) >= 1, "Spec requires the IdleModeInterval to be equal or greater to 1s.");
uint32_t mIdleInterval = CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL; // in seconds.
static_assert((CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC) >= 1, "Spec requires the IdleModeInterval to be equal or greater to 1s.");
uint32_t mIdleInterval_s = CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC; // in seconds.

static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL) <= (CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL * 1000),
static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS) <= (CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC * 1000),
"Spec requires the IdleModeInterval be equal or greater to the ActiveModeInterval.");
static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL) >= 300,
static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS) >= 300,
"Spec requires the ActiveModeThreshold to be equal or greater to 300ms");
uint32_t mActiveInterval = CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL; // in milliseconds
uint32_t mActiveInterval_ms = CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS; // in milliseconds

static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD) >= 300,
static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS) >= 300,
"Spec requires the ActiveModeThreshold to be equal or greater to 300ms.");
uint16_t mActiveThreshold = CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD; // in milliseconds
uint16_t mActiveThreshold_ms = CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS; // in milliseconds

uint32_t mIcdCounter = 0;

Expand Down
18 changes: 9 additions & 9 deletions src/lib/core/CHIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1498,30 +1498,30 @@ extern const char CHIP_NON_PRODUCTION_MARKER[];
#endif

/**
* @def CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL
* @def CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC
*
* @brief Default value for the ICD Management cluster IdleModeInterval attribute, in seconds
*/
#ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL 2
#ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC
#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC 2
#endif

/**
* @def CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL
* @def CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS
*
* @brief Default value for the ICD Management cluster ActiveModeInterval attribute, in milliseconds
*/
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL 300
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS
#define CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS 300
#endif

/**
* @def CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD
* @def CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS
*
* @brief Default value for the ICD Management cluster ActiveModeThreshold attribute, in milliseconds
*/
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD
#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD 300
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS
#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS 300
#endif

/**
Expand Down
18 changes: 9 additions & 9 deletions src/platform/nrfconnect/CHIPPlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,23 @@
#endif // CHIP_ENABLE_OPENTHREAD
#endif // CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL

#ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL
#ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC
#ifdef CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL
#endif // CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC

#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS
#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL
#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS

#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS
#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_THRESHOLD
#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD CONFIG_CHIP_ICD_ACTIVE_MODE_THRESHOLD
#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS CONFIG_CHIP_ICD_ACTIVE_MODE_THRESHOLD
#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_THRESHOLD
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS

#ifndef CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC
#ifdef CONFIG_CHIP_ICD_CLIENTS_PER_FABRIC
Expand Down
18 changes: 9 additions & 9 deletions src/platform/silabs/CHIPPlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@

#ifdef SL_ICD_ENABLED

#ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL SL_IDLE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL
#ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC
#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC SL_IDLE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC

#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL SL_ACTIVE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS
#define CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS SL_ACTIVE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS

#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD
#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD SL_ACTIVE_MODE_THRESHOLD
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS
#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS SL_ACTIVE_MODE_THRESHOLD
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS

#ifndef CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC
#define CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC SL_ICD_SUPPORTED_CLIENTS_PER_FABRIC
Expand Down

0 comments on commit 0deec9f

Please sign in to comment.