Skip to content

Commit 273e1db

Browse files
committed
modified to support si917
1 parent c26cd91 commit 273e1db

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

examples/platform/silabs/sensors/AirQuality/AirQualitySensor.cpp

+17-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,18 @@
2222
#include <platform/CHIPDeviceLayer.h>
2323

2424
#ifdef USE_SPARKFUN_AIR_QUALITY_SENSOR
25-
#include "sl_i2cspm_instances.h"
2625
#include <sparkfun_sgp40.h>
26+
27+
#if (defined(SLI_SI917))
28+
#include "sl_i2c_instances.h"
29+
#include "rsi_debug.h"
30+
31+
#define I2C_INSTANCE_USED SL_I2C2
32+
static sl_i2c_instance_t i2c_instance = I2C_INSTANCE_USED;
33+
#else
34+
#include "sl_i2cspm_instances.h"
35+
#endif //(defined(SLI_SI917))
36+
static mikroe_i2c_handle_t app_i2c_instance = NULL;
2737
#endif // USE_SPARKFUN_AIR_QUALITY_SENSOR
2838

2939
namespace {
@@ -50,9 +60,14 @@ namespace AirQualitySensor {
5060
sl_status_t Init()
5161
{
5262
sl_status_t status = SL_STATUS_FAIL;
63+
#if (defined(SLI_SI917))
64+
app_i2c_instance = &i2c_instance;
65+
#else
66+
app_i2c_instance = sl_i2cspm_qwiic;
67+
#endif
5368

5469
#ifdef USE_SPARKFUN_AIR_QUALITY_SENSOR
55-
status = sparkfun_sgp40_init(sl_i2cspm_qwiic);
70+
status = sparkfun_sgp40_init(app_i2c_instance);
5671
VerifyOrReturnError(status == SL_STATUS_OK, SL_STATUS_FAIL);
5772
initialized = true;
5873

0 commit comments

Comments
 (0)