ss

Dependencies:   WS2812 PixelArray Adafruit_GFX

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PCF8574.cpp Source File

PCF8574.cpp

00001 #include "PCF8574.h"
00002 #include "mbed.h"
00003  
00004 PCF8574::PCF8574(PinName sda, PinName scl, int address)
00005         : _i2c(sda, scl) {
00006     _address = address;
00007     _i2c.frequency(100000);
00008 }
00009  
00010 int PCF8574::read() {
00011     char foo[1];
00012     _i2c.read(_address, foo, 1);
00013     return foo[0];
00014 }
00015  
00016 void PCF8574::write(int data) {
00017     char foo[1];
00018     foo[0] = data;
00019     _i2c.write(_address, foo, 1);
00020 }