You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2021/05/18 18:28:29 UTC

[GitHub] [mynewt-core] vikrant-proxy commented on a change in pull request #2597: sensor_creator: Add LIS2DW12 configuration for bus drivers

vikrant-proxy commented on a change in pull request #2597:
URL: https://github.com/apache/mynewt-core/pull/2597#discussion_r634644197



##########
File path: hw/sensor/creator/src/sensor_creator.c
##########
@@ -595,16 +595,48 @@ static struct sensor_itf i2c_0_itf_lpst = {
 };
 #endif
 
-#if MYNEWT_VAL(I2C_0) && MYNEWT_VAL(LIS2DW12_OFB)
+#if MYNEWT_VAL(LIS2DW12_OFB)
+#if MYNEWT_VAL(BUS_DRIVER_PRESENT)
+#if MYNEWT_VAL(LIS2DW12_OFB_I2C_NUM) >= 0
+static const struct bus_i2c_node_cfg lis2dw12_node_cfg = {
+    .node_cfg = {
+        .bus_name = MYNEWT_VAL(LIS2DW12_OFB_BUS),
+    },
+    .addr = MYNEWT_VAL(LIS2DW12_OFB_ITF_ADDR),
+    .freq = MYNEWT_VAL(LIS2DW12_OFB_BAUDRATE),
+};
+#elif MYNEWT_VAL(LIS2DW12_OFB_SPI_NUM) >= 0
+static const struct bus_spi_node_cfg lis2dw12_node_cfg = {
+    .node_cfg = {
+        .bus_name = MYNEWT_VAL(LIS2DW12_OFB_BUS),
+    },
+    .pin_cs = MYNEWT_VAL(LIS2DW12_OFB_CS),
+    .mode = BUS_SPI_MODE_3,
+    .data_order = BUS_SPI_DATA_ORDER_MSB,
+    .freq = MYNEWT_VAL(LIS2DW12_OFB_BAUDRATE),
+};
+#endif
+static struct sensor_itf lis2dw12_itf = {
+    .si_ints = {
+        { MYNEWT_VAL(LIS2DW12_OFB_INT1_PIN_HOST), 1,
+          MYNEWT_VAL(LIS2DW12_OFB_INT_CFG_ACTIVE)},
+        { -1, 0, 0 },
+    }
+};
+#else
+#if MYNEWT_VAL(I2C_0)
 static struct sensor_itf i2c_0_itf_lis2dw12 = {
     .si_type = SENSOR_ITF_I2C,
-    .si_num  = 0,
+    .si_num = 0,
     .si_addr = 0x18,

Review comment:
       I think this should use the syscfg, as it is variable




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org