Skip to content

Commit

Permalink
[Silabs] Build System cleanup (#25348)
Browse files Browse the repository at this point in the history
* cleanup

* fix thermostat app
  • Loading branch information
jepenven-silabs authored and pull[bot] committed Sep 22, 2023
1 parent b3f4f66 commit 136af90
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 30 deletions.
39 changes: 26 additions & 13 deletions examples/platform/silabs/efr32/TemperatureSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,44 @@

#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
#include "sl_board_control.h"
#include "sl_i2cspm_instances.h"
#include "sl_si70xx.h"

namespace TemperatureSensor {
constexpr uint16_t kSensorTemperatureOffset = 800;
static bool initialized = false;

sl_status_t Init()
{
return sl_sensor_rht_init();
sl_status_t status;
sl_i2cspm_t * rht_sensor = sl_i2cspm_sensor;
(void) sl_board_enable_sensor(SL_BOARD_SENSOR_RHT);

status = sl_si70xx_init(rht_sensor, SI7021_ADDR);
initialized = (SL_STATUS_OK == status);
return status;
}

sl_status_t GetTemp(uint32_t * relativeHumidity, int16_t * temperature)
{
if (!initialized)
{
return SL_STATUS_NOT_INITIALIZED;
}

// 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;
sl_status_t status;
sl_i2cspm_t * rht_sensor = sl_i2cspm_sensor;
int32_t temp = 0;
status = sl_si70xx_measure_rh_and_temp(rht_sensor, SI7021_ADDR, relativeHumidity, &temp);

if (temperature != nullptr)
{
*temperature = static_cast<int16_t>(temp / 10) - kSensorTemperatureOffset;
}

return status;
}
}; // namespace TemperatureSensor
2 changes: 0 additions & 2 deletions examples/thermostat/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ efr32_executable("thermostat_app") {

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",
Expand Down
15 changes: 1 addition & 14 deletions third_party/silabs/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ template("efr32_sdk") {
"${efr32_sdk_root}",
"${efr32_sdk_root}/util/plugin/security_manager/",
"${efr32_sdk_root}/hardware/kit/common/bsp",
"${efr32_sdk_root}/app/common/util/app_assert/",
"${efr32_sdk_root}/hardware/board/inc",
"${efr32_sdk_root}/hardware/driver/memlcd/inc",
"${efr32_sdk_root}/hardware/driver/memlcd/src/ls013b7dh03",
Expand Down Expand Up @@ -129,8 +128,6 @@ template("efr32_sdk") {
"${efr32_sdk_root}/platform/base/hal/plugin/psstore",
"${efr32_sdk_root}/platform/base/hal/plugin/antenna",
"${efr32_sdk_root}/protocol/bluetooth/inc/",
"${efr32_sdk_root}/app/bluetooth/common/in_place_ota_dfu/",
"${efr32_sdk_root}/app/bluetooth/common/in_place_ota_dfu/config/",
"${efr32_sdk_root}/util/plugin/plugin-common/fem-control",
"${efr32_sdk_root}/util/silicon_labs/silabs_core/graphics",
"${efr32_sdk_root}/util/silicon_labs/silabs_core/memory_manager",
Expand Down Expand Up @@ -348,10 +345,7 @@ template("efr32_sdk") {
]

if (!chip_enable_ble_rs911x) {
libs += [
"${sdk_support_root}/protocol/bluetooth/lib/EFR32MG12P/GCC/binapploader.o",
"${sdk_support_root}/protocol/bluetooth/lib/EFR32MG12P/GCC/libbluetooth.a",
]
libs += [ "${sdk_support_root}/protocol/bluetooth/lib/EFR32MG12P/GCC/libbluetooth.a" ]
}

defines += [ "EFR32MG12" ]
Expand All @@ -366,7 +360,6 @@ template("efr32_sdk") {
]

libs += [
"${sdk_support_root}/protocol/bluetooth/lib/EFR32MG21/GCC/binapploader.o",
"${sdk_support_root}/protocol/bluetooth/lib/EFR32MG21/GCC/libbluetooth.a",
"${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_efr32xg21_gcc_release.a",
"${sdk_support_root}/platform/emdrv/nvm3/lib/libnvm3_CM33_gcc.a",
Expand All @@ -388,7 +381,6 @@ template("efr32_sdk") {
]

libs += [
"${sdk_support_root}/protocol/bluetooth/lib/EFR32MG24/GCC/libapploader.a",
"${sdk_support_root}/protocol/bluetooth/lib/EFR32MG24/GCC/libbluetooth.a",
"${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_efr32xg24_gcc_release.a",
"${sdk_support_root}/platform/emdrv/nvm3/lib/libnvm3_CM33_gcc.a",
Expand All @@ -411,7 +403,6 @@ template("efr32_sdk") {
]

libs += [
"${sdk_support_root}/protocol/bluetooth/lib/EFR32MG24/GCC/libapploader.a",
"${sdk_support_root}/protocol/bluetooth/lib/EFR32MG24/GCC/libbluetooth.a",
"${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_module_efr32xg24_gcc_release.a",
"${sdk_support_root}/platform/emdrv/nvm3/lib/libnvm3_CM33_gcc.a",
Expand Down Expand Up @@ -489,7 +480,6 @@ template("efr32_sdk") {
source_set(sdk_target_name) {
sources = [
"${chip_root}/third_party/mbedtls/repo/include/mbedtls/platform.h",
"${efr32_sdk_root}/app/bluetooth/common/in_place_ota_dfu/sl_bt_in_place_ota_dfu.c",
"${efr32_sdk_root}/hardware/board/src/sl_board_control_gpio.c",
"${efr32_sdk_root}/hardware/board/src/sl_board_init.c",
"${efr32_sdk_root}/platform/CMSIS/RTOS2/Source/os_systick.c",
Expand Down Expand Up @@ -781,7 +771,6 @@ template("efr32_sdk") {
"${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_emu_s1.c",
"${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_hfxo_s1.c",
"${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_lfxo_s1.c",
"${efr32_sdk_root}/protocol/bluetooth/src/sl_apploader_util_s1.c",
"${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM4F/port.c",
]
} else if (silabs_family == "efr32mg21") {
Expand Down Expand Up @@ -859,7 +848,6 @@ template("efr32_sdk") {
"${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_hfxo_s2.c",
"${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_lfxo_s2.c",
"${efr32_sdk_root}/platform/service/hfxo_manager/src/sl_hfxo_manager_hal_s2.c",
"${efr32_sdk_root}/protocol/bluetooth/src/sl_apploader_util_s2.c",
"${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM33_NTZ/non_secure/port.c",
"${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM33_NTZ/non_secure/portasm.c",
]
Expand Down Expand Up @@ -898,7 +886,6 @@ template("efr32_sdk") {
"${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_hfxo_mgm24.c",
"${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_lfxo_s2.c",
"${efr32_sdk_root}/platform/service/hfxo_manager/src/sl_hfxo_manager_hal_s2.c",
"${efr32_sdk_root}/protocol/bluetooth/src/sl_apploader_util_s2.c",
"${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM33_NTZ/non_secure/port.c",
"${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM33_NTZ/non_secure/portasm.c",
]
Expand Down
2 changes: 1 addition & 1 deletion third_party/silabs/matter_support
Submodule matter_support updated 56 files
+1 −2 matter/efr32/efr32mg12/BRD4161A/autogen/sl_bluetooth.c
+1 −7 matter/efr32/efr32mg12/BRD4161A/autogen/sl_component_catalog.h
+0 −54 matter/efr32/efr32mg12/BRD4161A/config/app_assert_config.h
+1 −2 matter/efr32/efr32mg12/BRD4162A/autogen/sl_bluetooth.c
+1 −7 matter/efr32/efr32mg12/BRD4162A/autogen/sl_component_catalog.h
+0 −54 matter/efr32/efr32mg12/BRD4162A/config/app_assert_config.h
+1 −2 matter/efr32/efr32mg12/BRD4163A/autogen/sl_bluetooth.c
+1 −7 matter/efr32/efr32mg12/BRD4163A/autogen/sl_component_catalog.h
+0 −54 matter/efr32/efr32mg12/BRD4163A/config/app_assert_config.h
+1 −2 matter/efr32/efr32mg12/BRD4164A/autogen/sl_bluetooth.c
+1 −7 matter/efr32/efr32mg12/BRD4164A/autogen/sl_component_catalog.h
+1 −1 matter/efr32/efr32mg12/BRD4164A/autogen/sl_event_handler.c
+0 −54 matter/efr32/efr32mg12/BRD4164A/config/app_assert_config.h
+1 −2 matter/efr32/efr32mg12/BRD4166A/autogen/sl_bluetooth.c
+1 −7 matter/efr32/efr32mg12/BRD4166A/autogen/sl_component_catalog.h
+0 −54 matter/efr32/efr32mg12/BRD4166A/config/app_assert_config.h
+1 −2 matter/efr32/efr32mg12/BRD4170A/autogen/sl_bluetooth.c
+1 −7 matter/efr32/efr32mg12/BRD4170A/autogen/sl_component_catalog.h
+1 −1 matter/efr32/efr32mg12/BRD4170A/autogen/sl_event_handler.c
+0 −54 matter/efr32/efr32mg12/BRD4170A/config/app_assert_config.h
+1 −2 matter/efr32/efr32mg12/BRD4304A/autogen/sl_bluetooth.c
+1 −7 matter/efr32/efr32mg12/BRD4304A/autogen/sl_component_catalog.h
+0 −54 matter/efr32/efr32mg12/BRD4304A/config/app_assert_config.h
+1 −2 matter/efr32/efr32mg24/BRD2601B/autogen/sl_bluetooth.c
+2 −8 matter/efr32/efr32mg24/BRD2601B/autogen/sl_component_catalog.h
+0 −54 matter/efr32/efr32mg24/BRD2601B/config/app_assert_config.h
+1 −2 matter/efr32/efr32mg24/BRD2703A/autogen/sl_bluetooth.c
+2 −8 matter/efr32/efr32mg24/BRD2703A/autogen/sl_component_catalog.h
+0 −54 matter/efr32/efr32mg24/BRD2703A/config/app_assert_config.h
+1 −2 matter/efr32/efr32mg24/BRD4186A/autogen/sl_bluetooth.c
+2 −8 matter/efr32/efr32mg24/BRD4186A/autogen/sl_component_catalog.h
+0 −54 matter/efr32/efr32mg24/BRD4186A/config/app_assert_config.h
+1 −1 matter/efr32/efr32mg24/BRD4186C/autogen/sl_bluetooth.c
+2 −8 matter/efr32/efr32mg24/BRD4186C/autogen/sl_component_catalog.h
+0 −54 matter/efr32/efr32mg24/BRD4186C/config/app_assert_config.h
+1 −2 matter/efr32/efr32mg24/BRD4187A/autogen/sl_bluetooth.c
+2 −8 matter/efr32/efr32mg24/BRD4187A/autogen/sl_component_catalog.h
+0 −54 matter/efr32/efr32mg24/BRD4187A/config/app_assert_config.h
+1 −2 matter/efr32/efr32mg24/BRD4187C/autogen/sl_bluetooth.c
+3 −9 matter/efr32/efr32mg24/BRD4187C/autogen/sl_component_catalog.h
+0 −54 matter/efr32/efr32mg24/BRD4187C/config/app_assert_config.h
+3 −6 matter/efr32/mgm24/BRD2704A/autogen/sl_component_catalog.h
+0 −54 matter/efr32/mgm24/BRD2704A/config/app_assert_config.h
+1 −2 matter/efr32/mgm24/BRD4316A/autogen/sl_bluetooth.c
+2 −8 matter/efr32/mgm24/BRD4316A/autogen/sl_component_catalog.h
+0 −54 matter/efr32/mgm24/BRD4316A/config/app_assert_config.h
+1 −2 matter/efr32/mgm24/BRD4317A/autogen/sl_bluetooth.c
+2 −8 matter/efr32/mgm24/BRD4317A/autogen/sl_component_catalog.h
+0 −54 matter/efr32/mgm24/BRD4317A/config/app_assert_config.h
+1 −2 matter/efr32/mgm24/BRD4318A/autogen/sl_bluetooth.c
+3 −6 matter/efr32/mgm24/BRD4318A/autogen/sl_component_catalog.h
+0 −54 matter/efr32/mgm24/BRD4318A/config/app_assert_config.h
+1 −2 matter/efr32/mgm24/BRD4319A/autogen/sl_bluetooth.c
+2 −8 matter/efr32/mgm24/BRD4319A/autogen/sl_component_catalog.h
+0 −54 matter/efr32/mgm24/BRD4319A/config/app_assert_config.h
+1 −1 platform/emdrv/nvm3/src/nvm3_hal_flash_ccp.c

0 comments on commit 136af90

Please sign in to comment.