From 2bf2f91a74c72f436eb7f34d7be4668e6599a2fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Thu, 7 Dec 2017 07:25:23 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@573 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- main.cpp | 4 +++- src_main/io/pispi.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 8f41dc46..28577f98 100644 --- a/main.cpp +++ b/main.cpp @@ -13,8 +13,10 @@ int main(int argc, char *argv[]) { } PIString path = cli.argumentValue("dev"); PISPI spi(path, 1000000); - spi.setDebug(true); + piCout << "SPI" << path; + //spi.setDebug(true); if (cli.hasArgument("speed")) spi.setSpeed(cli.argumentValue("speed").toInt()); + piCout << "try opening.."; piCout << "open" << spi.open(); piCout << "write" << spi.write(PIByteArray::fromHex("0000000000000000000000000000000000000000000000000000000000000000")); piCout << "read" << spi.readForTime(10).toHex(); diff --git a/src_main/io/pispi.cpp b/src_main/io/pispi.cpp index 7e95ef42..e75ce18a 100644 --- a/src_main/io/pispi.cpp +++ b/src_main/io/pispi.cpp @@ -93,7 +93,7 @@ int PISPI::writeDevice(const void * data, int max_size) { ret = ioctl(PRIVATE->fd, SPI_IOC_MESSAGE(1), &PRIVATE->spi_ioc_tr); if (ret < 1) {piCoutObj << "can't send spi message" << ret; return -1;} recv_buf.append(rx_buf); - if (recv_buf.size() > threadedReadBufferSize()) recv_buf.resize(threadedReadBufferSize()); + if (recv_buf.size_s() > threadedReadBufferSize()) recv_buf.resize(threadedReadBufferSize()); return max_size; } #endif