New LiquidCrystal library  1.3.2
Generic LCD control library
/Users/fmalpartida/Documents/development/mercurial repos/SW/NewliquidCrystal/I2CIO.h
1 // ---------------------------------------------------------------------------
2 // Created by Francisco Malpartida on 20/08/11.
3 // Copyright 2011 - Under creative commons license 3.0:
4 // Attribution-ShareAlike CC BY-SA
5 //
6 // This software is furnished "as is", without technical support, and with no
7 // warranty, express or implied, as to its usefulness for any purpose.
8 //
9 // Thread Safe: No
10 // Extendable: Yes
11 //
12 // @file I2CIO.h
13 // This file implements a basic IO library using the PCF8574 I2C IO Expander
14 // chip.
15 //
16 // @brief
17 // Implement a basic IO library to drive the PCF8574* I2C IO Expander ASIC.
18 // The library implements basic IO general methods to configure IO pin direction
19 // read and write uint8_t operations and basic pin level routines to set or read
20 // a particular IO port.
21 //
22 // @version API 1.0.0
23 //
24 // @author F. Malpartida - fmalpartida@gmail.com
25 // ---------------------------------------------------------------------------
26 
27 #ifndef _I2CIO_H_
28 #define _I2CIO_H_
29 
30 #include <inttypes.h>
31 
32 #define _I2CIO_VERSION "1.0.0"
33 
41 class I2CIO
42 {
43 public:
49  I2CIO ( );
50 
62  int begin ( uint8_t i2cAddr );
63 
73  void pinMode ( uint8_t pin, uint8_t dir );
74 
83  void portMode ( uint8_t dir );
84 
94  uint8_t read ( void );
95 
108  uint8_t digitalRead ( uint8_t pin );
109 
123  int write ( uint8_t value );
124 
136  int digitalWrite ( uint8_t pin, uint8_t level );
137 
138 
139 
140 private:
141  uint8_t _shadow; // Shadow output
142  uint8_t _dirMask; // Direction mask
143  uint8_t _i2cAddr; // I2C address
144  bool _initialised; // Initialised object
145 
154  bool isAvailable (uint8_t i2cAddr);
155 
156 };
157 
158 #endif
Definition: I2CIO.h:41
void portMode(uint8_t dir)
Definition: I2CIO.cpp:103
int write(uint8_t value)
Definition: I2CIO.cpp:140
void pinMode(uint8_t pin, uint8_t dir)
Definition: I2CIO.cpp:86
int digitalWrite(uint8_t pin, uint8_t level)
Definition: I2CIO.cpp:180
uint8_t digitalRead(uint8_t pin)
Definition: I2CIO.cpp:163
I2CIO()
Definition: I2CIO.cpp:51
int begin(uint8_t i2cAddr)
Definition: I2CIO.cpp:65
uint8_t read(void)
Definition: I2CIO.cpp:121