You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
609 B
33 lines
609 B
#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);
|
|
|
|
std::cout<< static_cast<int>(i2c.readWord(23,24)) << std::endl;
|
|
|
|
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;
|
|
}
|