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 08:12:30 UTC

[GitHub] [mynewt-core] kasjer opened a new pull request #2597: sensor_creator: Add LIS2DW12 configuration for bus drivers

kasjer opened a new pull request #2597:
URL: https://github.com/apache/mynewt-core/pull/2597


   LIS2DW12 has support for bus driver.
   Now it can be used with sensor_creator.


-- 
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



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2597: sensor_creator: Add LIS2DW12 configuration for bus drivers

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2597:
URL: https://github.com/apache/mynewt-core/pull/2597#issuecomment-842986547


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### hw/sensor/creator/src/sensor_creator.c
   <details>
   
   ```diff
   @@ -619,7 +622,7 @@
    static struct sensor_itf lis2dw12_itf = {
        .si_ints = {
            { MYNEWT_VAL(LIS2DW12_OFB_INT1_PIN_HOST), 1,
   -            MYNEWT_VAL(LIS2DW12_OFB_INT_CFG_ACTIVE)},
   +          MYNEWT_VAL(LIS2DW12_OFB_INT_CFG_ACTIVE)},
            { -1, 0, 0 },
        }
    };
   @@ -627,11 +630,12 @@
    #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,
        .si_ints = {
            { MYNEWT_VAL(LIS2DW12_INT1_PIN_HOST), MYNEWT_VAL(LIS2DW12_INT1_PIN_DEVICE),
   -          MYNEWT_VAL(LIS2DW12_INT1_CFG_ACTIVE)}}
   +          MYNEWT_VAL(LIS2DW12_INT1_CFG_ACTIVE)}
   +    }
    };
    #endif
    #endif
   ```
   
   </details>


-- 
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



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2597: sensor_creator: Add LIS2DW12 configuration for bus drivers

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2597:
URL: https://github.com/apache/mynewt-core/pull/2597#issuecomment-843049032


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


-- 
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



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

Posted by GitBox <gi...@apache.org>.
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



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2597: sensor_creator: Add LIS2DW12 configuration for bus drivers

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2597:
URL: https://github.com/apache/mynewt-core/pull/2597#issuecomment-843800929


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


-- 
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



[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2597: sensor_creator: Add LIS2DW12 configuration for bus drivers

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2597:
URL: https://github.com/apache/mynewt-core/pull/2597#issuecomment-842986547


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### hw/sensor/creator/src/sensor_creator.c
   <details>
   
   ```diff
   @@ -619,7 +622,7 @@
    static struct sensor_itf lis2dw12_itf = {
        .si_ints = {
            { MYNEWT_VAL(LIS2DW12_OFB_INT1_PIN_HOST), 1,
   -            MYNEWT_VAL(LIS2DW12_OFB_INT_CFG_ACTIVE)},
   +          MYNEWT_VAL(LIS2DW12_OFB_INT_CFG_ACTIVE)},
            { -1, 0, 0 },
        }
    };
   @@ -627,11 +630,12 @@
    #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,
        .si_ints = {
            { MYNEWT_VAL(LIS2DW12_INT1_PIN_HOST), MYNEWT_VAL(LIS2DW12_INT1_PIN_DEVICE),
   -          MYNEWT_VAL(LIS2DW12_INT1_CFG_ACTIVE)}}
   +          MYNEWT_VAL(LIS2DW12_INT1_CFG_ACTIVE)}
   +    }
    };
    #endif
    #endif
   ```
   
   </details>


-- 
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



[GitHub] [mynewt-core] kasjer merged pull request #2597: sensor_creator: Add LIS2DW12 configuration for bus drivers

Posted by GitBox <gi...@apache.org>.
kasjer merged pull request #2597:
URL: https://github.com/apache/mynewt-core/pull/2597


   


-- 
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



[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2597: sensor_creator: Add LIS2DW12 configuration for bus drivers

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2597:
URL: https://github.com/apache/mynewt-core/pull/2597#issuecomment-843049032


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


-- 
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



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

Posted by GitBox <gi...@apache.org>.
vrahane commented on a change in pull request #2597:
URL: https://github.com/apache/mynewt-core/pull/2597#discussion_r634690744



##########
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:
       +1, it should be `LIS2DW12_OFB_ITF_ADDR`




-- 
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