Skip to content

Commit

Permalink
Move Logging api to a common place
Browse files Browse the repository at this point in the history
  • Loading branch information
jepenven-silabs committed May 16, 2023
1 parent 5f1a60b commit 0a94991
Show file tree
Hide file tree
Showing 26 changed files with 33 additions and 249 deletions.
19 changes: 1 addition & 18 deletions examples/chef/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#pragma once
#include "silabs_utils.h"

// ---- Lighting Example App Config ----

Expand All @@ -26,21 +27,3 @@
// Time it takes in ms for the simulated actuator to move from one
// state to another.
#define ACTUATOR_MOVEMENT_PERIOS_MS 10

// EFR Logging
#ifdef __cplusplus
extern "C" {
#endif

void silabsInitLog(void);

void efr32Log(const char * aFormat, ...);
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
void appError(int err);

#ifdef __cplusplus
}

#include <lib/core/CHIPError.h>
void appError(CHIP_ERROR error);
#endif
20 changes: 2 additions & 18 deletions examples/light-switch-app/silabs/SiWx917/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#pragma once

#include "silabs_utils.h"

// ---- Lighting Example App Config ----

#define APP_TASK_NAME "Lit"
Expand All @@ -28,21 +30,3 @@
// Time it takes in ms for the simulated actuator to move from one
// state to another.
#define ACTUATOR_MOVEMENT_PERIOS_MS 10

// EFR Logging
#ifdef __cplusplus
extern "C" {
#endif

void silabsInitLog(void);

void efr32Log(const char * aFormat, ...);
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
void appError(int err);

#ifdef __cplusplus
}

#include <lib/core/CHIPError.h>
void appError(CHIP_ERROR error);
#endif
20 changes: 2 additions & 18 deletions examples/light-switch-app/silabs/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#pragma once

#include "silabs_utils.h"

// ---- Lighting Example App Config ----

#define APP_TASK_NAME "Lit"
Expand Down Expand Up @@ -85,21 +87,3 @@
0x00, 0xFC, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, \
0xFF, 0x01, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF

// EFR Logging
#ifdef __cplusplus
extern "C" {
#endif

void silabsInitLog(void);

void efr32Log(const char * aFormat, ...);
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
void appError(int err);

#ifdef __cplusplus
}

#include <lib/core/CHIPError.h>
void appError(CHIP_ERROR error);
#endif
2 changes: 1 addition & 1 deletion examples/lighting-app/silabs/SiWx917/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#pragma once

#include "siwx917_utils.h"
#include "silabs_utils.h"

// ---- Lighting Example App Config ----

Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/silabs/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#pragma once

#include "efr32_utils.h"
#include "silabs_utils.h"

// ---- Lighting Example App Config ----

Expand Down
20 changes: 2 additions & 18 deletions examples/lock-app/silabs/SiWx917/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#pragma once

#include "silabs_utils.h"

// ---- Door lock Example App Config ----

#define APP_TASK_NAME "Lock"
Expand All @@ -28,21 +30,3 @@
// Time it takes in ms for the simulated actuator to move from one
// state to another.
#define ACTUATOR_MOVEMENT_PERIOS_MS 10

// EFR Logging
#ifdef __cplusplus
extern "C" {
#endif

void silabsInitLog(void);

void efr32Log(const char * aFormat, ...);
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
void appError(int err);

#ifdef __cplusplus
}

#include <lib/core/CHIPError.h>
void appError(CHIP_ERROR error);
#endif
20 changes: 2 additions & 18 deletions examples/lock-app/silabs/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#pragma once

#include "silabs_utils.h"

// ---- Door lock Example App Config ----

#define APP_TASK_NAME "Lock"
Expand Down Expand Up @@ -84,21 +86,3 @@
0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF

// EFR Logging
#ifdef __cplusplus
extern "C" {
#endif

void silabsInitLog(void);

void efr32Log(const char * aFormat, ...);
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
void appError(int err);

#ifdef __cplusplus
}

#include <lib/core/CHIPError.h>
void appError(CHIP_ERROR error);
#endif
2 changes: 1 addition & 1 deletion examples/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ source_set("siwx917-common") {
"SiWx917/wfx_rsi_host.c",
"init_ccpPlatform.cpp",
"matter_config.cpp",
"siwx917_utils.cpp",
"${silabs_common_plat_dir}/silabs_utils.cpp",
]

