Library with address set to hardware pins

Committer:
Bas
Date:
Sat Sep 08 22:12:10 2012 +0000
Revision:
0:95cf83ce54ec
Name changes in WriteBytes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Bas 0:95cf83ce54ec 1 /*
Bas 0:95cf83ce54ec 2 * PCF8575 Remote 16-bit I/O expander for I2C-bus
Bas 0:95cf83ce54ec 3 * Copyright (c) 2012 Bas van Drunen Littel
Bas 0:95cf83ce54ec 4 *
Bas 0:95cf83ce54ec 5 * Permission is hereby granted, free of charge, to any person obtaining a copy
Bas 0:95cf83ce54ec 6 * of this software and associated documentation files (the "Software"), to deal
Bas 0:95cf83ce54ec 7 * in the Software without restriction, including without limitation the rights
Bas 0:95cf83ce54ec 8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Bas 0:95cf83ce54ec 9 * copies of the Software, and to permit persons to whom the Software is
Bas 0:95cf83ce54ec 10 * furnished to do so, subject to the following conditions:
Bas 0:95cf83ce54ec 11 *
Bas 0:95cf83ce54ec 12 * The above copyright notice and this permission notice shall be included in
Bas 0:95cf83ce54ec 13 * all copies or substantial portions of the Software.
Bas 0:95cf83ce54ec 14 *
Bas 0:95cf83ce54ec 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Bas 0:95cf83ce54ec 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Bas 0:95cf83ce54ec 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Bas 0:95cf83ce54ec 18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Bas 0:95cf83ce54ec 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Bas 0:95cf83ce54ec 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
Bas 0:95cf83ce54ec 21 * THE SOFTWARE.
Bas 0:95cf83ce54ec 22 */
Bas 0:95cf83ce54ec 23 #ifndef __PCF8575_H
Bas 0:95cf83ce54ec 24 #define __PCF8575_H
Bas 0:95cf83ce54ec 25
Bas 0:95cf83ce54ec 26 #define VERSION 1.0
Bas 0:95cf83ce54ec 27
Bas 0:95cf83ce54ec 28 #include <mbed.h>
Bas 0:95cf83ce54ec 29
Bas 0:95cf83ce54ec 30 #define PCF8575_I2C_ADDRESS 0x40
Bas 0:95cf83ce54ec 31
Bas 0:95cf83ce54ec 32 class PCF8575 {
Bas 0:95cf83ce54ec 33 public:
Bas 0:95cf83ce54ec 34 PCF8575(I2C* _interface, unsigned char _chipselect);
Bas 0:95cf83ce54ec 35 ~PCF8575(void);
Bas 0:95cf83ce54ec 36
Bas 0:95cf83ce54ec 37 unsigned short ReadBytes(void);
Bas 0:95cf83ce54ec 38 void WriteBytes(unsigned short bytes);
Bas 0:95cf83ce54ec 39 void WriteBytes(unsigned char byte0, unsigned char byte1);
Bas 0:95cf83ce54ec 40
Bas 0:95cf83ce54ec 41 private:
Bas 0:95cf83ce54ec 42 I2C* i2c; // Communication interface
Bas 0:95cf83ce54ec 43 unsigned char address; //I2C address
Bas 0:95cf83ce54ec 44 };
Bas 0:95cf83ce54ec 45 #endif