source: rtems/cpukit/dev/include/dev/i2c/switch-nxp-pca9548a.h @ 0510cfd8

4.115
Last change on this file since 0510cfd8 was 0510cfd8, checked in by Sebastian Huber <sebastian.huber@…>, on 11/11/14 at 11:41:58

Add NXP PCA9548A 8-channel switch I2C driver

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 * @file
3 *
4 * @brief Switch NXP PCA9548A Driver API
5 *
6 * @ingroup I2CSWITCHNXPPCA9548A
7 */
8
9/*
10 * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Dornierstr. 4
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#ifndef _DEV_I2C_SWITCH_NXP_PCA9548A_H
24#define _DEV_I2C_SWITCH_NXP_PCA9548A_H
25
26#include <dev/i2c/i2c.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif /* __cplusplus */
31
32/**
33 * @defgroup I2CSWITCHNXPPCA9548A Switch NXP PCA9535 Driver
34 *
35 * @ingroup I2CDevice
36 *
37 * @brief Driver for NXP PCA9548A 8-channel switch device.
38 *
39 * @{
40 */
41
42int i2c_dev_register_switch_nxp_pca9548a(
43  const char *bus_path,
44  const char *dev_path,
45  uint16_t address
46);
47
48#define SWITCH_NXP_PCA9548A_GET_CONTROL (I2C_DEV_IO_CONTROL + 0)
49
50#define SWITCH_NXP_PCA9548A_SET_CONTROL (I2C_DEV_IO_CONTROL + 1)
51
52static inline int switch_nxp_pca9548a_get_control(int fd, uint8_t *val)
53{
54  return ioctl(fd, SWITCH_NXP_PCA9548A_GET_CONTROL, val);
55}
56
57static inline int switch_nxp_pca9548a_set_control(int fd, uint8_t val)
58{
59  return ioctl(fd, SWITCH_NXP_PCA9548A_SET_CONTROL, (void *)(uintptr_t) val);
60}
61
62/** @} */
63
64#ifdef __cplusplus
65}
66#endif /* __cplusplus */
67
68#endif /* _DEV_I2C_SWITCH_NXP_PCA9548A_H */
Note: See TracBrowser for help on using the repository browser.