Skip to content

Commit

Permalink
Clean nrfconnect config
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian-Nordic committed Oct 9, 2023
1 parent 68fae68 commit 538083f
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 83 deletions.
4 changes: 2 additions & 2 deletions config/nrfconnect/chip-gn/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ chip_device_platform = "nrfconnect"

chip_build_tests = false

chip_project_config_include = "<CHIPProjectConfig.h>"
chip_system_project_config_include = "<CHIPProjectConfig.h>"
chip_project_config_include = ""
chip_system_project_config_include = ""
chip_ble_project_config_include = ""

chip_crypto = "mbedtls"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,3 @@
// All clusters app has 3 group endpoints. This needs to defined here so that
// CHIP_CONFIG_MAX_GROUPS_PER_FABRIC is properly configured.
#define CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC 3

/**
* @def CHIP_DEVICE_CONFIG_ENABLE_SED
*
* @brief Defines if a matter device is acting as a Sleepy End Device(SED)
*/
#ifndef CHIP_DEVICE_CONFIG_ENABLE_SED
#define CHIP_DEVICE_CONFIG_ENABLE_SED 0
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,3 @@
/* Use a default pairing code if one hasn't been provisioned in flash. */
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00

/**
* @def CHIP_DEVICE_CONFIG_ENABLE_SED
*
* @brief Defines if a matter device is acting as a Sleepy End Device(SED)
*/
#ifndef CHIP_DEVICE_CONFIG_ENABLE_SED
#define CHIP_DEVICE_CONFIG_ENABLE_SED 0
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,3 @@
// Until this is improved in OpenThread we need to increase the retransmission
// interval to survive the stall.
#define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (1000_ms32)

/**
* @def CHIP_DEVICE_CONFIG_ENABLE_SED
*
* @brief Defines if a matter device is acting as a Sleepy End Device(SED)
*/
#ifndef CHIP_DEVICE_CONFIG_ENABLE_SED
#define CHIP_DEVICE_CONFIG_ENABLE_SED 0
#endif
9 changes: 0 additions & 9 deletions examples/lock-app/nrfconnect/main/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,3 @@
// Use a default pairing code if one hasn't been provisioned in flash.
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00

