Christian Lerche
/
PCA9532
This program is for writing to PCA9532 on the LPCXpresso Base Board.
Embed:
(wiki syntax)
Show/hide line numbers
PCA9532.cpp
00001 #include "PCA9532.h" 00002 #include "mbed.h" 00003 using namespace mbed; 00004 PCA9532::PCA9532(PinName sda, PinName scl, int addr) 00005 : _i2c(sda,scl) { 00006 _addr = addr; 00007 } 00008 00009 int PCA9532::read(void) { 00010 char foo[1]; 00011 _i2c.read(_addr,foo,1); 00012 return (foo[0]); 00013 } 00014 00015 void PCA9532::write(int command, int data) { 00016 char foo[2]; 00017 foo[0] = command; 00018 foo[1] = data; 00019 _i2c.write(_addr,foo,2); 00020 return; 00021 }
Generated on Tue Jul 19 2022 15:58:45 by 1.7.2