ss

Dependencies:   WS2812 PixelArray Adafruit_GFX

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PCF8574.h Source File

PCF8574.h

00001 #include "mbed.h"
00002  
00003 #ifndef MBED_PCF8574_H
00004 #define MBED_PCF8574_H
00005  
00006 /** Interface to the popular PCF8574 I2C 8 Bit IO expander */
00007 class PCF8574 {
00008 public:
00009     /** Create an instance of the PCF8574 connected to specfied I2C pins, with the specified address.
00010      *
00011      * @param sda The I2C data pin
00012      * @param scl The I2C clock pin
00013      * @param address The I2C address for this PCF8574
00014      */
00015     PCF8574(PinName sda, PinName scl, int address);
00016  
00017     /** Read the IO pin level
00018      *
00019      * @return The byte read
00020      */
00021     int read();
00022     
00023     /** Write to the IO pins
00024      * 
00025      * @param data The 8 bits to write to the IO port
00026      */
00027     void write(int data);
00028  
00029 private:
00030     I2C _i2c;
00031     int _address;
00032 };
00033  
00034 #endif