
This program is for writing to PCA9532 on the LPCXpresso Base Board.
Diff: PCA9532.cpp
- Revision:
- 0:8dffae878f54
diff -r 000000000000 -r 8dffae878f54 PCA9532.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PCA9532.cpp Sat Feb 06 06:32:14 2010 +0000 @@ -0,0 +1,21 @@ +#include "PCA9532.h" +#include "mbed.h" +using namespace mbed; +PCA9532::PCA9532(PinName sda, PinName scl, int addr) + : _i2c(sda,scl) { + _addr = addr; + } + +int PCA9532::read(void) { + char foo[1]; + _i2c.read(_addr,foo,1); + return (foo[0]); + } + +void PCA9532::write(int command, int data) { + char foo[2]; + foo[0] = command; + foo[1] = data; + _i2c.write(_addr,foo,2); + return; + } \ No newline at end of file