Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LT_Wire.h
Go to the documentation of this file.
1 /*!
2  TwoWire.h - TWI/I2C library for Arduino & Wiring
3  Copyright (c) 2006 Nicholas Zambetti. All right reserved.
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19  Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts
20 
21  Modified 2014 to conserve memory for master mode and PMBus compliance
22 */
23 
24 /*! @file
25  @ingroup LT_Wire
26  Library Header File for LT_Wire
27 */
28 
29 #ifndef LT_TwoWire_h
30 #define LT_TwoWire_h
31 
32 #include <inttypes.h>
33 #include <Wire.h>
34 
35 
36 class LT_TwoWire : public TwoWire
37 {
38  public:
39  LT_TwoWire();
40 
41  //! Initiate Prep
42  //! @speed 10000 to 400000
43  //! @return void
44  void begin(uint32_t speed);
45 
46  //! Read from a slave I2C device.
47  //! @return number of bytes read. If different from quantity, something bad happened.
48  uint8_t requestFrom(uint8_t address, //!< 7-bit I2C address
49  uint8_t *acceptBuffer, //!< buffer pointer to fill
50  uint16_t quantity //!< anticipated length of read
51  );
52 
53  //! Read from a slave I2C device.
54  //! @return number of bytes read. If different from quantity, something bad happened.
55  uint8_t requestFrom(uint8_t address, //!< 7-bit I2C address
56  uint8_t *acceptBuffer, //!< buffer pointer to fill
57  uint16_t quantity, //!< anticipated length of read
58  uint8_t sendStop //!< whether to STOP or anticipate a repeated START
59  );
60 
61  //! Read from a slave I2C device.
62  //! @return number of bytes read. If different from quantity, something bad happened.
63  uint8_t requestFrom(int address, //!< 7-bit I2C address
64  uint8_t *acceptBuffer, //!< buffer pointer to fill
65  int quantity //!< anticipated length of read
66  );
67 
68  //! Read from a slave I2C device.
69  //! @return number of bytes read. If different from quantity, something bad happened.
70  uint8_t requestFrom(int address, //!< 7-bit I2C address
71  uint8_t *acceptBuffer, //!< buffer pointer to fill
72  int quantity, //!< anticipated length of read
73  int sendStop //!< whether to STOP or anticipate a repeated START
74  );
75 
76 };
77 
78 extern LT_TwoWire LT_Wire;
79 
80 #endif
81 
LT_TwoWire LT_Wire
Definition: LT_Wire.cpp:84
uint8_t requestFrom(uint8_t address, uint8_t *acceptBuffer, uint16_t quantity)
Read from a slave I2C device.
Definition: LT_Wire.cpp:67
static uint8_t address
Definition: DC2091A.ino:83
LT_TwoWire()
Definition: LT_Wire.cpp:46
void begin(uint32_t speed)
Initiate Prep 10000 to 400000.
Definition: LT_Wire.cpp:52