/**
* @def CHIP_DEVICE_CONFIG_ENABLE_SED
*
* @brief Defines if a matter device is acting as a Sleepy End Device(SED)
*/
#ifndef CHIP_DEVICE_CONFIG_ENABLE_SED
#define CHIP_DEVICE_CONFIG_ENABLE_SED 0
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ CHIP_ERROR GenericPlatformManagerImpl_Zephyr<ImplClass>::_StopEventLoopTask(void
template <class ImplClass>
void GenericPlatformManagerImpl_Zephyr<ImplClass>::_Shutdown(void)
{
#if CONFIG_REBOOT
#ifdef CONFIG_REBOOT
sys_reboot(SYS_REBOOT_WARM);
#else
// NB: When this is implemented, |mInitialized| can be removed.
Expand Down
24 changes: 9 additions & 15 deletions src/platform/nrfconnect/CHIPDevicePlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,25 +93,21 @@
#define CHIP_DEVICE_CONFIG_ENABLE_THREAD 0
#endif

#ifndef CONFIG_WIFI_NRF700X
#define CONFIG_WIFI_NRF700X 0
#endif

#ifdef CONFIG_WIFI_NRF700X
#define CHIP_DEVICE_CONFIG_ENABLE_WIFI CONFIG_WIFI_NRF700X

#if CHIP_DEVICE_CONFIG_ENABLE_WIFI
#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 1
#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0
#else
#define CHIP_DEVICE_CONFIG_ENABLE_WIFI 0
#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 0
#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0
#endif

#ifndef CONFIG_BT
#define CONFIG_BT 0
#endif

#ifdef CONFIG_BT
#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE CONFIG_BT
#else
#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 0
#endif

// ========== Platform-specific Configuration =========

Expand Down Expand Up @@ -231,12 +227,10 @@
#endif // CONFIG_CHIP_ENABLE_DNS_CLIENT
#endif // CONFIG_CHIP_ENABLE_DNSSD_SRP

#ifndef CONFIG_CHIP_THREAD_SSED
#define CONFIG_CHIP_THREAD_SSED 0
#endif

#ifdef CONFIG_CHIP_ENABLE_ICD_SUPPORT
#define CHIP_DEVICE_CONFIG_THREAD_SSED CONFIG_CHIP_THREAD_SSED
#else
#define CHIP_DEVICE_CONFIG_THREAD_SSED 0
#endif // CONFIG_CHIP_ENABLE_ICD_SUPPORT

#ifndef CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL
Expand Down Expand Up @@ -268,7 +262,7 @@
#endif

#ifndef CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH
#if CONFIG_CHIP_FACTORY_DATA
#ifdef CONFIG_CHIP_FACTORY_DATA
// UID will be copied from the externally programmed factory data, so we don't know the actual length and we need to assume some max
// boundary.
#define CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH CONFIG_CHIP_FACTORY_DATA_ROTATING_DEVICE_UID_MAX_LEN
Expand Down
14 changes: 1 addition & 13 deletions src/platform/nrfconnect/CHIPPlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@
#define CHIP_CONFIG_MAX_FABRICS 5
#endif

#ifndef CONFIG_CHIP_LOG_SIZE_OPTIMIZATION
#define CONFIG_CHIP_LOG_SIZE_OPTIMIZATION 0
#endif

#if CONFIG_CHIP_LOG_SIZE_OPTIMIZATION
#ifdef CONFIG_CHIP_LOG_SIZE_OPTIMIZATION
// Disable some of the too detailed log modules to save flash
#define CHIP_CONFIG_LOG_MODULE_ExchangeManager_DETAIL 0
#define CHIP_CONFIG_LOG_MODULE_Crypto_DETAIL 0
Expand Down Expand Up @@ -139,11 +135,3 @@
#define CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC CONFIG_CHIP_ICD_CLIENTS_PER_FABRIC
#endif // CONFIG_CHIP_ICD_CLIENTS_PER_FABRIC
#endif // CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC

#ifndef CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
#define CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE 0
#endif // CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE

#ifndef CONFIG_REBOOT
#define CONFIG_REBOOT 0
#endif // CONFIG_REBOOT
4 changes: 2 additions & 2 deletions src/platform/nrfconnect/FactoryDataProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "CHIPDevicePlatformConfig.h"
#include <crypto/CHIPCryptoPAL.h>

#if CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
#ifdef CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
#include <credentials/CertificationDeclaration.h>
#include <platform/Zephyr/ZephyrConfig.h>
#endif
Expand Down Expand Up @@ -101,7 +101,7 @@ CHIP_ERROR FactoryDataProvider<FlashFactoryData>::Init()
template <class FlashFactoryData>
CHIP_ERROR FactoryDataProvider<FlashFactoryData>::GetCertificationDeclaration(MutableByteSpan & outBuffer)
{
#if CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
#ifdef CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
size_t cdLen = 0;

if (Internal::ZephyrConfig::ReadConfigValueBin(Internal::ZephyrConfig::kConfigKey_CertificationDeclaration,
Expand Down
8 changes: 3 additions & 5 deletions src/platform/nrfconnect/OTAImageProcessorImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
#include <platform/CHIPDeviceLayer.h>
#include <system/SystemError.h>

#include "CHIPPlatformConfig.h"

#if CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
#ifdef CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
#include <credentials/CertificationDeclaration.h>
#include <platform/Zephyr/ZephyrConfig.h>
#include <zephyr/settings/settings.h>
Expand All @@ -42,7 +40,7 @@

namespace chip {
namespace {
#if CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
#ifdef CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
// Cd globals are needed to be accessed from dfu image writer lambdas
uint8_t sCdBuf[chip::Credentials::kMaxCMSSignedCDMessage] = { 0 };
size_t sCdSavedBytes = 0;
Expand Down Expand Up @@ -91,7 +89,7 @@ CHIP_ERROR OTAImageProcessorImpl::PrepareDownloadImpl()
ReturnErrorOnFailure(System::MapErrorZephyr(dfu_multi_image_register_writer(&writer)));
};

#if CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
#ifdef CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
dfu_image_writer cdWriter;
cdWriter.image_id = CONFIG_CHIP_CERTIFiCATION_DECLARATION_OTA_IMAGE_ID;
cdWriter.open = [](int id, size_t size) { return size <= sizeof(sCdBuf) ? 0 : -EFBIG; };
Expand Down
5 changes: 0 additions & 5 deletions src/platform/nrfconnect/wifi/WiFiManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,6 @@ class WiFiManager
static_assert(kConnectionRecoveryMinIntervalMs < kConnectionRecoveryMaxIntervalMs);
static_assert(kConnectionRecoveryJitterMs <= kConnectionRecoveryMaxIntervalMs);

#if CHIP_DEVICE_CONFIG_ENABLE_SED
static constexpr uint8_t kDefaultDTIMInterval = 3;
static constexpr uint8_t kBeaconIntervalMs = 100;
#endif

CHIP_ERROR Init();
CHIP_ERROR Scan(const ByteSpan & ssid, ScanResultCallback resultCallback, ScanDoneCallback doneCallback,
bool internalScan = false);
Expand Down
5 changes: 1 addition & 4 deletions src/system/SystemConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -764,11 +764,8 @@ struct LwIPEvent;
*
* Defaults to enabled on Zephyr platforms that enable CONFIG_EVENTFD.
*/
#ifndef CONFIG_EVENTFD
#define CONFIG_EVENTFD 0
#endif
#ifndef CHIP_SYSTEM_CONFIG_USE_ZEPHYR_EVENTFD
#if defined(__ZEPHYR__) && CONFIG_EVENTFD
#if defined(__ZEPHYR__) && defined(CONFIG_EVENTFD)
#define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_EVENTFD 1
#else
#define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_EVENTFD 0
Expand Down

0 comments on commit 538083f

Please sign in to comment.