I2CIO.h
Go to the documentation of this file.

    00001 // ---------------------------------------------------------------------------
    00002 // Created by Francisco Malpartida on 20/08/11.
    00003 // Copyright 2011 - Under creative commons license 3.0:
    00004 //        Attribution-ShareAlike CC BY-SA
    00005 //
    00006 // This software is furnished "as is", without technical support, and with no
    00007 // warranty, express or implied, as to its usefulness for any purpose.
    00008 //
    00009 // Thread Safe: No
    00010 // Extendable: Yes
    00011 //
    00012 // @file I2CIO.h
    00013 // This file implements a basic IO library using the PCF8574 I2C IO Expander
    00014 // chip.
    00015 //
    00016 // @brief
    00017 // Implement a basic IO library to drive the PCF8574* I2C IO Expander ASIC.
    00018 // The library implements basic IO general methods to configure IO pin direction
    00019 // read and write uint8_t operations and basic pin level routines to set or read
    00020 // a particular IO port.
    00021 //
    00022 // @version API 1.0.0
    00023 //
    00024 // @author F. Malpartida - fmalpartida@gmail.com
    00025 // ---------------------------------------------------------------------------
    00026
    00027 #ifndef _I2CIO_H_
    00028 #define _I2CIO_H_
    00029
    00030 #include <inttypes.h>
    00031
    00032 #define _I2CIO_VERSION "1.0.0"
    00033
    00041 class I2CIO
    00042 {
    00043 public:
    00049    I2CIO ( );
    00050
    00062    int begin ( uint8_t i2cAddr );
    00063
    00073    void pinMode ( uint8_t pin, uint8_t dir );
    00074
    00083    void portMode ( uint8_t dir );
    00084
    00094    uint8_t read ( void );
    00095
    00108    uint8_t digitalRead ( uint8_t pin );
    00109
    00123    int write ( uint8_t value );
    00124
    00136    int digitalWrite ( uint8_t pin, uint8_t level );
    00137
    00138
    00139
    00140 private:
    00141    uint8_t _shadow;      // Shadow output
    00142    uint8_t _dirMask;     // Direction mask
    00143    uint8_t _i2cAddr;     // I2C address
    00144    bool    _initialised; // Initialised object
    00145
    00146 };
    00147
    00148 #endif

All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines