Skip to content

Commit 1c1427e

Browse files
authored
Merge branch 'master' into camera-zone
2 parents 7b2ebc6 + 59f7615 commit 1c1427e

22 files changed

+272
-215
lines changed

.github/workflows/build.yaml

+11-18
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ jobs:
375375
scripts/build_python_device.sh --chip_detail_logging true
376376
377377
build_darwin:
378-
name: Build on Darwin (clang, python_lib, simulated)
378+
name: Build on Darwin (clang, simulated)
379379
runs-on: macos-13
380380
if: github.actor != 'restyled-io[bot]'
381381

@@ -402,27 +402,20 @@ jobs:
402402
CHIP_ROOT_PATH=examples/placeholder/linux
403403
CHIP_ROOT_PATH="$CHIP_ROOT_PATH" BUILD_TYPE="$BUILD_TYPE" scripts/build/gn_gen.sh --args="$GN_ARGS"
404404
scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE"
405-
- name: Setup Build, Run Build and Run Tests
405+
- name: Setup Build, Run Build and Run Tests (asan + target_os=all)
406406
# We can't enable leak checking here in LSAN_OPTIONS, because on
407407
# Darwin that's only supported with a new enough clang, and we're
408408
# not building with the pigweed clang here.
409+
env:
410+
BUILD_TYPE: default
409411
run: |
410-
for BUILD_TYPE in default python_lib; do
411-
case $BUILD_TYPE in
412-
# We want to build various standalone example apps
413-
# (similar to what examples-linux-standalone.yaml
414-
# does), so use target_os="all" to get those picked
415-
# up as part of the "unified" build. But then to
416-
# save CI resources we want to exclude the
417-
# "host clang" build, which uses the pigweed
418-
# clang.
419-
"default") GN_ARGS='target_os="all" is_asan=true enable_host_clang_build=false';;
420-
esac
421-
BUILD_TYPE=$BUILD_TYPE scripts/build/gn_gen.sh --args="$GN_ARGS chip_data_model_check_die_on_failure=true" --export-compile-commands
422-
scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE"
423-
BUILD_TYPE=$BUILD_TYPE scripts/tests/gn_tests.sh
424-
done
425-
- name: Ensure codegen is done for sanitize
412+
# We want to build various standalone example apps similar to what examples-linux-standalone.yaml
413+
# does), so use target_os="all" to get those picked up as part of the "unified" build. But then
414+
# to save CI resources we want to exclude the "host clang" build, which uses the pigweed clang.
415+
scripts/build/gn_gen.sh --args='target_os="all" is_asan=true enable_host_clang_build=false chip_data_model_check_die_on_failure=true' --export-compile-commands
416+
scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE"
417+
scripts/tests/gn_tests.sh
418+
- name: Ensure codegen is done for default
426419
run: |
427420
./scripts/run_in_build_env.sh "./scripts/run_codegen_targets.sh out/default"
428421
- name: Clang-tidy validation

