Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/ble_defines_mem_monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 authored Nov 15, 2022
2 parents 8a408b9 + 6519b91 commit 61391b4
Show file tree
Hide file tree
Showing 137 changed files with 12,784 additions and 11,451 deletions.
8 changes: 4 additions & 4 deletions docs/guides/python_chip_controller_building.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,10 +624,10 @@ ZCL cluster commands.
```python
# devCtrl.WriteAttribute(<nodeid>, [(<endpointid>, Clusters.<cluster>.Attributes.<attribute>(value=<attribute value>))])
# e.g.
await devCtrl.WriteAttribute(1, [(1, Clusters.TestCluster.Attributes.Int8u(value=1))])
await devCtrl.WriteAttribute(1, [(1, Clusters.TestCluster.Attributes.Boolean(value=True))])
await devCtrl.WriteAttribute(1, [(1, Clusters.TestCluster.Attributes.OctetString(value=b'123123\x00'))])
await devCtrl.WriteAttribute(1, [(1, Clusters.TestCluster.Attributes.CharString(value='233233'))])
await devCtrl.WriteAttribute(1, [(1, Clusters.UnitTesting.Attributes.Int8u(value=1))])
await devCtrl.WriteAttribute(1, [(1, Clusters.UnitTesting.Attributes.Boolean(value=True))])
await devCtrl.WriteAttribute(1, [(1, Clusters.UnitTesting.Attributes.OctetString(value=b'123123\x00'))])
await devCtrl.WriteAttribute(1, [(1, Clusters.UnitTesting.Attributes.CharString(value='233233'))])
```

### `zclsubscribe <Cluster> <Attribute> <Nodeid> <Endpoint> <MinInterval> <MaxInterval>`
Expand Down
400 changes: 200 additions & 200 deletions docs/guides/repl/Matter_Basic_Interactions.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/guides/repl/Matter_REPL_Intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@
"<span style=\"color: #000080; text-decoration-color: #000080\">│</span> <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">E.g</span> <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f; font-weight: bold\">(</span><span style=\"color: #7fbfbf; text-decoration-color: #7fbfbf; font-weight: bold\">1</span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">, </span> <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080\">│</span> <span style=\"color: #bf7fbf; text-decoration-color: #bf7fbf; font-weight: bold\">Clusters.TestCluster.Attributes.XYZAttribute</span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f; font-weight: bold\">…</span> <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080\">│</span> <span style=\"color: #bf7fbf; text-decoration-color: #bf7fbf; font-weight: bold\">Clusters.UnitTesting.Attributes.XYZAttribute</span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f; font-weight: bold\">…</span> <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">-- Write </span><span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">'hello'</span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> to the XYZ attribute on the </span> <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">test cluster to endpoint </span><span style=\"color: #7fbfbf; text-decoration-color: #7fbfbf; font-weight: bold\">1</span> <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-style: italic\">ZCLAttributeList</span> = <span style=\"color: #00ffff; text-decoration-color: #00ffff; font-style: italic\">def </span><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">ZCLAttributeList</span><span style=\"font-weight: bold\">()</span>: <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n",
Expand Down Expand Up @@ -893,7 +893,7 @@
"\u001b[34m│\u001b[0m \u001b[34m│\u001b[0m\n",
"\u001b[34m│\u001b[0m \u001b[2mE.g\u001b[0m \u001b[34m│\u001b[0m\n",
"\u001b[34m│\u001b[0m \u001b[2m \u001b[0m\u001b[1;2m(\u001b[0m\u001b[1;2;36m1\u001b[0m\u001b[2m, \u001b[0m \u001b[34m│\u001b[0m\n",
"\u001b[34m│\u001b[0m \u001b[1;2;35mClusters.TestCluster.Attributes.XYZAttribute\u001b[0m\u001b[1;2m…\u001b[0m \u001b[34m│\u001b[0m\n",
"\u001b[34m│\u001b[0m \u001b[1;2;35mClusters.UnitTesting.luster.Attributes.XYZAttribute\u001b[0m\u001b[1;2m…\u001b[0m \u001b[34m│\u001b[0m\n",
"\u001b[34m│\u001b[0m \u001b[2m-- Write \u001b[0m\u001b[2;32m'hello'\u001b[0m\u001b[2m to the XYZ attribute on the \u001b[0m \u001b[34m│\u001b[0m\n",
"\u001b[34m│\u001b[0m \u001b[2mtest cluster to endpoint \u001b[0m\u001b[1;2;36m1\u001b[0m \u001b[34m│\u001b[0m\n",
"\u001b[34m│\u001b[0m \u001b[3;33mZCLAttributeList\u001b[0m = \u001b[3;96mdef \u001b[0m\u001b[1;31mZCLAttributeList\u001b[0m\u001b[1m(\u001b[0m\u001b[1m)\u001b[0m: \u001b[34m│\u001b[0m\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3528,7 +3528,7 @@ server cluster ElectricalMeasurement = 2820 {
readonly attribute int16u clusterRevision = 65533;
}

