git-svn-id: svn://db.shs.com.ru/pip@566 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
22 lines
626 B
C++
22 lines
626 B
C++
#include "pip.h"
|
|
#include "pispi.h"
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
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;
|
|
}
|
|
|