kasjer commented on a change in pull request #1507: [RFC] Add generic serial 
bus driver
URL: https://github.com/apache/mynewt-core/pull/1507#discussion_r233057377
 
 

 ##########
 File path: apps/bus_test/bme280_node/src/bme280_node.c
 ##########
 @@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "os/mynewt.h"
+#include "console/console.h"
+#include "bus/bus.h"
+#include "bus/i2c.h"
+#include "bme280_node/bme280_node.h"
+#include "ext/bme280.h"
+
+#define BME280_ODEV(_node) ((struct os_dev *)(&(_node)->i2c_node))
+
+struct bme280_node {
+    struct bme280_dev bme280_dev;
+    struct bus_i2c_node i2c_node;
+};
+
+static struct bme280_node g_bme280_node;
+
+struct reg_val {
+    uint8_t addr;
+    uint8_t val[32];
+};
+
+static int8_t
+bme280_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len)
+{
+    struct reg_val reg;
 
 Review comment:
   I guess bme280_read/write/delay are expected by Bosch code. I fail to see a 
reason for additional stack space for local buffer for registers that will be 
copied to Bosch provided buffer (maybe also on stack).
   It's more understandable in write when register is also passed in on write 
command buffer.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to