You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/01/30 14:14:05 UTC

[GitHub] [incubator-nuttx] acassis commented on a change in pull request #5376: i2c: Add TCA9548A I2C Multiplexer

acassis commented on a change in pull request #5376:
URL: https://github.com/apache/incubator-nuttx/pull/5376#discussion_r795188253



##########
File path: boards/xtensa/esp32/common/src/esp32_tca9548a.c
##########
@@ -0,0 +1,145 @@
+/****************************************************************************
+ * boards/xtensa/esp32/common/src/esp32_tca9548a.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/i2c/i2c_master.h>
+#include <nuttx/i2c/tca9548a.h>
+
+#include "esp32_board_i2c.h"
+#include "esp32_i2c.h"
+#include "esp32_tca9548a.h"
+
+FAR struct tca9548a_dev_s *g_tca9448a_devs[8] =
+                                                {
+                                                  NULL,
+                                                  NULL,
+                                                  NULL,
+                                                  NULL,
+                                                  NULL,
+                                                  NULL,
+                                                  NULL,
+                                                  NULL
+                                                };
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_tca9548a_initialize
+ *
+ * Description:
+ *   Initialize and register the TCA9548A Pressure Sensor driver.
+ *
+ * Input Parameters:
+ *   devno - The device number, used to build the device path as /dev/pressN
+ *   busno - The I2C bus number
+ *
+ * Returned Value:
+ *   Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+int board_tca9548a_initialize(int devno, int busno)
+{
+  struct i2c_master_s *i2c;
+  uint8_t addr;
+
+  i2cinfo("Initializing TCA9548A!\n");
+
+  /* TCA9548A valid addresses are 0:0x70 - 7:0x77 */
+
+  if (devno < TCA9548A_SEL_CH0 && devno > TCA9548A_SEL_CH8)

Review comment:
       Thank you!




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

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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