Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Silabs] Add CSL support to silabs platform #31838

Merged
merged 6 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/light-switch-app/silabs/openthread.gni
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ chip_subscription_timeout_resumption = false
sl_use_subscription_synching = true

# Openthread Configuration flags
sl_ot_idle_interval_ms = 30000 # 30s Idle Intervals
sl_ot_idle_interval_ms = 15000 # 15s Idle Intervals
sl_ot_active_interval_ms = 500 # 500ms Active Intervals

# ICD Matter Configuration flags
Expand Down
7 changes: 1 addition & 6 deletions examples/light-switch-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,24 @@
#include "AppConfig.h"
#include "AppEvent.h"
#include "BindingHandler.h"

#include "LEDWidget.h"

#include "LightSwitchMgr.h"

#ifdef DISPLAY_ENABLED
#include "lcd.h"
#ifdef QR_CODE_ENABLED
#include "qrcodegen.h"
#endif // QR_CODE_ENABLED
#endif // DISPLAY_ENABLED

#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include <app/util/attribute-storage.h>
#include <assert.h>
#include <lib/support/CodeUtils.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/silabs/platformAbstraction/SilabsPlatform.h>
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
#include <setup_payload/SetupPayload.h>

#include <platform/silabs/platformAbstraction/SilabsPlatform.h>

/**********************************************************
* Defines and Constants
*********************************************************/
Expand Down
4 changes: 4 additions & 0 deletions examples/platform/silabs/MatterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ CHIP_ERROR SilabsMatterConfig::InitOpenThread(void)
ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router));
#else // CHIP_DEVICE_CONFIG_THREAD_FTD
#if CHIP_CONFIG_ENABLE_ICD_SERVER
#if CHIP_DEVICE_CONFIG_THREAD_SSED
ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SynchronizedSleepyEndDevice));
#else
ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice));
#endif
#else // CHIP_CONFIG_ENABLE_ICD_SERVER
ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice));
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
Expand Down
28 changes: 16 additions & 12 deletions examples/platform/silabs/efr32/project_include/OpenThreadConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,35 +45,39 @@
// Timeout after 2 missed checkin or 4 mins if sleep interval is too short.
#define OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT ((SL_MLE_TIMEOUT_s < 120) ? 240 : ((SL_MLE_TIMEOUT_s * 2) + 1))

#if defined(SL_CSL_ENABLE) && SL_CSL_ENABLE

#define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 1
#define OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE 1
#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1
#define OPENTHREAD_CONFIG_CHILD_SUPERVISION_CHECK_TIMEOUT 0
#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD 750
#define OPENTHREAD_CONFIG_CSL_TIMEOUT SL_CSL_TIMEOUT
#define SL_OPENTHREAD_CSL_TX_UNCERTAINTY 200

#endif // SL_CSL_ENABLE

#endif // SL_ICD_ENABLED

/****Uncomment below section for OpenThread Debug logs*/
// #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG

// #ifndef OPENTHREAD_CONFIG_LOG_CLI
// #define OPENTHREAD_CONFIG_LOG_CLI 1
// #define OPENTHREAD_CONFIG_LOG_CLI 1
// #endif

// #ifndef OPENTHREAD_CONFIG_LOG_PKT_DUMP
// #define OPENTHREAD_CONFIG_LOG_PKT_DUMP 1
// #define OPENTHREAD_CONFIG_LOG_PKT_DUMP 1
// #endif

// #ifndef OPENTHREAD_CONFIG_LOG_PLATFORM
// #define OPENTHREAD_CONFIG_LOG_PLATFORM 1
// #define OPENTHREAD_CONFIG_LOG_PLATFORM 1
// #endif

// #ifndef OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL
// #define OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL 1
// #define OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL 1
// #endif

// EFR32MG21A020F1024IM32 has 96k of RAM. Reduce the number of buffers to
// conserve RAM for this Series 2 part.
#if defined(EFR32MG21)
#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 22
#define OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE 512
mkardous-silabs marked this conversation as resolved.
Show resolved Hide resolved
#define OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE 512
#endif

#define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1
#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1

Expand Down
97 changes: 97 additions & 0 deletions examples/window-app/common/window-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1810,6 +1810,91 @@ cluster UserLabel = 65 {
readonly attribute int16u clusterRevision = 65533;
}