server cluster TestCluster = 4294048773 {
server cluster UnitTesting = 4294048773 {
enum SimpleEnum : ENUM8 {
kUnspecified = 0;
kValueA = 1;
Expand Down Expand Up @@ -4705,7 +4705,7 @@ endpoint 1 {
ram attribute clusterRevision default = 3;
}

server cluster TestCluster {
server cluster UnitTesting {
ram attribute boolean;
ram attribute bitmap8;
ram attribute bitmap16;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8055,7 +8055,7 @@
]
},
{
"name": "Test Cluster",
"name": "Unit Testing",
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
Expand Down Expand Up @@ -8107,7 +8107,7 @@
]
},
{
"name": "Test Cluster",
"name": "Unit Testing",
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
Expand Down Expand Up @@ -19159,7 +19159,7 @@
]
},
{
"name": "Test Cluster",
"name": "Unit Testing",
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
Expand Down Expand Up @@ -19331,7 +19331,7 @@
]
},
{
"name": "Test Cluster",
"name": "Unit Testing",
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2952,7 +2952,7 @@ server cluster AccountLogin = 1294 {
timed command Logout(): DefaultSuccess = 3;
}

server cluster TestCluster = 4294048773 {
server cluster UnitTesting = 4294048773 {
enum SimpleEnum : ENUM8 {
kUnspecified = 0;
kValueA = 1;
Expand Down Expand Up @@ -3801,7 +3801,7 @@ endpoint 1 {
ram attribute clusterRevision default = 1;
}

server cluster TestCluster {
server cluster UnitTesting {
ram attribute boolean;
ram attribute bitmap8;
ram attribute bitmap16;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8055,7 +8055,7 @@
]
},
{
"name": "Test Cluster",
"name": "Unit Testing",
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
Expand Down Expand Up @@ -8107,7 +8107,7 @@
]
},
{
"name": "Test Cluster",
"name": "Unit Testing",
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
Expand Down Expand Up @@ -18951,7 +18951,7 @@
]
},
{
"name": "Test Cluster",
"name": "Unit Testing",
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
Expand Down Expand Up @@ -19123,7 +19123,7 @@
]
},
{
"name": "Test Cluster",
"name": "Unit Testing",
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
Expand Down
49 changes: 49 additions & 0 deletions examples/platform/efr32/TemperatureSensor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
*
* Copyright (c) 2020 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "TemperatureSensor.h"

#ifdef __cplusplus
extern "C" {
#endif
// This is a C implementation. Need the ifdef __cplusplus else we get linking issues
#include "sl_sensor_rht.h"

#ifdef __cplusplus
}
#endif

namespace TemperatureSensor {
constexpr uint16_t kSensorTemperatureOffset = 800;

sl_status_t Init()
{
return sl_sensor_rht_init();
}

sl_status_t GetTemp(uint32_t * relativeHumidity, int16_t * temperature)
{
// Sensor resolution 0.001 C
// DataModel resolution 0.01 C
int32_t temp;
sl_status_t status = sl_sensor_rht_get(relativeHumidity, &temp);
*temperature = static_cast<int16_t>(temp / 10) - kSensorTemperatureOffset;
return status;
}
}; // namespace TemperatureSensor
28 changes: 28 additions & 0 deletions examples/platform/efr32/TemperatureSensor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
*
* Copyright (c) 2020 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include "sl_status.h"
#include <stdint.h>

namespace TemperatureSensor {
sl_status_t Init();
sl_status_t GetTemp(uint32_t * relativeHumidity, int16_t * temperature);
}; // namespace TemperatureSensor
16 changes: 14 additions & 2 deletions examples/platform/efr32/display/lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,20 @@ void SilabsLCD::WriteDemoUI(bool state)
void SilabsLCD::WriteDemoUI()
{
Clear();
demoUIClearMainScreen(mName);
demoUIDisplayApp(dState.mainState);
if (customUI != nullptr)
{
customUI(&glibContext);
}
else
{
demoUIClearMainScreen(mName);
demoUIDisplayApp(dState.mainState);
}
}

void SilabsLCD::SetCustomUI(customUICB cb)
{
customUI = cb;
}

#ifdef QR_CODE_ENABLED
Expand Down
7 changes: 5 additions & 2 deletions examples/platform/efr32/display/lcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ class SilabsLCD
{

public:
typedef void (*customUICB)(GLIB_Context_t * context);
CHIP_ERROR Init(uint8_t * name = nullptr, bool initialState = false);
void * Context();
int Clear(void);
int DrawPixel(void * pContext, int32_t x, int32_t y);
int Update(void);
void WriteDemoUI(bool state);
void SetCustomUI(customUICB cb);

#ifdef QR_CODE_ENABLED
void SetQRCode(uint8_t * str, uint32_t size);
void ShowQRCode(bool show, bool forceRefresh = false);
Expand Down Expand Up @@ -66,6 +69,6 @@ class SilabsLCD
#else
uint8_t mName[APP_NAME_MAX_LENGTH + 1];
#endif

DemoState_t dState;
customUICB customUI = nullptr;
DemoState_t dState;
};
34 changes: 34 additions & 0 deletions examples/thermostat/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ assert(current_os == "freertos")

efr32_project_dir = "${chip_root}/examples/thermostat/efr32"
examples_plat_dir = "${chip_root}/examples/platform/efr32"
efr32_sdk_root = "${chip_root}/third_party/silabs/gecko_sdk"

declare_args() {
# Dump memory usage at link time.
Expand All @@ -59,6 +60,10 @@ declare_args() {

# Argument to Disable IPv4 for wifi(rs911)
chip_enable_wifi_ipv4 = false

# Enable the temperature sensor
# Some boards do not have a temperature sensor
use_temp_sensor = silabs_board != "BRD2703A" && silabs_board != "BRD4319A"
}

declare_args() {
Expand Down Expand Up @@ -133,6 +138,7 @@ efr32_sdk("sdk") {
"${efr32_project_dir}/include",
"${examples_plat_dir}",
"${chip_root}/src/lib",
"${efr32_sdk_root}/app/common/util/app_assert",
]

defines = [
Expand Down Expand Up @@ -172,6 +178,18 @@ efr32_sdk("sdk") {
defines += [ "SL_WFX_CONFIG_SCAN" ]
}
}
if (use_temp_sensor) {
include_dirs += [
"${efr32_sdk_root}/platform/driver/i2cspm/inc",
"${efr32_sdk_root}/app/bluetooth/common/sensor_rht",
"${efr32_sdk_root}/app/bluetooth/common/sensor_rht/config",
"${efr32_sdk_root}/hardware/driver/si70xx/inc",
"${efr32_sdk_root}/app/bluetooth/common/sensor_select",
"${efr32_sdk_root}/platform/common/config",
]

defines += [ "USE_TEMP_SENSOR" ]
}
}

efr32_executable("thermostat_app") {
Expand All @@ -186,6 +204,8 @@ efr32_executable("thermostat_app") {
"${examples_plat_dir}/init_efrPlatform.cpp",
"${examples_plat_dir}/matter_config.cpp",
"src/AppTask.cpp",
"src/SensorManager.cpp",
"src/TemperatureManager.cpp",
"src/ZclCallbacks.cpp",
"src/main.cpp",
]
Expand All @@ -194,6 +214,19 @@ efr32_executable("thermostat_app") {
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
}

if (use_temp_sensor) {
sources += [
"${efr32_sdk_root}/app/bluetooth/common/sensor_rht/sl_sensor_rht.c",
"${efr32_sdk_root}/app/bluetooth/common/sensor_select/sl_sensor_select.c",
"${efr32_sdk_root}/hardware/driver/si70xx/src/sl_si70xx.c",
"${efr32_sdk_root}/platform/common/src/sl_status.c",
"${efr32_sdk_root}/platform/driver/i2cspm/src/sl_i2cspm.c",
"${efr32_sdk_root}/platform/emlib/src/em_i2c.c",
"${examples_plat_dir}/TemperatureSensor.cpp",
"${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/autogen/sl_i2cspm_init.c",
]
}

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
use_wf200 || use_rs911x) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
Expand Down Expand Up @@ -268,6 +301,7 @@ efr32_executable("thermostat_app") {
sources += [
"${examples_plat_dir}/display/demo-ui.c",
"${examples_plat_dir}/display/lcd.cpp",
"src/ThermostatUI.cpp",
]
include_dirs += [ "${examples_plat_dir}/display" ]
defines += [
Expand Down
6 changes: 0 additions & 6 deletions examples/thermostat/efr32/include/AppEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ struct AppEvent
{
kEventType_Button = 0,
kEventType_Timer,
kEventType_Light,
kEventType_Install,
};

Expand All @@ -44,11 +43,6 @@ struct AppEvent
{
void * Context;
} TimerEvent;
struct
{
uint8_t Action;
int32_t Actor;
} LightEvent;
};

EventHandler Handler;
Expand Down
Loading

0 comments on commit 61391b4

Please sign in to comment.