Rpi-hw  0.7.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
mcp23008-inl.hpp
1 /*
2  Title --- driver/mcp23008-inl.hpp
3 
4  Copyright (C) 2013 Giacomo Trudu - wicker25[at]gmail[dot]com
5 
6  This file is part of Rpi-hw.
7 
8  Rpi-hw is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation version 3 of the License.
11 
12  Rpi-hw is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with Rpi-hw. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 
22 #ifndef _RPI_HW_DRIVER_MCP23017_INL_HPP_
23 #define _RPI_HW_DRIVER_MCP23017_INL_HPP_
24 
25 namespace rpihw { // Begin main namespace
26 
27 namespace driver { // Begin drivers namespace
28 
29 inline void
30 mcp23008::send( uint8_t reg, uint8_t data ) {
31 
32  // Send data to the device
33  m_i2c->writeReg8( reg, data );
34 }
35 
36 inline uint8_t
37 mcp23008::receive( uint8_t reg ) {
38 
39  // Receive data from the device
40  return m_i2c->readReg8( reg );
41 }
42 
43 } // End of drivers namespace
44 
45 } // End of main namespace
46 
47 #endif /* _RPI_HW_DRIVER_MCP23017_INL_HPP_ */
uint8_t readReg8(uint8_t reg)
Reads a byte from a register on the device.
void writeReg8(uint8_t reg, uint8_t data)
Writes a byte data to a register on the device.
virtual uint8_t receive(uint8_t reg)
Receives data from the device.
virtual void send(uint8_t reg, uint8_t data)
Sends data to the device.
driver::i2c * m_i2c
Inter Integrated Circuit.
Definition: mcp23008.hpp:60