if (use_base_app) {
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/SiWx917/BaseApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "SilabsDeviceDataProvider.h"
#include "rsi_board.h"
#include "rsi_chip.h"
#include "siwx917_utils.h"
#include "silabs_utils.h"
#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include <app/util/attribute-storage.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "rsi_board.h"
#include "rsi_pll.h"
#include "rsi_rom_clks.h"
#include "siwx917_utils.h"
#include "silabs_utils.h"
#include "system_RS1xxxx.h"

#define SOC_PLL_REF_FREQUENCY 32000000 /* PLL input REFERENCE clock 32MHZ */
Expand Down
2 changes: 0 additions & 2 deletions examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ extern "C" {
#endif
void wfx_rsidev_init(void);
void wfx_rsi_task(void * arg);
void efr32Log(const char * aFormat, ...);
#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
void wfx_ip_changed_notify(int got_ip);
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
Expand All @@ -90,7 +89,6 @@ int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info);
int32_t wfx_rsi_reset_count();
int32_t wfx_rsi_disconnect();
int32_t wfx_rsi_init_platform();
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);

#ifdef __cplusplus
}
Expand Down
36 changes: 0 additions & 36 deletions examples/platform/silabs/SiWx917/siwx917_utils.cpp

This file was deleted.

38 changes: 0 additions & 38 deletions examples/platform/silabs/SiWx917/siwx917_utils.h

This file was deleted.

2 changes: 1 addition & 1 deletion examples/platform/silabs/SiWx917/uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "USART.h"
#include "matter_shell.h"
#include "rsi_rom_egpio.h"
#include "siwx917_utils.h"
#include "silabs_utils.h"
#ifdef __cplusplus
extern "C" {
#endif
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/SilabsDeviceDataProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#ifdef SIWX917_USE_COMISSIONABLE_DATA
#include "DeviceConfig.h"
#include "siwx917_utils.h"
#include "silabs_utils.h"
#include <setup_payload/Base38Decode.h>
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
#endif // SIWX917_USE_COMISSIONABLE_DATA
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ source_set("efr32-common") {
"${silabs_common_plat_dir}/LEDWidget.cpp",
"${silabs_common_plat_dir}/heap_4_silabs.c",
"${silabs_common_plat_dir}/syscalls_stubs.cpp",
"efr32_utils.cpp",
"${silabs_common_plat_dir}/silabs_utils.cpp",
"init_efrPlatform.cpp",
"matter_config.cpp",
]
Expand Down
2 changes: 0 additions & 2 deletions examples/platform/silabs/efr32/rs911x/wfx_rsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ extern "C" {
#endif
void wfx_rsidev_init(void);
void wfx_rsi_task(void * arg);
void efr32Log(const char * aFormat, ...);
#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
void wfx_ip_changed_notify(int got_ip);
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
Expand All @@ -94,7 +93,6 @@ int32_t wfx_rsi_disconnect();
#if CHIP_DEVICE_CONFIG_ENABLE_SED
int32_t wfx_rsi_power_save();
#endif /* CHIP_DEVICE_CONFIG_ENABLE_SED */
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/

#include "efr32_utils.h"
#include "silabs_utils.h"
#include "init_efrPlatform.h"
#include "sl_system_kernel.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ extern "C" {

void silabsInitLog(void);

void efr32Log(const char * aFormat, ...);
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
void silabsLog(const char * aFormat, ...);
#define SILABS_LOG(...) silabsLog(__VA_ARGS__);
void appError(int err);

#ifdef __cplusplus
Expand Down
20 changes: 2 additions & 18 deletions examples/thermostat/silabs/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#pragma once

#include "silabs_utils.h"

// ---- Lighting Example App Config ----

#define APP_TASK_NAME "Lit"
Expand Down Expand Up @@ -58,21 +60,3 @@
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
#define OFF_DEMO_BITMAP ON_DEMO_BITMAP

// EFR Logging
#ifdef __cplusplus
extern "C" {
#endif

void silabsInitLog(void);

void efr32Log(const char * aFormat, ...);
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
void appError(int err);

#ifdef __cplusplus
}

#include <lib/core/CHIPError.h>
void appError(CHIP_ERROR error);
#endif
Loading

0 comments on commit 0a94991

Please sign in to comment.