File tree 1 file changed +17
-2
lines changed
examples/platform/silabs/sensors/AirQuality
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 22
22
#include < platform/CHIPDeviceLayer.h>
23
23
24
24
#ifdef USE_SPARKFUN_AIR_QUALITY_SENSOR
25
- #include " sl_i2cspm_instances.h"
26
25
#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 ;
27
37
#endif // USE_SPARKFUN_AIR_QUALITY_SENSOR
28
38
29
39
namespace {
@@ -50,9 +60,14 @@ namespace AirQualitySensor {
50
60
sl_status_t Init ()
51
61
{
52
62
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
53
68
54
69
#ifdef USE_SPARKFUN_AIR_QUALITY_SENSOR
55
- status = sparkfun_sgp40_init (sl_i2cspm_qwiic );
70
+ status = sparkfun_sgp40_init (app_i2c_instance );
56
71
VerifyOrReturnError (status == SL_STATUS_OK, SL_STATUS_FAIL);
57
72
initialized = true ;
58
73
You can’t perform that action at this time.
0 commit comments