2018-03-06 00:11:05 +08:00
|
|
|
/****************************************************************************
|
2021-03-09 05:39:04 +08:00
|
|
|
* drivers/i2c/pca9540bdp.h
|
2018-03-06 00:11:05 +08:00
|
|
|
*
|
2022-02-23 16:00:04 +08:00
|
|
|
* 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
|
2018-03-06 00:11:05 +08:00
|
|
|
*
|
2022-02-23 16:00:04 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2018-03-06 00:11:05 +08:00
|
|
|
*
|
2022-02-23 16:00:04 +08:00
|
|
|
* 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.
|
2018-03-06 00:11:05 +08:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
2018-03-06 00:22:22 +08:00
|
|
|
|
2018-03-06 00:11:05 +08:00
|
|
|
#ifndef __DRIVERS_I2C_PCA9540BDP_H
|
|
|
|
#define __DRIVERS_I2C_PCA9540BDP_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <nuttx/i2c/i2c_master.h>
|
|
|
|
|
|
|
|
#ifdef CONFIG_I2CMULTIPLEXER_PCA9540BDP
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef CONFIG_PCA9549BDP_I2C_FREQUENCY
|
|
|
|
# define CONFIG_PCA9549BDP_I2C_FREQUENCY 400000 /* 400 khz */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Bit Definitions to be passed to write calls */
|
|
|
|
|
|
|
|
#define PCA9540BDP_ENABLE 0x4
|
|
|
|
#define PCA9540BDP_DISABLE 0x0
|
|
|
|
|
|
|
|
/* Bit masks */
|
|
|
|
|
|
|
|
#define PCA9540BDP_CH_BITMASK 0x03
|
|
|
|
#define PCA9540BDP_ENABLE_BITMASK 0x04
|
|
|
|
|
|
|
|
#define PCA9540BDP_CH_BIT 0
|
|
|
|
#define PCA9540BDP_CH_NONE_BIT 1
|
|
|
|
#define PCA9540BDP_ENABLE_BIT 2
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
struct pca9540bdp_dev_s
|
|
|
|
{
|
2018-03-06 00:22:22 +08:00
|
|
|
FAR struct i2c_master_s *i2c; /* I2C interface */
|
2018-03-06 00:11:05 +08:00
|
|
|
uint16_t addr;
|
2018-03-06 00:22:22 +08:00
|
|
|
uint8_t state; /* Control register state */
|
2018-03-06 00:11:05 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct i2c_port_dev_s
|
|
|
|
{
|
2018-03-06 00:22:22 +08:00
|
|
|
FAR struct i2c_master_s vi2c; /* Nested structure to allow casting as
|
|
|
|
* public i2c master */
|
|
|
|
uint8_t port; /* Associated port on the mux */
|
2020-04-01 13:03:22 +08:00
|
|
|
FAR struct pca9540bdp_dev_s *dev; /* Associated device */
|
2018-03-06 00:11:05 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* CONFIG_I2CMULTIPLEXER_PCA9540BDP */
|
|
|
|
#endif /* __DRIVERS_I2CMULTIPLEXER_PCA9540BDP_H */
|