spi
git-svn-id: svn://db.shs.com.ru/pip@566 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
33
main.cpp
33
main.cpp
@@ -1,26 +1,21 @@
|
||||
#include "pip.h"
|
||||
#include "picompress.h"
|
||||
#include "pispi.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
PIString s = PIString::fromUTF8("hello, привет привет привет привет привет привет");
|
||||
PIByteArray ba = s.toUTF8();
|
||||
piCout << "original " << ba.toHex();
|
||||
ba = piCompress(ba);
|
||||
piCout << "compress " << ba.toHex();
|
||||
ba = piDecompress(ba);
|
||||
piCout << "decompress" << ba.toHex();
|
||||
piCout << PIString::fromUTF8(ba);
|
||||
ba = PIByteArray(160);
|
||||
piCout << ba.toHex() << ba.size();
|
||||
piCout << piCompress(ba).toHex() << piCompress(ba).size();
|
||||
/*PIString s = PIString::fromUTF8("hello, привет");
|
||||
piCout << s;
|
||||
PIByteArray ba = s.toUTF8();
|
||||
piCout << ba.toHex();
|
||||
PIString s2;
|
||||
s2 = PIString::fromUTF8(ba);
|
||||
piCout << s2;*/
|
||||
PICLI cli(argc, argv);
|
||||
cli.setOptionalArgumentsCount(1);
|
||||
cli.addArgument("dev", true);
|
||||
cli.addArgument("speed", true);
|
||||
if (!cli.hasArgument("dev")) {
|
||||
return 0;
|
||||
}
|
||||
PIString path = cli.argumentValue("dev");
|
||||
PISPI spi(path);
|
||||
if (cli.hasArgument("speed")) spi.setSpeed(cli.argumentValue("speed").toInt());
|
||||
piCout << "open" << spi.open();
|
||||
piCout << "write" << spi.write(PIByteArray::fromHex("0000000000000000000000000000000000000000000000000000000000000000"));
|
||||
piCout << "read" << spi.readForTime(10).toHex();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user