New LiquidCrystal library  1.3.5
Generic LCD control library
/Users/fmalpartida/Documents/development/mercurial repos/SW/NewliquidCrystal/SI2CIO.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 SI2CIO.h
13 // This file implements a basic IO library using the PCF8574 I2C IO Expander
14 // chip, but using software I2C.
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 // Adapted to SoftIC2 by Adrian Piccioli - adrianpiccioli@gmail.com
26 // ---------------------------------------------------------------------------
27 
28 #ifndef _SI2CIO_H_
29 #define _SI2CIO_H_
30 
31 #if defined (__AVR__)
32 
33 #include <inttypes.h>
34 
35 #define _SI2CIO_VERSION "1.0.0"
36 
44 class SI2CIO
45 {
46 public:
52  SI2CIO ( );
53 
65  int begin ( uint8_t i2cAddr );
66 
76  void pinMode ( uint8_t pin, uint8_t dir );
77 
86  void portMode ( uint8_t dir );
87 
97  uint8_t read ( void );
98 
111  uint8_t digitalRead ( uint8_t pin );
112 
126  int write ( uint8_t value );
127 
139  int digitalWrite ( uint8_t pin, uint8_t level );
140 
141 
142 
143 private:
144  uint8_t _shadow; // Shadow output
145  uint8_t _dirMask; // Direction mask
146  uint8_t _i2cAddr; // I2C address
147  bool _initialised; // Initialised object
148 
149 };
150 
151 #else
152 #error "ONLY SUPPORTED ON AVR PROCESSORS"
153 #endif // defined (__AVR__)
154 
155 #endif