parent
b49f205284
commit
1e7e7fc168
@ -1,18 +1,32 @@
|
||||
#include <iostream>
|
||||
#include "ii2c.hpp"
|
||||
#include <iostream>
|
||||
#include <array>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
std::array<uint8_t,3> data = {0, 0, 0};
|
||||
|
||||
I2C i2c;
|
||||
|
||||
std::cout << static_cast<int>(i2c.readByte(100,50)) << std::endl;
|
||||
|
||||
i2c.writeByte(20,30,40);
|
||||
i2c.writeByte(20, 30, 40);
|
||||
|
||||
std::cout<< static_cast<int>(i2c.readWord(23,24)) << std::endl;
|
||||
|
||||
i2c.writeWord(21,31,1024);
|
||||
i2c.writeWord(21, 31, 1024);
|
||||
|
||||
i2c.readBuffer(31, 34, &data[0], data.size());
|
||||
std::cout << "received data:"<< std::endl;
|
||||
for(i = 0; i < data.size(); i++) {
|
||||
std::cout << static_cast<int>(data[i]) << std::endl;
|
||||
}
|
||||
|
||||
i2c.writeBuffer(77, 88, &data[0], data.size());
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Binary file not shown.
Loading…
Reference in new issue