i2c  1.4.2
RoadNarrows Robotics I2C Package
i2ccore.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Laelaps
4 //
5 // File: i2ccore.h
6 //
7 /*! \file
8  *
9  * $LastChangedDate: 2016-01-28 14:19:12 -0700 (Thu, 28 Jan 2016) $
10  * $Rev: 4278 $
11  *
12  * \brief I2C python C interface header.
13  *
14  * \author Robin Knight (robin.knight@roadnarrows.com)
15  *
16  * \copyright
17  * \h_copy 2016-2017. RoadNarrows LLC.\n
18  * http://www.roadnarrows.com\n
19  * All Rights Reserved
20  */
21 /*
22  * @EulaBegin@
23  *
24  * Permission is hereby granted, without written agreement and without
25  * license or royalty fees, to use, copy, modify, and distribute this
26  * software and its documentation for any purpose, provided that
27  * (1) The above copyright notice and the following two paragraphs
28  * appear in all copies of the source code and (2) redistributions
29  * including binaries reproduces these notices in the supporting
30  * documentation. Substantial modifications to this software may be
31  * copyrighted by their authors and need not follow the licensing terms
32  * described here, provided that the new terms are clearly indicated in
33  * all files where they apply.
34  *
35  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES
36  * OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
37  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
38  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
39  * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
40  * THE POSSIBILITY OF SUCH DAMAGE.
41  *
42  * THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
43  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
44  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
45  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
46  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
47  *
48  * @EulaEnd@
49  */
50 ////////////////////////////////////////////////////////////////////////////////
51 
52 #ifndef _I2CCORE_H
53 #define _I2CCORE_H
54 
55 
56 #include "rnr/rnrconfig.h"
57 
58 extern int i2ccore_open(const char *device);
59 
60 extern int i2ccore_close(int fd);
61 
62 extern int i2ccore_read(int fd,
63  unsigned short cur_addr,
64  unsigned short addr,
65  byte_t buf[],
66  unsigned int len);
67 
68 extern int i2ccore_write(int fd,
69  unsigned short cur_addr,
70  unsigned short addr,
71  byte_t buf[],
72  unsigned int len);
73 
74 int i2ccore_transfer(int fd, unsigned short cur_addr, unsigned short addr,
75  byte_t wbuf[], unsigned int wcount,
76  byte_t rbuf[], unsigned int rcount);
77 
78 int i2ccore_check(int fd, unsigned short cur_addr, unsigned short addr);
79 
80 #endif // _I2CCORE_H
int i2ccore_check(int fd, unsigned short cur_addr, unsigned short addr)
Test for the existence of a device with the given address.
int i2ccore_write(int fd, unsigned short cur_addr, unsigned short addr, byte_t buf[], unsigned int len)
Write data to an attached device connected to the open I2C bus.
int i2ccore_transfer(int fd, unsigned short cur_addr, unsigned short addr, byte_t wbuf[], unsigned int wcount, byte_t rbuf[], unsigned int rcount)
Transfer data to an attached device connected to the open I2C bus reead back.
int i2ccore_read(int fd, unsigned short cur_addr, unsigned short addr, byte_t buf[], unsigned int len)
Read data from an attached device connected to the open I2C bus.
int i2ccore_open(const char *device)
Open a I2C bus device.
int i2ccore_close(int fd)
Close an open I2C bus device.