/** Allows servers to ensure that listed clients are notified when a server is available for communication. */
cluster IcdManagement = 70 {
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
revision 2;

enum OperatingModeEnum : enum8 {
kSIT = 0;
kLIT = 1;
}

bitmap Feature : bitmap32 {
kCheckInProtocolSupport = 0x1;
kUserActiveModeTrigger = 0x2;
kLongIdleTimeSupport = 0x4;
}

bitmap UserActiveModeTriggerBitmap : bitmap32 {
kPowerCycle = 0x1;
kSettingsMenu = 0x2;
kCustomInstruction = 0x4;
kDeviceManual = 0x8;
kActuateSensor = 0x10;
kActuateSensorSeconds = 0x20;
kActuateSensorTimes = 0x40;
kActuateSensorLightsBlink = 0x80;
kResetButton = 0x100;
kResetButtonLightsBlink = 0x200;
kResetButtonSeconds = 0x400;
kResetButtonTimes = 0x800;
kSetupButton = 0x1000;
kSetupButtonSeconds = 0x2000;
kSetupButtonLightsBlink = 0x4000;
kSetupButtonTimes = 0x8000;
kAppDefinedButton = 0x10000;
}

fabric_scoped struct MonitoringRegistrationStruct {
fabric_sensitive node_id checkInNodeID = 1;
fabric_sensitive int64u monitoredSubject = 2;
fabric_idx fabricIndex = 254;
}

readonly attribute int32u idleModeDuration = 0;
readonly attribute int32u activeModeDuration = 1;
readonly attribute int16u activeModeThreshold = 2;
readonly attribute access(read: administer) optional MonitoringRegistrationStruct registeredClients[] = 3;
readonly attribute access(read: administer) optional int32u ICDCounter = 4;
readonly attribute optional int16u clientsSupportedPerFabric = 5;
readonly attribute optional UserActiveModeTriggerBitmap userActiveModeTriggerHint = 6;
readonly attribute optional char_string<128> userActiveModeTriggerInstruction = 7;
readonly attribute optional OperatingModeEnum operatingMode = 8;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct RegisterClientRequest {
node_id checkInNodeID = 0;
int64u monitoredSubject = 1;
octet_string<16> key = 2;
optional octet_string<16> verificationKey = 3;
}

response struct RegisterClientResponse = 1 {
int32u ICDCounter = 0;
}

request struct UnregisterClientRequest {
node_id checkInNodeID = 0;
optional octet_string<16> verificationKey = 1;
}

response struct StayActiveResponse = 4 {
int32u promisedActiveDuration = 0;
}

/** Register a client to the end device */
fabric command access(invoke: manage) RegisterClient(RegisterClientRequest): RegisterClientResponse = 0;
/** Unregister a client from an end device */
fabric command access(invoke: manage) UnregisterClient(UnregisterClientRequest): DefaultSuccess = 2;
/** Request the end device to stay in Active Mode for an additional ActiveModeThreshold */
command access(invoke: manage) StayActiveRequest(): StayActiveResponse = 3;
}

/** Provides an interface for controlling and adjusting automatic window coverings. */
cluster WindowCovering = 258 {
revision 5;
Expand Down Expand Up @@ -2360,6 +2445,18 @@ endpoint 0 {
ram attribute featureMap default = 0;
ram attribute clusterRevision default = 1;
}

server cluster IcdManagement {
callback attribute idleModeDuration;
callback attribute activeModeDuration;
callback attribute activeModeThreshold;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
callback attribute attributeList;
ram attribute featureMap default = 0x0000;
ram attribute clusterRevision default = 2;
}
}
endpoint 1 {
device type ma_windowcovering = 514, version 2;
Expand Down
157 changes: 156 additions & 1 deletion examples/window-app/common/window-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -5065,6 +5065,160 @@
"reportableChange": 0
}
]
},
{
"name": "ICD Management",
"code": 70,
"mfgCode": null,
"define": "ICD_MANAGEMENT_CLUSTER",
"side": "server",
"enabled": 1,
"attributes": [
{
"name": "IdleModeDuration",
"code": 0,
"mfgCode": null,
"side": "server",
"type": "int32u",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ActiveModeDuration",
"code": 1,
"mfgCode": null,
"side": "server",
"type": "int32u",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ActiveModeThreshold",
"code": 2,
"mfgCode": null,
"side": "server",
"type": "int16u",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "GeneratedCommandList",
"code": 65528,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "AcceptedCommandList",
"code": 65529,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "EventList",
"code": 65530,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "AttributeList",
"code": 65531,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "FeatureMap",
"code": 65532,
"mfgCode": null,
"side": "server",
"type": "bitmap32",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0000",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ClusterRevision",
"code": 65533,
"mfgCode": null,
"side": "server",
"type": "int16u",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "2",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
}
]
}
]
},
Expand Down Expand Up @@ -7105,5 +7259,6 @@
"endpointId": 2,
"networkId": 0
}
]
],
"log": []
}
Loading
Loading