examples/platform/silabs/BaseApplication.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ CHIP_ERROR BaseApplication::Init()
259259
ChipLogProgress(AppServer, "APP: Wait WiFi Init");
260260
while (!wfx_hw_ready())
261261
{
262-
vTaskDelay(pdMS_TO_TICKS(10));
262+
osDelay(pdMS_TO_TICKS(10));
263263
}
264264
ChipLogProgress(AppServer, "APP: Done WiFi Init");
265265
/* We will init server when we get IP */
+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
*
3+
* Copyright (c) 2020 Project CHIP Authors
4+
* Copyright (c) 2019 Google LLC.
5+
* All rights reserved.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
#include "sl_board_control.h"
21+
#include "sl_i2cspm_instances.h"
22+
#include "sl_si70xx.h"
23+
#include <Si70xxSensor.h>
24+
#include <lib/support/CodeUtils.h>
25+
26+
namespace {
27+
28+
constexpr uint16_t kSensorTemperatureOffset = 475;
29+
bool initialized = false;
30+
31+
} // namespace
32+
33+
namespace Si70xxSensor {
34+
35+
sl_status_t Init()
36+
{
37+
sl_status_t status = SL_STATUS_OK;
38+
39+
status = sl_board_enable_sensor(SL_BOARD_SENSOR_RHT);
40+
VerifyOrReturnError(status == SL_STATUS_OK, status);
41+
42+
status = sl_si70xx_init(sl_i2cspm_sensor, SI7021_ADDR);
43+
VerifyOrReturnError(status == SL_STATUS_OK, status);
44+
45+
initialized = true;
46+
return status;
47+
}
48+
49+
sl_status_t GetSensorData(uint16_t & relativeHumidity, int16_t & temperature)
50+
{
51+
VerifyOrReturnError(initialized, SL_STATUS_NOT_INITIALIZED);
52+
53+
sl_status_t status = SL_STATUS_OK;
54+
int32_t tempTemperature = 0;
55+
uint32_t tempHumidity = 0;
56+
57+
status = sl_si70xx_measure_rh_and_temp(sl_i2cspm_sensor, SI7021_ADDR, &tempHumidity, &tempTemperature);
58+
VerifyOrReturnError(status == SL_STATUS_OK, status);
59+
60+
// Sensor precision is milliX. We need to reduce to change the precision to centiX to fit with the cluster attributes presicion.
61+
temperature = static_cast<int16_t>(tempTemperature / 10) - kSensorTemperatureOffset;
62+
relativeHumidity = static_cast<uint16_t>(tempHumidity / 10);
63+
64+
return status;
65+
}
66+
67+
}; // namespace Si70xxSensor
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
*
3+
* Copyright (c) 2020 Project CHIP Authors
4+
* Copyright (c) 2019 Google LLC.
5+
* All rights reserved.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
#pragma once
21+
22+
#include "sl_status.h"
23+
#include <stdint.h>
24+
25+
namespace Si70xxSensor {
26+
27+
/**
28+
* @brief Initialises the Si70xx Sensor.
29+
*
30+
* @return sl_status_t SL_STATUS_OK if there were no errors occured during initialisation.
31+
* Error if an underlying platform error occured
32+
*/
33+
sl_status_t Init();
34+
35+
/**
36+
* @brief Reads Humidity and temperature values from the Si70xx sensor.
37+
* The init function must be called before calling the GetSensorData.
38+
*
39+
* @param[out] relativeHumidity Relative humidity percentage in centi-pourcentage (1000 == 10.00%)
40+
* @param[out] temperature Ambiant temperature in centi-celsium (1000 == 10.00C)
41+
*
42+
* @return sl_status_t SL_STATUS_OK if there were no errors occured during initialisation.
43+
* SL_STATUS_NOT_INITIALIZED if the sensor was not initialised
44+
* Error if an underlying platform error occured
45+
*/
46+
sl_status_t GetSensorData(uint16_t & relativeHumidity, int16_t & temperature);
47+
48+
}; // namespace Si70xxSensor

examples/platform/silabs/SiWx917/BUILD.gn

+7
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,13 @@ source_set("siwx917-common") {
252252
public_deps += [ ":test-event-trigger" ]
253253
}
254254

255+
if (sl_enable_si70xx_sensor) {
256+
sources += [
257+
"${silabs_common_plat_dir}/Si70xxSensor.cpp",
258+
"${silabs_common_plat_dir}/Si70xxSensor.h",
259+
]
260+
}
261+
255262
if (app_data_model != "") {
256263
public_deps += [ app_data_model ]
257264
}

examples/platform/silabs/SoftwareFaultReports.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
*/
1818

1919
#include "SoftwareFaultReports.h"
20-
#include "FreeRTOS.h"
2120
#include "silabs_utils.h"
2221
#include <app/clusters/software-diagnostics-server/software-diagnostics-server.h>
2322
#include <app/util/attribute-storage.h>
23+
#include <cmsis_os2.h>
2424
#include <lib/support/CHIPMemString.h>
2525
#include <lib/support/CodeUtils.h>
2626
#include <platform/CHIPDeviceLayer.h>
@@ -75,7 +75,7 @@ void OnSoftwareFaultEventHandler(const char * faultRecordString)
7575
// Allow some time for the Fault event to be sent as the next action after exiting this function
7676
// is typically an assert or reboot.
7777
// Depending on the task at fault, it is possible the event can't be transmitted.
78-
vTaskDelay(pdMS_TO_TICKS(1000));
78+
osDelay(pdMS_TO_TICKS(1000));
7979
#endif // MATTER_DM_PLUGIN_SOFTWARE_DIAGNOSTICS_SERVER
8080
}
8181

examples/platform/silabs/TemperatureSensor.cpp

-62
This file was deleted.

examples/platform/silabs/TemperatureSensor.h

-28
This file was deleted.

examples/platform/silabs/display/demo-ui.c

-1
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,5 @@ void demoUIClearMainScreen(uint8_t * name)
167167
{
168168
GLIB_clear(&glibContext);
169169
demoUIDisplayHeader((char *) name);
170-
demoUIDisplayApp(false);
171170
demoUIDisplayProtocols();
172171
}

examples/platform/silabs/display/lcd.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class SilabsLCD
6565
int DrawPixel(void * pContext, int32_t x, int32_t y);
6666
int Update(void);
6767
void WriteDemoUI(bool state);
68+
void WriteDemoUI();
6869
void SetCustomUI(customUICB cb);
6970

7071
void GetScreen(Screen_e & screen);
@@ -85,8 +86,6 @@ class SilabsLCD
8586
bool protocol1 = false; /* data */
8687
} DemoState_t;
8788

88-
void WriteDemoUI();
89-
9089
#ifdef QR_CODE_ENABLED
9190
void WriteQRCode();
9291
void LCDFillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h);

examples/platform/silabs/efr32/BUILD.gn

+7
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,13 @@ source_set("efr32-common") {
308308
public_deps += [ ":test-event-trigger" ]
309309
}
310310

311+
if (sl_enable_si70xx_sensor) {
312+
sources += [
313+
"${silabs_common_plat_dir}/Si70xxSensor.cpp",
314+
"${silabs_common_plat_dir}/Si70xxSensor.h",
315+
]
316+
}
317+
311318
if (app_data_model != "") {
312319
public_deps += [ app_data_model ]
313320
}

examples/thermostat/silabs/BUILD.gn

-28
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ import("${examples_common_plat_dir}/args.gni")
4747
declare_args() {
4848
# Dump memory usage at link time.
4949
chip_print_memory_usage = false
50-
51-
# Enable the temperature sensor
52-
# Some boards do not have a temperature sensor
53-
use_temp_sensor = false
5450
}
5551

5652
if (wifi_soc) {
@@ -112,19 +108,6 @@ if (wifi_soc) {
112108
"PW_RPC_ENABLED",
113109
]
114110
}
115-
116-
if (use_temp_sensor) {
117-
include_dirs += [
118-
"${efr32_sdk_root}/platform/driver/i2cspm/inc",
119-
"${efr32_sdk_root}/app/bluetooth/common/sensor_rht",
120-
"${efr32_sdk_root}/app/bluetooth/common/sensor_rht/config",
121-
"${efr32_sdk_root}/hardware/driver/si70xx/inc",
122-
"${efr32_sdk_root}/app/bluetooth/common/sensor_select",
123-
"${efr32_sdk_root}/platform/common/config",
124-
]
125-
126-
defines += [ "USE_TEMP_SENSOR" ]
127-
}
128111
}
129112
}
130113

@@ -141,17 +124,6 @@ silabs_executable("thermostat_app") {
141124
"src/ZclCallbacks.cpp",
142125
]
143126

144-
if (use_temp_sensor) {
145-
sources += [
146-
"${efr32_sdk_root}/hardware/driver/si70xx/src/sl_si70xx.c",
147-
"${efr32_sdk_root}/platform/common/src/sl_status.c",
148-
"${efr32_sdk_root}/platform/driver/i2cspm/src/sl_i2cspm.c",
149-
"${efr32_sdk_root}/platform/emlib/src/em_i2c.c",
150-
"${examples_common_plat_dir}/TemperatureSensor.cpp",
151-
"${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/autogen/sl_i2cspm_init.c",
152-
]
153-
}
154-
155127
if (!disable_lcd) {
156128
sources += [ "src/ThermostatUI.cpp" ]
157129
}

0 commit comments

Comments
 (0)